-
1. Re: ClassCastException on JNDI context.Lookup();
jaikiran Jun 27, 2008 12:29 PM (in response to skandros)thru debugging I foud that the Object that context.lookup() returns is an instance of class Proxy.
Is this normal?
Yes, its normal. The proxy will implement the appropriate bean interface. Follow the steps mentioned at http://wiki.jboss.org/wiki/DisplayTheJNDITreeWithTheJMXConsole and see what object is bound to ParticularManagerBean/local jndi-name. If you are not able to understand the output from the JNDIView, post that output here (remember to wrap it in a code block while posting). -
2. Re: ClassCastException on JNDI context.Lookup();
jaikiran Jun 27, 2008 12:31 PM (in response to skandros)Just re-read your post:
IParticularManagerBeanLocal toto = null;
try {
context = new InitialContext();
this.particularManagementService = (IParticularManagerBeanLocal)context.lookup("ParticularManagerBean/local");
What's the type for this.particularManagementService? Shouldn't that be:IParticularManagerBeanLocal toto = null; try { context = new InitialContext(); toto = (IParticularManagerBeanLocal)context.lookup("ParticularManagerBean/local");
-
3. Re: ClassCastException on JNDI context.Lookup();
dlarosa11 Jul 3, 2008 4:14 AM (in response to skandros)I am having the same problem. I've seen this discussion all over the place dating back to 2002. My understanding is that there is no bug in jboss, it's just the way it is. However, I'd love to see a discussion of a workaround. The only one I've seen is to bundle everything in the same ear.
In our situation, this is not possible. We have a server app which exposes our bean, and we want our customers to be able to create their own clients of it. There is no way we are going to get their apps in our ear.
We need to be able to hot deploy our application and not have all the clients get a subsequent ClassCastException when doing a jndi lookup of our bean.
Is the solution to redeploy all the clients after the server app with our bean is redeployed?
I obviously can catch the exception, but I'm wondering what do I do about it once it's caught. Is there any way I can recover in my client app once I get this CastClassException when doing the jndi lookup? Can I force a reload of something so that I don't have to restart the client?
Here's the diff of the JNDIView output of the relevant bean in our situation. Proxy90 is before the hot deploy of our server app and bean. Proxy145 is from after.
Thanks for any and all help.< | +- local (proxy: $Proxy90 implements interface com.perimeter.anyswitch.IAnySwitchLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject) --- > | +- local (proxy: $Proxy145 implements interface com.perimeter.anyswitch.IAnySwitchLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
-
4. Re: ClassCastException on JNDI context.Lookup();
colintongzw Jul 15, 2008 11:05 PM (in response to skandros)notice the classloader,JBoss has changed to the Servlet spec classloading model, i.e. it uses the Tomcat classloader, you can make a try to use its classloader ,not tomcat's