Thank you Sahoo,
I am pretty sure #3235 is exactly the problem I am having - I am
creating a Persistence.creatEntityManagerfactory() but I never close it.
My fault - I copied a piece of code from an example, it worked, so I
never read the documentation assuming it was GC, this never created any
problem, because I tested the persistance classes directly using the
toplink jars (without going through GlassFish) so a new JVM was created
for each run, hiding the problem.
I will do some testing and post the results, thank you A LOT for your
answer.
Piero
PS: I am trying to convince my boss that JEE is the way to implement a
LARGE project we are about to start, I started implementing a smaller
project to assess the suitability, but obviously I am a n00b and I still
find this technology really hard to digest - to many things to learn at
once, and a 1300 pages tutorial does not help!
Sahoo wrote:
> Is yours similar to symptoms discussed in issue #3235 [1]. Are you
> using Persistence.creatEntityManagerfactory() in your code? If so,
> when do you close the EMF? Can you switch to using container managed
> entity manager (i.e. @PersistenceContext EntityManager em)?
>
> Thanks,
> Sahoo
>
> [1] https://glassfish.dev.java.net/issues/show_bug.cgi?id=3235
>
> Piero Filippin wrote:
>> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>