| Summary: | CS: JPA Entity search for WebLogic should not require <class> elements when <jar-file> specified | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Michael OBrien <michael.f.obrien> | ||||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||
| Status: | NEW --- | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | douglas.clarke, eclipselink.orm-inbox, michael.f.obrien | ||||||
| Version: | unspecified | Flags: | michael.f.obrien:
documentation+
|
||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | 338837 | ||||||||
| Bug Blocks: | 337037 | ||||||||
| Attachments: |
|
||||||||
|
Description
Michael OBrien
There may be an issue with entity search in WebLogic 10.3.4.0 when using a separate <jar-file> for entities.
On Glassfish 3, specifying only <jar-file> is sufficient, on WebLogic we need to also specify <class> - this should not be necessary for a managed @PersistenceContext.
In my Java EE 5 projects I always run with explicit <class> elements - whether i am using a managed @PersistenceContext or an un-managed @PersistenceUnit. I have 2 nearly identical projects that use an external jar to contain the entity classes - that are referenced from a persistence.xml in the separate ejb-jar file.
I turned off <class> elements and deferred to <jar-file> and/or manifest entry - as instructed by the Java EE 5 spec -and our own "Pro JPA 2 p.413". Note: I do not directly reference the EM from the WAR - so I don't need a ref there.
On GlassFish V3 via NetBeans 6.9 I run fine with the following (no class elements as per spec = OK)
<jar-file>CollatzModel-jar.jar</jar-file>
<!--class>org.dataparallel.collatz.business.ActiveProcessor</class>
<class>org.dataparallel.collatz.business.CollatzRecord</class>
<class>org.dataparallel.collatz.business.Parameters</class>
<class>org.dataparallel.collatz.business.UnitOfWork</class-->
<!--exclude-unlisted-classes>false</exclude-unlisted-classes-->
FINER: Class [org.dataparallel.collatz.business.CollatzRecord] registered to be processed by weaver.
However on WebLogic 10.3.4, I have tried everything, relative paths ../lib, /lib, lib etc (there seems to be some difference on whether to state the path to the default EAR/lib dir) and I can only get WebLogic to find the entities if i also list them as class elements. The jar is being found evidently on the classpath - it is just that the entities are not processed unless also listed - which should not be necessary as they are annotated.
Need to check an older JPA 1.0 server that does not use the patch jar.
<jar-file>org.eclipse.persistence.example.distributed.CollatzModel.jar</jar-file>
These should not be required
<class>org.eclipse.persistence.example.distributed.collatz.model.ActiveProcessor</class>
<class>org.eclipse.persistence.example.distributed.collatz.model.CollatzRecord</class>
<class>org.eclipse.persistence.example.distributed.collatz.model.Parameters</class>
<class>org.eclipse.persistence.example.distributed.collatz.model.UnitOfWork</class>
<!--exclude-unlisted-classes>false</exclude-unlisted-classes-->
>with <class> elements
[EL Finer]: 2011-03-08 21:47:06.796--ServerSession(5694614)--Thread(Thread[[STANDBY] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Class [org.eclipse.persistence.example.distributed.collatz.model.CollatzRecord] registered to be processed by weaver.
I will need to get the source for the WLS patch jar [com.oracle.jpa2support_1.0.0.0_2.0.jar]?
It may be my MANIFEST - but likely not because when entity names are specified - they are found and processed in the jar lib. The issue may be in
Both of the calls [getManagedClassNames() and getJarFileUrls()] to the server class PersistenceUnitInfoImpl return nothing. A later excludeUnlistedClasses() call is expected to be empty.
Oracle WebLogic Server 11gR1 PatchSet 3 r20110115 [base_domain] [Oracle WebLogic Server]
Java HotSpot(TM) Client VM[localhost:8453]
Daemon Thread [[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'] (Running)
Daemon Thread [[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended)
PersistenceUnitInfoImpl.getManagedClassNames() line: 19 [local variables unavailable]
MetadataProcessor.initPersistenceUnitClasses() line: 261
MetadataProcessor.processEntityMappings() line: 470
Oracle WebLogic Server 11gR1 PatchSet 3 r20110115 [base_domain] [Oracle WebLogic Server]
Java HotSpot(TM) Client VM[localhost:8453]
Daemon Thread [[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'] (Running)
Daemon Thread [[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended)
PersistenceUnitInfoImpl.getJarFileUrls() line: 19 [local variables unavailable]
MetadataProcessor.initPersistenceUnitClasses() line: 264
MetadataProcessor.processEntityMappings() line: 470
>However If I specify class names then your PersistenceUnitInfoImpl.getManagedClassNames() returns the entity list specified in persistence.xml back to us.
classNames ArrayList<E> (id=467)
elementData Object[10] (id=469)
[0] "org.eclipse.persistence.example.distributed.collatz.model.ActiveProcessor" (id=472)
[1] "org.eclipse.persistence.example.distributed.collatz.model.CollatzRecord" (id=473)
[2] "org.eclipse.persistence.example.distributed.collatz.model.Parameters" (id=474)
[3] "org.eclipse.persistence.example.distributed.collatz.model.UnitOfWork" (id=475)
modCount 1
size 4
>in
PersistenceUnitInfo persistenceUnitInfo = m_project.getPersistenceUnitInfo();
List<String> classNames = new ArrayList<String>();
// Add all the <class> specifications.
> classNames.addAll(persistenceUnitInfo.getManagedClassNames());
Created attachment 190807 [details]
WebLogic 10.3.4.0 (Eclipse3.6/Derby10.5.3) Java EE 5 reproduction EAR
Created attachment 190808 [details]
GlassFish 3.0.1 (NetBeans 6.9.1/Derby10.5.3) Java EE 6 (non-Web Profile) reproduction EAR
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |