Issue Details (XML | Word | Printable)

Key: NUCJDOJCA-11
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Kiran Kumar
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus JDO JCA

Classloding in Jboss7

Created: 09/Aug/11 01:25 PM   Updated: 19/May/12 04:22 PM   Resolved: 14/Aug/11 01:25 PM
Component/s: None
Affects Version/s: 3.0.0.release
Fix Version/s: 3.0.1

File Attachments: 1. XML File jdopersistence.xml (1 kB)
2. Java Source File ManagedConnectionFactoryImpl.java (10 kB)
3. XML File ra.xml (2 kB)
4. XML File resource-adapter-subsystem.xml (0.8 kB)

Environment: Jboss7, Jboss AS7

Forum Thread URL: http://www.jpox.org/servlet/forum/viewthread_thread,6798
Severity: Development


 Description  « Hide
When deploying datanucleus in jboss AS7 the JDOClassLoaderResolver properly loads the primitive datatypes but fails to load other datatypes resulting in a

Class "java.lang.Boolean" was not found in the CLASSPATH [Class resolver called from org.datanucleus.store.types.TypeManager.loadJavaTypes (line=607)

When jboss deploys the datanucleus adapter it does not provide Thread.currentThread().getContextClassLoader() is null.

The classloader used at the time of deployment needs to be same as the one subsequently used.


Kiran Kumar added a comment - 09/Aug/11 01:27 PM
To solve this issue we need to add a property to ManagedConnectionFactoryImpl which can be used to set the datanucleus.primaryClassLoader.

public synchronized void setPrimaryClassLoader(String name)
    {
        ClassLoader thisClazzLoader = this.getClass().getClassLoader();
        ClassLoader primaryClassLoader = null;

        try
        {
            primaryClassLoader = thisClazzLoader.loadClass(name).getClassLoader();
        }
        catch (Exception e)
        {
            // ignore this error
            if (PersistenceManagerImpl.LOGGER.isInfoEnabled())
            {
                PersistenceManagerImpl.LOGGER.info("Exception while creating PrimaryClassLoader: ", e);
            }

        }
        properties.put("datanucleus.primaryClassLoader", primaryClassLoader);
    }

Kiran Kumar added a comment - 09/Aug/11 01:32 PM - edited
ManagedConnectionFactoryImpl.java has a new method setPrimaryClassLoader() . The usage is defined in the ra.xml.

Sample configuration used in jboss standalone.xml is in resource-adapter-subsystem.xml

Sample persistence configuration is in jdopersistence.xml

Kiran Kumar made changes - 09/Aug/11 01:32 PM
Field Original Value New Value
Attachment ManagedConnectionFactoryImpl.java [ 11483 ]
Attachment ra.xml [ 11484 ]
Attachment resource-adapter-subsystem.xml [ 11485 ]
Kiran Kumar made changes - 09/Aug/11 01:32 PM
Attachment jdopersistence.xml [ 11486 ]
Kiran Kumar made changes - 09/Aug/11 01:34 PM
Comment [ Sample persistence configuration ]
Andy Jefferson added a comment - 14/Aug/11 01:25 PM
SVN trunk has this method now. thx

Andy Jefferson made changes - 14/Aug/11 01:25 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.1 [ 11311 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 19/May/12 04:22 PM
Status Resolved [ 5 ] Closed [ 6 ]