Hi,
I am still a novice with Java EE, so this is probably my fault, but I
keep having this annoying problem and I cannot find any reference to it
in the FAQ or in the mailing list.
Basically, I am trying to develop a small application (persistence
entities->Enterprise bean->web app). I am at the point where the
persistence entities are (almost) complete, and I am implementing the
ejb with the business logic.
My problem is: almost everytime I redeploy the updated ejb to Glassfish
(58b) , when I try to connect to it I get in the glassfish log things like
[#|2007-09-06T12:03:49.364+0100|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=17;_ThreadName=p:
thread-pool-1; w:
16;_RequestID=399e0846-99c0-499c-a813-72774d30cc2b;|java.lang.ClassCastException:
*com.mycompany.ejb.User* cannot be cast to *com.mycompany.ejb.User*
Please note this is a problem casting the class to itself, and it
happens even if the *com.mycompany.ejb.User* class has NOT changed (but
it is redeployed with the ejb).
To solve the problem I have to restart glassfish, but obviously this
takes a lot of time (at least one minute between the redeployement,
bringing down GF, bringing it up again and wait for toplink initialisation).
My guess is that the "old" class stays loaded even when the out-of-date
ejb is automatically undeployed during the redeployment, and then the
JVM detects the class has changed (at least as file timestamp) .
My questions are: am I doing something wrong?
Is there a trick to avoid this (like adding a serialVersionUID)?
Thank you a lot for any clue.
Piero