-
1. Re: JNDI lookup returns $Proxy object
javidjamae Apr 24, 2006 8:51 PM (in response to peafunk)Stupid question, but have you tried casting it to a DataSource? If you are getting a ClassCastException when you try to do a JNDI lookup, it is usually a classpath issue. Try including all of the JARs from the client directory in your classpath and remove any J2EE jars that weren't distributed with the version of JBoss that you're using.
-
2. Re: JNDI lookup returns $Proxy object
peafunk Apr 25, 2006 3:44 PM (in response to peafunk)Thanks for getting back to me. I finally figured this out, it was what you mentioned. I had to remove all other J2EE jar files and include jboss-j2ee.jar in the classpath. The problem was I had two different versions of javax.sql.DataSource in the classpath.
Thanks for the help! -
3. Re: JNDI lookup returns $Proxy object
javidjamae Apr 26, 2006 11:46 PM (in response to peafunk)Another cause that I've seen is when you try to cast the return value of the JNDI lookup on an EJB to the bean type rather than the interface type.
//This works GreeterRemote myGreeter = (GreeterRemote) ctx.lookup("GreeterBean/remote"); // This doesn't work (throws "ClassCastException: $Proxy0") GreeterBean myGreeter = (GreeterBean) ctx.lookup("GreeterBean/remote");
Of course, you shouldn't be doing the second one, because the client should only be dealing with the remote interface.