This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 337034 - CS: JPA Entity search for WebLogic should not require <class> elements when <jar-file> specified
Summary: CS: JPA Entity search for WebLogic should not require <class> elements when <...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 338837
Blocks: 337037
  Show dependency tree
 
Reported: 2011-02-12 11:53 EST by Michael OBrien CLA
Modified: 2022-06-09 10:22 EDT (History)
3 users (show)

See Also:
michael.f.obrien: documentation+


Attachments
WebLogic 10.3.4.0 (Eclipse3.6/Derby10.5.3) Java EE 5 reproduction EAR (67.57 KB, application/x-zip-compressed)
2011-03-09 20:13 EST, Michael OBrien CLA
no flags Details
GlassFish 3.0.1 (NetBeans 6.9.1/Derby10.5.3) Java EE 6 (non-Web Profile) reproduction EAR (31.46 KB, application/x-zip-compressed)
2011-03-09 20:14 EST, Michael OBrien CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael OBrien CLA 2011-02-12 11:53:54 EST

    
Comment 1 Michael OBrien CLA 2011-03-08 23:01:04 EST
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());
Comment 2 Michael OBrien CLA 2011-03-09 20:13:55 EST
Created attachment 190807 [details]
WebLogic 10.3.4.0 (Eclipse3.6/Derby10.5.3) Java EE 5 reproduction EAR
Comment 3 Michael OBrien CLA 2011-03-09 20:14:54 EST
Created attachment 190808 [details]
GlassFish 3.0.1 (NetBeans 6.9.1/Derby10.5.3) Java EE 6 (non-Web Profile) reproduction EAR
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:22:39 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink