I recently installed jBoss 2 with no problems and am now
trying to get the "Titan" examples from Richard Monson-
Haefel's EJB book (chapter 4) to run.

So far, I've successfully deployed the Cabin entity bean
and it works fine--the bean, the CMP, and the client all
perform flawlessly.  When I deployed the TravelAgentBean
(a stateless session bean that attempts to be a "client"
of the Cabin bean), however, I ran into a problem I've
spent a couple of days trying to resolve.

I've tinkered extensively with the xml files and looked
at the bank examples to try to replicate the style as
much as I could, to no avail.  I suspect some sort of issue
with the EJB "link," but it's all somewhat new to me, and
I'm really not sure.  My current setup is a folder in
the jBoss/deploy folder with _one_ set of meta-inf xml
files.

My working client has code like this:

  Context jndiContext = getInitialContext();
  Object obj = jndiContext.lookup("titan/CabinBean");

...and it works as advertised.  (The getInitialContext()
method simply creates an InitialContext after setting
java.naming.factory.initial and java.naming.provider.url
properties.)

The session bean does this:

  jndiContext = new InitialContext();
  Object obj = jndiContext.lookup("titan/CabinBean");

...and fails consistently in the lookup() method.

I've tried a variety of things:

* using the getInitialContext() method instead of
  new InitialContext()
* altering ejb-jar.xml and jboss.xml using every method
  I could think of, both graphically and manually, as
  well as making a link called ejb/CabinBean as in the
  bank samples
* passing different JNDI names into the lookup() method

...all to no avail.

When I try jndiContext.lookup("titan/CabinBean"), which works perfectly
from the client, I get this:

javax.naming.CommunicationException.  Root exception is         at
java.net.URL.<init>(URL.java:473)
        at java.net.URL.<init>(URL.java:376)
        at java.net.URL.<init>(URL.java:330)
        at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:374)
        at sun.rmi.server.LoaderHandler.getClassLoader(LoaderHandler.java:254)
        at
sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:
172)
        at
java.io.ObjectInputStream.inputProxyClassDescriptor(ObjectInputStream.java:9
82)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:171)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:152)
        at javax.naming.InitialContext.lookup(InitialContext.java:350)
        at
com.titan.travelagent.TravelAgentBean.listCabins(TravelAgentBean.java:33)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(Stateles
sSessionContainer.java:286)
        at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:82
)
        at
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSe
ssionInstanceInterceptor.java:73)
        at org.jboss.ejb.plugins.TxInterceptor.invoke(TxInterceptor.java:179)
        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:140)
        at
org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.jav
a:152)
        at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerI
nvoker.java:129)
        at java.lang.reflect.Method.invoke(Native Method)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
        at sun.rmi.transport.Transport$1.run(Transport.java:142)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:139)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:443)

        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:6
43)
        at java.lang.Thread.run(Thread.java:484)


For jndiContext.lookup("CabinBean"), this happens:

javax.naming.NameNotFoundException: CabinBean not bound

...which is what I expected.


Finally, I try jndiContext.lookup("ejb/CabinBean") and get this:

javax.naming.NameNotFoundException: ejb not bound


Has anyone out there gotten this to work?  Anyone have any ideas?

TIA,

David



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

Reply via email to