Issue Details (XML | Word | Printable)

Key: NUCJPA-77
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Erik Bengtson
Reporter: nicolas
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus API JPA

UnsupportedOperationException at java.util.Collections$UnmodifiableMap.put(Collections.java:1285)

Created: 10/Sep/10 04:45 PM   Updated: 20/Oct/10 09:30 AM   Resolved: 12/Sep/10 09:10 AM
Component/s: None
Affects Version/s: 2.1.0.release, 2.1.1
Fix Version/s: 2.1.2

Environment: Windows/Linux Suse on top of Glassfish 2.1 or 3.1.

Forum Thread URL: http://www.datanucleus.org/servlet/forum/viewthread_thread,6283_offset,0
Datastore: MySQL
Severity: Development


 Description  « Hide
I have been trying to run datanucleus on top of glassfish 2.1 as a JPA persistence provider. It seems I am running into a map problem when datanucleus is handling the properties.

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="keyservice" transaction-type="JTA">
<provider>org.jpox.jpa.PersistenceProviderImpl</provider>
<jta-data-source>jdbc/prototype</jta-data-source>
<class>com.ericsson.edible.fasttrack.object.LargeKeyedObject</class>
<class>com.ericsson.edible.fasttrack.object.SmallKeyedObject</class>
</persistence-unit>
</persistence>

In the glassfish/domains/domain/lib, I added the following jars: jpox-core-1.2.0-beta-5.jar, jpox-enhancer-1.2.0-beta-5.jar, jpox-java5-1.2.0-beta-5.jar, jpox-rdbms-1.2.0-beta-5.jar and jpox-spatial-1.2.0-beta-5.jar.

When I deployed my ear, I get this exception:

[#|2010-09-03T16:50:40.827+0200|WARNING|sun-glassfish-comms-server2.0|javax.enterprise.system.core.classloading|_ThreadID=10;_ThreadName=main;_RequestID=d8be0761-49ee-429c-beda-d11c8d5b7419;|The log message is null.
java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableMap.put(Collections.java:1285)
at org.jpox.jpa.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:168)
at org.jpox.jpa.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.jav
a:57)
at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:149)
at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84)
at com.sun.enterprise.server.AbstractLoader.loadPersistenceUnits(AbstractLoader.java:915)
at com.sun.enterprise.server.ApplicationLoader.doLoad(ApplicationLoader.java:184)
at com.sun.enterprise.server.TomcatApplicationLoader.doLoad(TomcatApplicationLoader.java:126)
at com.sun.enterprise.server.ExtendedApplicationLoader.doLoad(ExtendedApplicationLoader.java:134)
at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:240)
at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:226)
at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:224)
at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:449)
at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:134)
at com.sun.enterprise.server.PEMain.run(PEMain.java:409)
at com.sun.enterprise.server.PEMain.main(PEMain.java:336)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.server.PELaunch.main(PELaunch.java:415)
|#]

I also tried with the latest datanucleus release (2.1.1):
commons-collections-3.1.jar, commons-pool-1.2.jar, datanucleus-core-2.1.1.jar, datanucleus-enhancer-2.1.0-release.jar, datanucleus-googlecollections-2.1.0-release.jar, datanucleus-jpa-2.1.0-release.jar, datanucleus-management-1.0.2.jar, datanucleus-rdbms-2.1.1.jar, geronimo-jpa_2.0_spec-1.0.jar, geronimo-jta_1.1_spec-1.1.jar, jdo-api-3.0.jar, slf4j-log4j12-1.5.6.jar

Got the same thing,

I moved on and tried on Galssfish 3.1, and for the same error.

What am I doing wrong? Does anyone have any ideas?

It fails when the Persistence is read and the properties are updated:

else if (type == PersistenceUnitTransactionType.JTA)
{
// Assumed to have jta datasource for connections
if (unitInfo.getJtaDataSource() != null)
{
overridingProps.put("datanucleus.ConnectionFactory", unitInfo.getJtaDataSource()); // line 214
}
if (unitInfo.getNonJtaDataSource() != null)
{
// Use non-jta for non-tx connections
overridingProps.put("datanucleus.ConnectionFactory2", unitInfo.getNonJtaDataSource());
}
}

Accordign to the Glassfish forums: http://forums.java.net/jive/thread.jspa?messageID=482023

"The stack seems to suggest that Datanucleus is expecting map passed by container through createContainerEMF() is modifiable. This is obviously wrong. I would suggest you to file a bug against Datanucleus. "

/Thanks

Sort Order: Ascending order - Click to sort in descending order
nicolas added a comment - 10/Sep/10 05:28 PM
Same problem occurs with Jpox 1.2, Access Platform 2.1.1 Release and Access Platform 2.2.0 M1 Release

nicolas added a comment - 12/Sep/10 09:19 AM
Can I test/verify this?

Erik Bengtson added a comment - 12/Sep/10 10:12 AM
wait for nightly build, or buld the datanucleus-jpa yourself

nicolas added a comment - 12/Sep/10 12:18 PM
Seems to work.. Tested with latest from the trunk. I got passed this problem and onto a different one.

Good. Thanks.