URGENT, huh?  I wasn't going to help you, until you reposted and
added an "URGENT" to the end.  Sigh.  Maybe if you repost and add a "MY
LIFE IS ON THE LINE" you'll get more help.
        In any case, see below...

On Mon, 4 Sep 2000, [iso-8859-1] joel cordonnier wrote:
> Hi! I'm a jboss new user, I need HELP
> 
> I habe a Session bean (named TravelAgentBean) that
> call a CMP entity bean (named CabinBean).
> These two beans are deployed separatly, each one with
> its own file descriptor ejb-jar.xml
> 
> I have several questions:
> 
> - In my Session bean, I have:
> Object obj = jndiContext.lookup("CabinBean"); and it's
> seems to be OK.
> When I replace the argument by
> "java:comp/env/CabinBean" (default Context?) there is
> an exception, why ?
> I have to add some property so my jndiContext ?

        What's the exception?  This may be because you need an ejb-ref
clause in your jboss.xml that links tells the session bean what to link to
when you ask for "CabinHome" (see below).  Also, you need to make sure the
home and remote interfaces for the entity bean are available to the
session bean (put the classes in the session JAR, or add a manifest
classpath to the JAR, or whatever).  By default, a bean sees only the
classes in its own JAR.

> -At the moment, I don't add a 'jboss.xml' file in my
> deployed .jar file, so I use the default one.
> The name of the argument for the 'lookup' is then the
> name given by the tag <ejb-name> in the file
> ejb-jar.xml, RIGHT ?.?????

        If you're looking up a bean from the client, then you use the
<ejb-name> (TravelAgentBean below).  If you're looking up one bean from
another using the ejb-ref, then you use java:comp/env/<enb-ref-name> as
you tried above.

> And if I add the a 'jboss.xml' file, the name is the
> one between <jndi-name> ?????

        Correct, so you could list the bean named "TravelAgentBean" in
JNDI as "GetMeToJamaica" or whatever.

> ------- my session bean ejb-jar.xml file:
> <enterprise-beans>
> <session>
> <ejb-name>TravelAgentBean</ejb-name>
> <home>com.titan.travelagent.TravelAgentHome</home>
> <remote>com.titan.travelagent.TravelAgent</remote>
> <ejb-class>com.titan.travelagent.TravelAgentBean</ejb-class>
> <session-type>Stateless</session-type>
> <transaction-type>Container</transaction-type>
> <ejb-ref>
> <ejb-ref-name>CabinHome</ejb-ref-name>
> <ejb-ref-type>Entity</ejb-ref-type>
> <home>com.titan.cabin.CabinHome</home>
> <remote>com.titan.cabin.Cabin</remote>
> </ejb-ref>
> </session>
> </enterprise-beans>
>
> ------- the end of my jboss.xml file: (1)
> <enterprise-beans>
> <session>
> <ejb-name>TravelAgentBean</ejb-name>
> <jndi-name>TravelAgentBean</jndi-name>
> <configuration-name>Default Stateless
> SessionBean</configuration-name>
> </session>
> </enterprise-beans>
> 
> ------ Since my session bean will have to call methods
> of my entity bean, I hava to add this definitions in
> jboss.xml ??????? (2)
> <entity>
> <ejb-name>CabinBean</ejb-name>
> <jndi-name>CabinBean</jndi-name>
> <configuration-name>CMP
> EntityBean</configuration-name>
> </entity>
> 
> THE PROBLEMS ARE:
> - when i add (1), the deployment failed !!!!! WHY
> ?????

        Hmmm...  Activating telepathic inducer matrix...  Ah.  Clearly
because you forgot to shower this morning.  No, seriously, please provide
a stack trace or any messages in the console areound the deployment
failure.  Also, try turning on verification (in conf/jboss.jcml, find the
line

       <attribute name="VerifyDeployments">false</attribute>

and change it to "true").  This should print messages about any problems
it can find, though it doesn't stop the deployer from trying anyway.

> - is the part (2) needed ? 

        No, to support the ejb-ref, you need an ejb-ref section in the
section for your session bean.  That maps the ejb-ref-name from
ejb-jar.xml to a JNDI name where the entity bean can be found.  You should
not include a full section on the entity bean unless it is located in the
same JAR.  Here's an example with a session bean that calls another bean
and uses a data source (which may not be relevant for you):

       <session>
         <ejb-name>ACDCatalog</ejb-name>
         <jndi-name>ACDCatalogHome</jndi-name>
         <configuration-name>Default Stateful SessionBean</configuration-name>
         <ejb-ref>
           <ejb-ref-name>ejb/ForwardCursor</ejb-ref-name>
           <jndi-name>ForwardCursorHome</jndi-name>
         </ejb-ref>
         <resource-ref>
           <res-ref-name>jdbc/ACDCatalogDB</res-ref-name>
           <resource-name>CPIDB</resource-name>
         </resource-ref>
       </session>

> AND AND.....
> When i use only the ejb-jar.xml file (no jboss.xml
> file, and the deployment process is OK) i have a
> SERVER EXCEPTION when i have
> 'Class aClass = CabinHome.class , 'aClass' used for
> the call PortableRemoteObject)
> 
> java.rmi.ServerException:RemoteException occured in
> server thread; nested exception is:
> java.rmi.ServerException occured:
> com.titan.cabin.CabinHome 
> at sun.rmi.transport.StreamRemoteCall exception
> received (FromServerStreamRemoteCall.java:245)
> .........
> at
> 
>org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(StatelessSessionProxy.java:164)
> at �Proxy1.listCabins(Unknown source)
> at com.titan.travelagent.TravelAgentClient_1

        Well, the ServerException may have another exception at it's
heart, which is what you'd be interested in.  Also, I assume you're using
the same JDK version on both client and server?  Finally, this could be
caused by what I mentioned far above - if you package beans in different
JARs, they need to have access to each other's home and remote
interfaces.  And the client needs the same interfaces, for that matter.

> 
> Thanks for any help
> 
> Joel Cordonnier

        You may consider attempting to package all the beans in one JAR -
it definitely makes it easier to resolve all the interfaces and stuff.
Also, there's a little tutorial for these examples on the jBoss web page
if you're interested.  Follow the "getting started" link on the bottom of
the left sidebar, and then look for the "RMH (run the examples) Howto".

Aaron



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to