-
1. Re: Redeployment Class Cast Exception
roger01 Nov 4, 2002 5:13 AM (in response to roger01)I found when the JDK was changed from 1.4.0, as above to 1.3.1_06 the problem disappeared. Surely this points to a bug in JBoss 3.0.2 or an incompatibility between it and JDK 1.4.0?
Can someone clarify please?
I would still appreciate some clarification about subclassing EJBs, particularly subclassing of home and local home interfaces. Is it permissible to subclass home and local home interfaces under the EJB 2.0 spec?
Thanks in anticipation
Roger -
2. Re: Redeployment Class Cast Exception
adrian.brock Nov 4, 2002 7:50 AM (in response to roger01)Yes, it is permissible.
Your CCE is probably due to one of two problems.
1) You are still referencing an old class after a
redeployment, e.g. you have separate wars and ejb jars
but you only redeploy the ejb. The war has an old
class reference.
2) You have a jndi.properties somewhere and are
using PortableRemoteObject.narrow for a "local"
invocation. The 1.4 version of PortableRemoteObject
caches class instances (breaking hot deployment).
This is only a problem with the jndi.properties causing
the request to go over rmi.
Regards,
Adrian -
3. Re: Redeployment Class Cast Exception
roger01 Nov 4, 2002 4:01 PM (in response to roger01)Thank you for your response Adrian.
Concerning the CCE:
With respect to 1) above, I do have one WAR that stores references to EJBs and there are two JARs in my application, but WAR and JARs are packaged in one EAR, so I presume that the scenario of 1) above cannot occur. Is that correct?
Point 2) above seems to fit the symptoms better. I have a jndi.properties file in the default/conf directory (and it is the default server that is being used), but it has only the default settings in it, I have not modified it at all. Also JBoss, the database, the application and the JVM are all on the same machine at present. And within the application there is one remote interface that is invoked using the PortableRemoteObject, which is where the CCE occurred. However, there is one point that I do not understand, and that is the CCE occurred even when the remote interface was replaced with a local one and the PortableRemoteObject not used. Does that make any sense to you?
Thanks and regards
Roger -
4. Re: Redeployment Class Cast Exception
adrian.brock Nov 5, 2002 7:02 AM (in response to roger01)No it does not.
The jndi.properties in default/conf does not use RMI
and so cannot hit the PortableRemoteObject.narrow cache.
Can you try it with 3.0.4?
I know from my own experience there was a bug in
Jetty for 3.0.2 relating to WEB-INF/lib (although
not this exact problem).
If you are redeploying a new class and
everything that references the class you should not
get CCE.
Regards,
Adrian -
5. Re: Redeployment Class Cast Exception
roger01 Nov 5, 2002 3:55 PM (in response to roger01)Thanks for your reply.
Previously I had downloaded 3.0.4, as that was to be the next thing I tried after JDK 1.3.1, but I have put off going down that route as I am under pressure to complete my application development. However if it were important for you to know the result, I could try and find the time to test my application with 3.0.4.
Regards
Roger -
6. Re: Redeployment Class Cast Exception
sandyp Nov 28, 2002 6:00 AM (in response to roger01)I am getting the same Class Cast Exception.
I am using JDK 1.4 and have tried various combinations of JBoss and Tomcat and still get the problem. I too am using the default settings of the server and not going over RMI.
I have tried JBoss 3.0.4 with JDK 1.4 and the problem is still there. -
7. Re: Redeployment Class Cast Exception
olszynski Nov 29, 2002 1:08 PM (in response to roger01)Same with me. I also get a class cast exception, when I try to "redeploy" during JBOSS is runnning. The first Time I call a method on my Session Bean I get a class cast exception.
I´ve got two jar files, one for my entity beans and one for my session beans.
My beans are working if I shutdown and then restart JBOSS.
I´m using J2SDK 1.4.1 and JBOSS 3.0.4 -
8. Re: Redeployment Class Cast Exception
adrian.brock Dec 4, 2002 12:24 PM (in response to roger01)Hi Guys,
I've committed a fix for this in 3.0.5RC1
available from CVS
Despite the name of the class there is no jboss
specific code.
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jboss-system/src/main/org/jboss/system/Attic/JBossRMIClassLoader.java?annotate=1.1.2.1
To use the class, put it in your JBOSS_CLASSPATH set by
run.sh/run.bat and add the following property
-Djava.rmi.server.RMIClassLoaderSpi=org.jboss.system.JBossRMIClassLoader
This does not solve the problem of classes from one jar
holding old references to a class from a redeployed jar.
Use a in jboss.xml to solve that problem.
Regards,
Adrian -
9. Re: Redeployment Class Cast Exception
sandyp Dec 6, 2002 6:36 AM (in response to roger01)I can't seem to get this file from CVS on SourceForge - Do I need to have some CVS client software running on my machine ?
Is there any way I can get hold of this file without using CVS ?
Thanks -
10. Re: Redeployment Class Cast Exception
sandyp Dec 9, 2002 6:24 AM (in response to roger01)I'm still struggling with this Class Cast Exception. I don't have a jndi.properties file in the jar file with my EJB's and am using the default jndi.properties file from default/conf which doesn't use RMI.
The fix that's available on SourceForge is presumably only for calls going over RMI which mine are not.
This class cast exception only occurs after a hot deployment. Stopping the server and restarting it makes the CCE go away.
Can anyone help ? -
11. Re: Redeployment Class Cast Exception
adrian.brock Dec 9, 2002 6:46 AM (in response to roger01)Oops,
This has been committed onto the main branch now
so it has moved out of the attic. Here is the
updated url.
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jboss-system/src/main/org/jboss/system/JBossRMIClassLoader.java?annotate=1.1.2.1
Regards,
Adrian -
12. Re: Redeployment Class Cast Exception
jcr Jan 8, 2004 4:14 PM (in response to roger01)I am currently having this same CCE when a servlet attempts to gain a remote connection back to a redployed session bean. I am running J2SDK 1.4.2 and JBoss 3.2.3.
The scenario is a single .EAR file with a .WAR and a .JAR contained. It is a servlet in my .WAR that is attempting to access a remote in the .JAR. The first connect works just fine, then I redeploy the entire .EAR and get the CCE when I call
PortableRemoteObject.narrow(session_bean, home_class);
The previous messages in this thread pretty much describe the same problem, but where posted a long while ago and about an older version of JBoss. Is there any update or new information regarding this problem?
thanks,
Jared