Issue Details (XML | Word | Printable)

Key: CORE-2771
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: DataNucleus Admin
Reporter: Emmanuel Venisse
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JPOX Core (ARCHIVED)

Classloader problem in JDOClassLoaderResolver

Created: 30/Mar/06 02:00 PM   Updated: 19/Feb/10 07:24 PM   Resolved: 19/Feb/10 07:24 PM
Component/s: JDO
Affects Version/s: 1.1.0-rc-1
Fix Version/s: None

File Attachments: 1. Text File JDOClassLoaderResolver.patch (1 kB)



 Description  « Hide
In some case, JDOClassLoaderResolver can't find classes like javax.jdo.identity.IntIdentity in classpath.

Sort Order: Ascending order - Click to sort in descending order
Emmanuel Venisse added a comment - 30/Mar/06 02:01 PM
patch for this issue.

Emmanuel Venisse added a comment - 30/Mar/06 02:02 PM
Is it possible to add this patch in rc2?

Andy Jefferson added a comment - 30/Mar/06 03:14 PM
What about providing a testcase so this is demonstratable the situation that it occurs ?
JDO2 specification provides clear definitions of what a JDO implementation should class resolve.

Emmanuel Venisse added a comment - 30/Mar/06 07:40 PM
I don't know if i can do a simple testcase. It appears in our application (Apache Continuum). Let me explain what's happen:

We have a central class that use jpox for database access. This class is loaded only one time by our IOC container and accessed by web interface and by xml-rpc.
All works fine for access by web interface but not for access by xml-rpc.
Our IOC container use an UrlClassLoader and in xmlrpc class i can access to javax.jdo.identity.IntIdentity but not in central class.

The two parts have the same loader and use the same libraries.

I have this problem since we have migrated to jpox rc-1, it worked fine with beta-4

I hope my explanations are clear.

Andy Jefferson added a comment - 30/Mar/06 07:54 PM
No. Not clear at all. If all is in the same ClassLoader then there is no issue and all will be loaded fine. You dont state in what ClassLoader are jdo.jar, jpox.jar. Without a reproduceable testcase nothing can be done. The PMF allows you to define a ClassLoader to use if you have things elsewhere.

What happened in beta-4 is irrelevant since that was not JDO2 compliant. rc-1 is JDO2 compliant.

Emmanuel Venisse added a comment - 30/Mar/06 08:05 PM
How can i define a classloader in PMF?

Emmanuel Venisse added a comment - 30/Mar/06 08:15 PM
do you mean by running : Thread.currentThread().setContextClassLoader( myClassLoader); ?

Andy Jefferson added a comment - 31/Mar/06 04:43 AM
How about reading the javadoc for JDO ?
I can see lots of methods for specifying the ClassLoader when creating your PMF ... for example
JDOHelper.getPersistenceManagerFactory(propsFile, loader);

Erik Bengtson added a comment - 31/Mar/06 08:45 AM
post at least stacktrace and describe your classloaders like the below template

"
boot clr -> system clr -> blabla 1 clr (jdo.jar - jpox.jar) -> blabla 1.1 clr
                                                                                                -> blabla 1.2 clr (persistent classes)
                                       -> blabla 2 clr

running thread is in blabla 2 clr.

method invoked is pm.makePersistent(class.class)
"

Emmanuel Venisse added a comment - 04/Apr/06 04:12 PM
I tried JDOHelper.getPersistenceManagerFactory(props, loader) but I get the same exception :

jvm 1 | org.apache.maven.continuum.ContinuumException: Error retrieving the requested project
jvm 1 | at org.apache.maven.continuum.DefaultContinuum.getProjectWithAllDetails(DefaultContinuum.java:2168)
jvm 1 | at org.apache.maven.continuum.xmlrpc.DefaultContinuumXmlRpc.getProject(DefaultContinuumXmlRpc.java:81)
jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
jvm 1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
jvm 1 | at java.lang.reflect.Method.invoke(Method.java:585)
jvm 1 | at org.apache.xmlrpc.Invoker.execute(Unknown Source)
jvm 1 | at org.apache.xmlrpc.XmlRpcWorker.invokeHandler(Unknown Source)
jvm 1 | at org.apache.xmlrpc.XmlRpcWorker.execute(Unknown Source)
jvm 1 | at org.apache.xmlrpc.XmlRpcServer.execute(Unknown Source)
jvm 1 | at org.apache.xmlrpc.XmlRpcServer.execute(Unknown Source)
jvm 1 | at org.apache.xmlrpc.WebServer$Connection.run(Unknown Source)
jvm 1 | at org.apache.xmlrpc.WebServer$Runner.run(Unknown Source)
jvm 1 | at java.lang.Thread.run(Thread.java:595)
jvm 1 | Caused by: org.apache.maven.continuum.store.ContinuumStoreException: Error handling JDO
jvm 1 | at org.apache.maven.continuum.store.JdoContinuumStore.getObjectById(JdoContinuumStore.java:578)
jvm 1 | at org.apache.maven.continuum.store.JdoContinuumStore.getProjectWithAllDetails(JdoContinuumStore.java:94
8)
jvm 1 | at org.apache.maven.continuum.DefaultContinuum.getProjectWithAllDetails(DefaultContinuum.java:2160)
jvm 1 | ... 13 more
jvm 1 | Caused by: org.codehaus.plexus.jdo.PlexusStoreException: Error handling JDO
jvm 1 | at org.codehaus.plexus.jdo.PlexusJdoUtils.getObjectById(PlexusJdoUtils.java:147)
jvm 1 | at org.apache.maven.continuum.store.JdoContinuumStore.getObjectById(JdoContinuumStore.java:570)
jvm 1 | ... 15 more
jvm 1 | Caused by: org.jpox.exceptions.ClassNotResolvedException: Class javax.jdo.identity.IntIdentity was not found
in the CLASSPATH. Please check your specification and your CLASSPATH.
jvm 1 | at org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:169)
jvm 1 | at org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:317)
jvm 1 | at org.jpox.AbstractPersistenceManager.newObjectIdInstance(AbstractPersistenceManager.java:2351)
jvm 1 | at org.codehaus.plexus.jdo.PlexusJdoUtils.getObjectById(PlexusJdoUtils.java:131)
jvm 1 | ... 16 more

If i apply my patch, all is ok.


Andy Jefferson added a comment - 05/Apr/06 05:02 PM
So we refer you back to what we asked for the first time. Provide a testcase that puts things into what ClassLoader's you are using, so then people have a chance of reproducing your situation.

All patches are irrelevent until they demonstrate some issue relative to the JDO2 spec. You havent run your patch against the JPOX unit tests, or the JDO2 TCK and they are our baseline for functionality

Andy Jefferson added a comment - 04/May/06 02:29 PM
I'm closing this since we have no definition of your class loading arrangement. When you can provide this information to satisfactorily demonstrate where the issue is then please raise a new issue and it will be investigated.

Andy Jefferson added a comment - 23/Jun/06 05:29 AM
JPOX 1.1.1 provides the ability to specify your own ClassLoaderResolver "org.jpox.classLoaderResolverName" so you can provide your own class loading definition and do what you like