aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Stateful Bean Naming Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Stateful Bean Naming Exception" Watch "Stateful Bean Naming Exception" New topic
Author

Stateful Bean Naming Exception

Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
Hi folks,
I could use some help here, please. I'm a relative newbie to EJB and to JBoss.

I have a bean (named TransactionPersistenceContextBean) which looks, in part, like this


There is nothing interesting about TransactionPersistenceContextRemote.

When my client attempts to bind using


I get a
javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowableException]

If I then go into TransactionPersistenceContextBean and change the annotation from @Stateful to @Stateless, it will run fine.

For those of you who haven't guessed, this is an exercise from the O'Reilly EJB 3.0, fifth edition book (i.e. exercise 5.1, using Client2). The code is straight from the download, with no modifications of any kind, and I have been able to run all previous exercises so I'm reasonably confident the environment is set up correctly.

I'm running JBoss 5.0 Beta 2 on a Windows XP machine.

PS - I am not a student taking a class. In other words, I'm not asking anyone to do my homework for me. I'm a developer trying to learn EJBs and web services because I plan on doing some significant development in that area. I'm also a one-person development group, so I don't have co-workers to ask. I actually e-mailed the O'Reilly people about this but have had no answers from them.

Any help would be really appreciated. Thanks in advance.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

Can you post the entire exception stacktrace? Also, please post the contents of the JNDI tree. You can do this by following the steps below:

- Go to http://localhost:8080/jmx-console
- Search for service=JNDIView
- Click on that link
- On the page that comes up click on the Invoke button beside the list() method
- The page that comes up will show the contents of the JNDI tree. Post that here.

That will help us figure out whether the bean has been bound to the JNDI tree.


[My Blog] [JavaRanch Journal]
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
Hi,
I clicked on the link, but all I got was a blank (white) page.

I will attempt to get the stack trace out as soon as I can. I can say for sure that the line causing the exception is

but I'll get it posted here anyway.

Thanks for the reply.
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
Excuse what I said about the blank page. I should have realized I had to actually have the thing running to use that.

I guess I should have engaged my brain prior to using the keyboard.
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
Here's the output from the list method. Not sure how much you wanted, so I'm posting it all...


Web Applications
java:comp namespace of the jmx-console.war application:
+- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
+- ORB (class: org.jacorb.orb.ORB)
+- env (class: org.jnp.interfaces.NamingContext)
| +- security (class: org.jnp.interfaces.NamingContext)
| | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
| | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)

java:comp namespace of the http-invoker.sar/invoker.war application:
+- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
+- ORB (class: org.jacorb.orb.ORB)
+- env (class: org.jnp.interfaces.NamingContext)
| +- security (class: org.jnp.interfaces.NamingContext)
| | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
| | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)

java:comp namespace of the console-mgr.sar/web-console.war application:
+- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
+- ORB (class: org.jacorb.orb.ORB)
+- env (class: org.jnp.interfaces.NamingContext)
| +- security (class: org.jnp.interfaces.NamingContext)
| | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
| | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)

java:comp namespace of the jbossmq-httpil.sar/jbossmq-httpil.war application:
+- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
+- ORB (class: org.jacorb.orb.ORB)
+- env (class: org.jnp.interfaces.NamingContext)
| +- security (class: org.jnp.interfaces.NamingContext)
| | +- realmMapping[link -> java:/jaas/jbossmq] (class: javax.naming.LinkRef)
| | +- subject[link -> java:/jaas/jbossmq/subject] (class: javax.naming.LinkRef)
| | +- securityMgr[link -> java:/jaas/jbossmq] (class: javax.naming.LinkRef)
| | +- security-domain[link -> java:/jaas/jbossmq] (class: javax.naming.LinkRef)

java:comp namespace of the jbossweb-tomcat55.sar/ROOT.war application:
+- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
+- ORB (class: org.jacorb.orb.ORB)
+- env (class: org.jnp.interfaces.NamingContext)
| +- security (class: org.jnp.interfaces.NamingContext)
| | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
| | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)

java:comp namespace of the jbossws.sar/jbossws-context.war application:
+- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
+- ORB (class: org.jacorb.orb.ORB)
+- env (class: org.jnp.interfaces.NamingContext)
| +- security (class: org.jnp.interfaces.NamingContext)
| | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
| | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
| | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)

java: Namespace
+- jaas (class: javax.naming.Context)
| +- other (class: org.jboss.security.plugins.SecurityDomainContext)
| +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
| +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
| +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
+- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
+- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
+- comp.ejb3 (class: javax.naming.Context)
| NonContext: null
+- JBossCorbaNaming (class: org.omg.CosNaming.NamingContextExt)
+- DefaultDS (class: javax.sql.DataSource)
+- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
+- TransactionManager (class: org.jboss.tm.TxManager)
+- JBossCorbaPOA (class: org.omg.PortableServer.POA)
+- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
+- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
+- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
+- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
+- JBossCorbaInterfaceRepositoryPOA (class: org.omg.PortableServer.POA)
+- Mail (class: javax.mail.Session)
+- JBossCorbaORB (class: org.omg.CORBA.ORB)
+- timedCacheFactory (class: javax.naming.Context)
Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy cannot be cast to javax.naming.NamingEnumeration
+- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
+- comp (class: javax.naming.Context)

Global JNDI Namespace
+- HASessionState (class: org.jnp.interfaces.NamingContext)
| +- Default (class: org.jboss.ha.hasessionstate.server.HASessionStateImpl)
+- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
+- jmx (class: org.jnp.interfaces.NamingContext)
| +- invoker (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor (proxy: $Proxy52 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
| +- rmi (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
+- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
+- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
+- UserTransactionSessionFactory (proxy: $Proxy12 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
+- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
+- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
+- invokers (class: org.jnp.interfaces.NamingContext)
| +- Ken (class: org.jnp.interfaces.NamingContext)
| | +- iiop (class: org.jboss.invocation.iiop.IIOPInvoker)
+- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
+- ExtendedPersistenceContextBean (class: org.jnp.interfaces.NamingContext)
| +- remote (class: java.lang.Object)
| +- remoteStatefulProxyFactory (proxy: $Proxy85 implements interface org.jboss.ejb3.ProxyFactory)
+- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
+- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
+- HAPartition (class: org.jnp.interfaces.NamingContext)
| +- DefaultPartition (class: org.jboss.ha.framework.server.HAPartitionImpl)
+- queue (class: org.jnp.interfaces.NamingContext)
| +- A (class: org.jboss.mq.SpyQueue)
| +- testQueue (class: org.jboss.mq.SpyQueue)
| +- ex (class: org.jboss.mq.SpyQueue)
| +- DLQ (class: org.jboss.mq.SpyQueue)
| +- D (class: org.jboss.mq.SpyQueue)
| +- C (class: org.jboss.mq.SpyQueue)
| +- B (class: org.jboss.mq.SpyQueue)
+- topic (class: org.jnp.interfaces.NamingContext)
| +- testDurableTopic (class: org.jboss.mq.SpyTopic)
| +- testTopic (class: org.jboss.mq.SpyTopic)
| +- securedTopic (class: org.jboss.mq.SpyTopic)
+- console (class: org.jnp.interfaces.NamingContext)
| +- PluginManager (proxy: $Proxy53 implements interface org.jboss.console.manager.PluginManagerMBean)
+- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
+- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
+- TravelAgentBean (class: org.jnp.interfaces.NamingContext)
| +- remote (proxy: $Proxy90 implements interface com.titan.travelagent.TravelAgentRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
+- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
+- TransactionPersistenceContextBean (class: org.jnp.interfaces.NamingContext)
| +- remote (class: java.lang.Object)
| +- remoteStatefulProxyFactory (proxy: $Proxy85 implements interface org.jboss.ejb3.ProxyFactory)
+- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
+- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)

HA-JNDI Namespace
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

@Stateful
public class TransactionPersistenceContextBean implements TransactionPersistenceContextRemote


A stateful bean must implement the java.io.Serializable interface. Change the bean to


See if that helps.
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
Sorry to take so long to get back to you.

Tried implementing Serializable, but got the same error. Here's the stack trace

javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowableException]
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1150)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.titan.clients.Client_2.main(Client_2.java:33)
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy1.createProxy(Unknown Source)
at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:52)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
... 4 more
Caused by: java.lang.ClassNotFoundException: [Lorg.jboss.aop.advice.Interceptor;
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:50)
at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:139)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1624)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
at org.jboss.remoting.Client.invoke(Client.java:525)
at org.jboss.remoting.Client.invoke(Client.java:488)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:48)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
... 9 more


Thanks for your help so far.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

Caused by: java.lang.ClassNotFoundException: [Lorg.jboss.aop.advice.Interceptor;


Looks like this JBoss related class is not found in the classpath. Is the jar file containing this class file present in the classpath? Also, which JDK version are you using?
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
It looks like the class is a member of a JBoss jar, and the JBoss directory is part of the classpath built in my build.xml file.

However, I am running SDK 1.6. Your question prompted me to search for something on the JBoss site and I came across this...

apparently there is an incompatibility between JBoss and SDK 1.6. This poster had the same problem and fixed it by running 1.5 instead. I guess I'll give that a shot, unless you have a different idea.
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
Sorry about the format of that link...let's try this instead

JBoss.org forum
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

That's right. There have been some issues with JDK6 on JBoss and that was the whole point in asking the JDK version Try it out with Java5 and let us know how it goes.
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
Holy mackeral, Jaikiran, you did it! I can't thank you enough. I've spent a couple of weeks now searching through forums, googling, messing with the code...nothing. I posted questions on the JBoss forum...nothing. E-mailed the book's author at O'Reilly...nothing.

Come here and Jaikiran has it diagnosed in no time.

Thank you very much. This has been an enormously frustrating issue for me.
Now maybe I can get back to trying to learn EJBs and web services rather than fighting with the environment.

Thanks again.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

Glad to know its working. Good luck to you in learning EJBs
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
Interesting little side note. After switching to JDK 1.5 and getting it to work, I switched back to 1.6 temporarily (just for fun), expecting it to throw out the NamingException again. Instead, it still worked...ran fine.

I'm not complaining, per se, but it is interesting.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

How are you switching the JDKs? I mean are you just changing the JAVA_HOME when starting JBoss? Or are you even using this JDK for compiling your bean classes? When you switched back to Java 6, were your bean classes compiled with Java 5 or Java 6?
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
I just changed the JAVA_HOME, which I have set as an environment variable in Windows. I thought that, since the Ant build script handles compiling, it would use the JAVA_HOME parameter to determine how to do so. Is that not correct?

When I changed from 1.6 to 1.5 I actually removed 1.6 (well, renamed the directories, anyway), and changed the PATH variable as well as changing JAVA_HOME.

So, I guess the question is what exactly I have to do to switch from one version to the next. Is changing JAVA_HOME enough, or is there more?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

Originally posted by Ken Sloan:
I just changed the JAVA_HOME, which I have set as an environment variable in Windows. I thought that, since the Ant build script handles compiling, it would use the JAVA_HOME parameter to determine how to do so. Is that not correct?

When I changed from 1.6 to 1.5 I actually removed 1.6 (well, renamed the directories, anyway), and changed the PATH variable as well as changing JAVA_HOME.

So, I guess the question is what exactly I have to do to switch from one version to the next. Is changing JAVA_HOME enough, or is there more?


You are doing the right thing. Changing the JAVA_HOME should be fine. I was just trying to figure out whether after changing JAVA_HOME to point to Java 6, did you *recompile* your classes or were they the old classes which you might have compiled from Java5. Going by your post it appears that you did recompile them using Java6.

Now its interesting as to how the application started working with Java6. Can you post the JBoss logs that you see on JBoss startup? That might show up some useful information.
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
I'll have to get back to you a little later.

First, at some point in the switching back and forth between 1.6 and 1.5, my JBoss installation stopped working and I had to re-install. I had a few problems with that (mostly just due to careless errors on my part), but when I finally got it up and working again, I started getting "bad version number" errors when compiling the Java code.

I'm also having a number of problems in an unrelated part of my job that's taking time away from my working on this today (and yesterday).

I will get back on it, hopefully this afternoon and post what I find.

Thanks for all your help on this. It's been very helpful to get some feedback from someone more knowledgable and experienced in this area.
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
Well, this is getting annoying...

When I execute my Ant build.xml script and compile using jdk 1.5.0_12 the compile appears to execute fine, but my JBoss session spits out an error message that says "bad version number in .class file" for one (only one) of the Beans.

When I do it under jdk 1.6.0 it compiles fine with no JBoss errors (but then, of course I have the original compatibility problem).

Typically a bad version number results from compiling under a newer version of Java but executing under an older one. But since JAVA_HOME controls both (at least that's my understanding), this shouldn't be possible, should it?

I did verify that there are no other versions of the .class file floating around that I wasn't aware of.

Any ideas?
[ July 09, 2007: Message edited by: Ken Sloan ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

Originally posted by Ken Sloan:

When I execute my Ant build.xml script and compile using jdk 1.5.0_12 the compile appears to execute fine, but my JBoss session spits out an error message that says "bad version number in .class file" for one (only one) of the Beans.



Can you post the exception stacktrace where it shows the bad version number error? That will tell us which version of java was used to compile and which version is JBoss using. Also, can you post the logs from the JBoss server when JBoss is starting up?

Do you have the part of ant script where the compilation of classes is being done?
Sava Mikalacki
Greenhorn

Joined: Jul 09, 2007
Posts: 3
Hello

I'm having the same problem Ken had, with original compatibility:

Exception in thread "main" javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowableException]
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1150)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at client.EJBClient.main(EJBClient.java:43)
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy0.createProxy(Unknown Source)
at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:52)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
... 4 more
Caused by: java.lang.ClassNotFoundException: [Lorg.jboss.aop.advice.Interceptor;
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:50)
at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:139)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1624)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
at org.jboss.remoting.Client.invoke(Client.java:525)
at org.jboss.remoting.Client.invoke(Client.java:488)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:48)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
at $Proxy0.createProxy(Unknown Source)
at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:52)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at client.EJBClient.main(EJBClient.java:43)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:73)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:48)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
... 9 more

I have looked at jmx console at it looks like this:

+- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
+- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
+- UserTransactionSessionFactory (proxy: $Proxy46 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
+- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
+- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
+- console (class: org.jnp.interfaces.NamingContext)
| +- PluginManager (proxy: $Proxy40 implements interface org.jboss.console.manager.PluginManagerMBean)
+- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
+- topic (class: org.jnp.interfaces.NamingContext)
| +- testDurableTopic (class: org.jboss.mq.SpyTopic)
| +- testTopic (class: org.jboss.mq.SpyTopic)
| +- securedTopic (class: org.jboss.mq.SpyTopic)
+- queue (class: org.jnp.interfaces.NamingContext)
| +- A (class: org.jboss.mq.SpyQueue)
| +- testQueue (class: org.jboss.mq.SpyQueue)
| +- ex (class: org.jboss.mq.SpyQueue)
| +- DLQ (class: org.jboss.mq.SpyQueue)
| +- D (class: org.jboss.mq.SpyQueue)
| +- C (class: org.jboss.mq.SpyQueue)
| +- B (class: org.jboss.mq.SpyQueue)
+- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
+- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
+- DbOps (class: org.jnp.interfaces.NamingContext)
+- sava (class: org.jnp.interfaces.NamingContext)
| +- DbOps (class: org.jnp.interfaces.NamingContext)
| | +- remote (class: java.lang.Object)
| | +- remoteStatefulProxyFactory (proxy: $Proxy83 implements interface org.jboss.ejb3.ProxyFactory)
+- jmx (class: org.jnp.interfaces.NamingContext)
| +- invoker (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor (proxy: $Proxy39 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
| +- rmi (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
+- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
+- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)

My stateful bean is under sava/DbOps, so is the remote interface.
I have tryed to switch from jdk 6 to jdk 5, but I still get the same exception.
Ken, do you use ejb-jar.xml or jboss.xml? I'm developing this app with EJB 3 Annotations. When I switch my bean to Stateless it works fine.

Thnx 4 answer in advance, sorry for bad English
Sava Mikalacki
Greenhorn

Joined: Jul 09, 2007
Posts: 3
It's me again. It worked, I forgot to change the jdk that clien app is running. When I switch everything to jdk 5 (that means, JBoss and my client app) everything works. But, i'm curious why is it not working with jdk 6. I have found some posts on the Internet where several programmers had the same compatibility issue. They said that JDK 6 has to be patched for that to work, but when Update 1 for JDK 6 came out, the problem still persisted. Ken, did you succeded with transfering everything to jdk 6?

Sory for that big post
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

They said that JDK 6 has to be patched for that to work, but when Update 1 for JDK 6 came out, the problem still persisted


Its not a problem with the JDK, its actually an issue with the way JBoss uses classloaders. More details here
Sava Mikalacki
Greenhorn

Joined: Jul 09, 2007
Posts: 3
Thanks for replying Jaikiran.

I've red the posts on the forum you pointed to and it's like you sead: it is a problem with JBoss. Do you know is there any solution for this? Is teher any way I could fix the way JBoss uses ClassLoader?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

See this. JBoss is an open source and if you have any patch, feel free to submit the patches at JBoss Issue Tracking
Ken Sloan
Greenhorn

Joined: Mar 09, 2007
Posts: 14
I have a feeling I'm about to embarass myself, but here goes...

It turns out that the bad version number error (which, by the way was coming from JBoss, not from javac) only happens if I do not shut down the command line window from which I execute the ant commands when switching from one Java version to the other.

For instance, if I start JBoss with JAVA_HOME set to jdk 1.6, then open a command line window and type in 'ant' (to execute my build script) then run the client, I get the original compatibility problem. I then clean up my deployed jar file and shut down JBoss. I change JAVA_HOME to jdk 1.5 and re-start JBoss. Type in 'ant' in the command line window I previously had opened and JBoss gives me the bad version number error (however, in the DOS command line window where I ran the build script, it appears to compile fine).

If I repeat the process above, but shut down the command line window in between switching from jdk 1.6 to jdk 1.5, everything behaves as expected (i.e. I still get the compatibility problem with 1.6, but 1.5 runs fine).

I have a feeling that everyone but me knows that of course you have to re-start command line window. Is this something I slept through that first day of computer science class?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

I have a feeling that everyone but me knows that of course you have to re-start command line window. Is this something I slept through that first day of computer science class?


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stateful Bean Naming Exception