jgrassel edited a comment on pull request #64: URL: https://github.com/apache/openjpa/pull/64#issuecomment-657842754
Okay, here is a maven project that will demonstrate the problem with an application server using openjpa. Couple of notes: 1. Yes, you can use the `mvn liberty:start` goal in the `ear` sub-project (after building the entire project) to download Open Liberty and start the server, but it will use Eclipselink. URL to hit the test servlet is `http://localhost:9080/jpatest/SimpleTestServlet` . 2. Open Liberty does not ship with OpenJPA, only Eclipselink. It's Commercial Liberty that ships with OpenJPA in the form of the `jpa-2.0` feature. The maven tools will thus not be able to download the jpa-2.0 feature because it is not available to the open public. However, you can build and extract the ear application generated, and run it on an application server that will run with OpenJPA. The problem will only manifest itself if the application classloader allows for concurrent classloading and enhancement. Example output using Commercial Liberty with the ear generated by this application: ``` OPENJPA-2817 Test Case Starting Worker thread 1... Starting Worker thread 2... Worker Threads Complete. Worker thread Thread-30 started. Now to verify enhancement. Look at the interfaces associated with EntityA and EntityC: Class: model.EntityA Worker thread Thread-30 finished. Interfaces: org.apache.openjpa.enhance.PersistenceCapable Class: model.EntityC No Interfaces Found Worker thread Thread-31 started. Worker thread Thread-31 finished. ``` Note that with Eclipselink, which has a bytecode weaver that properly manages reentrancy, doesn't suffer from this problem: ``` OPENJPA-2817 Test Case Starting Worker thread 1... Starting Worker thread 2... Worker thread Thread-16 started. Worker thread Thread-17 started. Worker thread Thread-17 finished. Worker thread Thread-16 finished. Worker Threads Complete. Now to verify enhancement. Look at the interfaces associated with EntityA and EntityC: Class: model.EntityA Interfaces: java.lang.Cloneable org.eclipse.persistence.internal.weaving.PersistenceWeaved org.eclipse.persistence.internal.descriptors.PersistenceEntity org.eclipse.persistence.internal.descriptors.PersistenceObject org.eclipse.persistence.queries.FetchGroupTracker org.eclipse.persistence.internal.weaving.PersistenceWeavedFetchGroups org.eclipse.persistence.descriptors.changetracking.ChangeTracker org.eclipse.persistence.internal.weaving.PersistenceWeavedChangeTracking org.eclipse.persistence.internal.weaving.PersistenceWeavedRest Class: model.EntityC Interfaces: java.lang.Cloneable org.eclipse.persistence.internal.weaving.PersistenceWeaved org.eclipse.persistence.internal.descriptors.PersistenceEntity org.eclipse.persistence.internal.descriptors.PersistenceObject org.eclipse.persistence.queries.FetchGroupTracker org.eclipse.persistence.internal.weaving.PersistenceWeavedFetchGroups org.eclipse.persistence.descriptors.changetracking.ChangeTracker org.eclipse.persistence.internal.weaving.PersistenceWeavedChangeTracking org.eclipse.persistence.internal.weaving.PersistenceWeavedRest ``` [openjpa_2817-project.zip](https://github.com/apache/openjpa/files/4915535/openjpa_2817-project.zip) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org