Issue Details (XML | Word | Printable)

Key: NUCCACHE-35
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: David Blain
Votes: 0
Watchers: 0
Operations

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

Support Coherence 3.7+

Created: 19/Jan/13 10:09 AM   Updated: 19/Dec/13 09:22 AM   Resolved: 19/Dec/13 09:22 AM
Component/s: Coherence
Affects Version/s: 3.1.1
Fix Version/s: 3.1.3

Environment: Windows 7, Java 6u35 x64, DataNucleus 3.1.2, Coherence 3.7.1, Neo4j 1.7.2

Forum Thread URL: http://www.datanucleus.org/servlet/forum/viewthread_thread,7333
Datastore: Other
Severity: Development


 Description  « Hide
I'm trying to configure datanucleus 3.1.2 with JPA and Neo4j plugin and Coherence as L2 cache. Everything works except the cache, at runtime I receive the following exception:

java.lang.IncompatibleClassChangeError: Found interface com.tangosol.net.NamedCache, but class was expected
        at org.datanucleus.cache.coherence.CoherenceLevel2Cache.put(CoherenceLevel2Cache.java:179)
        at org.datanucleus.cache.AbstractLevel2Cache.putAll(AbstractLevel2Cache.java:110)
        at org.datanucleus.ObjectManagerImpl.putObjectsIntoLevel2Cache(ObjectManagerImpl.java:4899)
        at org.datanucleus.ObjectManagerImpl.performLevel2CacheUpdateAtCommit(ObjectManagerImpl.java:4286)
        at org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java:4172)
        at org.datanucleus.ObjectManagerImpl.transactionPreCommit(ObjectManagerImpl.java:428)
        at org.datanucleus.TransactionImpl.internalPreCommit(TransactionImpl.java:398)
        at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:287)
        at org.datanucleus.api.jpa.JPAEntityTransaction.commit(JPAEntityTransaction.java:103)
        at be.dablomatique.entities.DepartmentsTest.tearDown(DepartmentsTest.java:42)
        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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
        at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite
.java:140)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:1
27)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        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 org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)


When I disable the datanucleus-cache configuration (3.1.1), then it works. I've tried with several version, it still fails with the same exception.

I've looked in the source code (on: http://grepcode.com/snapshot/repo1.maven.org/.../datanucleus-cache/3.1.1/) and I saw that 2 of the Coherence interfaces have been reimplemented in the datanucleus-cache project as classes (CacheFactory and NamedCache), which could explain why we receive this error.

Sort Order: Ascending order - Click to sort in descending order
David Blain added a comment - 19/Jan/13 10:15 AM
To bypass this problem, I removed both reimplemented Coherence classes from the source code and added the Coherence dependency to rebuild the jar project. Maybe both classes should be reimplemented as interfaces in the original source code because with this fix, the library becomes dependent of Coherence which isn't a good solution I think.

FYI you can find the modified project on: https://github.com/dabla/neo4j-datanucleus-jpa

Andy Jefferson added a comment - 19/Jan/13 10:38 AM
But that doesn't solve the problem. It has to be possible for any DN developer to build the "cache" plugin without some commercial library. i.e using what is freely available in repos. Providing those stubs in the source tree means that they can do that (and they aren't included in the released datanucleus-cache.jar, just for compiling). Consequently what is needed are updated stubs that match the current Coherence, preferably via a patch to SVN trunk.

Andy Jefferson added a comment - 19/Dec/13 08:42 AM
Downgrading since no patch provided, and no easy way of supporting this. Your GitHub project says to "Download Coherence 3.7.1 from ..." yet Coherence is at v12.x now and also when I download their jar and try to install it using the Oracle docs it says
"java -jar coherence_121200.jar
Extracting files....
The OpenJDK JVM is not supported on this platform.
The Oracle Universal Installer failed. Exiting."

Consequently, unless someone has a coherence.jar available that could be put in a Maven repo, this issue is dependent on someone providing something. Of course we could just wait til they update Coherence to support javax.cache (now at v1.0) and we already support that. So it's down to users to say if its a priority to them and act accordingly

Andy Jefferson added a comment - 19/Dec/13 09:22 AM
Actually found a copy of this jar and added instructions to pom.xml