Re: Re: ClassCastException while use jpa annotation in resin-pro-3.0.19
"zhu" <[email protected]> Thu, 25 May 2006 19:01:59 +0800
| Newsgroups | gmane.text.xml.resin.user |
|---|---|
| Message-ID | <[email protected]> |
Scott Ferguson, thanks for your reply
my webapp was use javax.persistence, so cause that problem,
i have got the reason by decompile the resin's javax.persistence.Persistence.class, my
implementation was fine, but resin's just throw a Exception directly in the function i
just used(createEntityManagerFactory), and i can't drop that package in resin's ejb30.jar
,so i can not use my own jar, how to resolve this problem
many jar package load resource file doesn't through CurrentThread.ContextClassLoader,
so if resin and my webapp use the same .jar package in that case, it can not load correct
resource file, or even throw ClassCastException, so i don't want to use 'stateful' global
jar package.(even the global class uses ContextClassLoader, i don't know how/when it can
restart/shutdown my context object separately)
thanks in advance
>
>
>On May 24, 2006, at 9:30 AM, zhu wrote:
>
>>
>> the app was works in 3.0.18, but failed in 3.0.19,
>> because of the javax.persistence package in {resin-home}/lib/ejb30.jar
>
>3.0.19 changed javax.ejb to javax.persistence. So you would need to
>make some changes.
>
>>
>> i get a ClassCastException while obtain EntityManagerFactory from
>> javax.persistence.Persistence.createEntityManagerFactory(...), it was
>> because difference ClassLoader cause that exception
>>
>> what's the sequence of Class Resolve in a webapp, i think it should be
>> jdk-rt -> WEB-INF/classes -> WEB-INF/lib -> ResinServerLibs
>
>{jdk, $RESIN_HOME/lib} -> {WEB-INF/classes, WEB-INF/lib}
>
>In other words, the global classpath has priority, and only if the
>class is missing will Resin look in WEB-INF.
>
>
>> uppon the ClassCastException, i think resin-pro's sequence was
>> jdk-rt -> WEB-INF/classes -> ResinServerLibs -> WEB-INF/lib
>>
>> how can i resolve this problem, or report a bug?
>
>bugs reports are at bugs.caucho.com. It would help if you can
>provide a larger section of the failing code, too.
>
>-- Scott
>
-- vispper