Bug 390483 - static weave with project cache failed on GlassFish due to java.lang.NoSuchMethodException: org.eclipse.persistence.platform.server.glassfish.GlassfishPlatform
Summary: static weave with project cache failed on GlassFish due to java.lang.NoSuchM...
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-26 15:47 EDT by Yiping Zhao CLA
Modified: 2022-06-09 10:31 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yiping Zhao CLA 2012-09-26 15:47:54 EDT
Try to use static weave with project cache to run jpa/advanced test model, static weave failed with following info:

run-weaver-server-test:
Warning: Reference run.classpath has not been set at runtime, but was
found during
build file parsing, attempting to resolve. Future versions of Ant may
support
referencing ids defined in non-executed targets.
[weave] [EL Severe]: weaver: 2012-09-26
14:19:21.064--javax.persistence.PersistenceException: Exception
[EclipseLink-28018] (Eclipse Persistence Services -
2.5.0.v20120922-3d4600c):
org.eclipse.persistence.exceptions.EntityManagerSetupException
[weave] Exception Description: Predeployment of PersistenceUnit
[default] failed.
[weave] Internal Exception: javax.persistence.PersistenceException:
Exception [EclipseLink-28007] (Eclipse Persistence Services -
2.5.0.v20120922-3d4600c):
org.eclipse.persistence.exceptions.EntityManagerSetupException
[weave] Exception Description: Failed to instantiate ServerPlatform of
type
[org.eclipse.persistence.platform.server.glassfish.GlassfishPlatform]
specified in [eclipselink.target-server] property.
[weave] Internal Exception: java.lang.NoSuchMethodException:
org.eclipse.persistence.platform.server.glassfish.GlassfishPlatform.<init>(org.eclipse.persistence.sessions.DatabaseSession)

BUILD FAILED
C:\eclipselink\org.eclipse.persistence\eclipselink.runtime\jpa\eclipselink.jpa.test\antbuild.xml:3151:
The following error occurred while executing this line:
C:\eclipselink\org.eclipse.persistence\eclipselink.runtime\jpa\eclipselink.jpa.test\antbuild.xml:2911:
The following error occurred while executing this line:
C:\eclipselink\org.eclipse.persistence\eclipselink.runtime\jpa\eclipselink.jpa.test\antbuild.xml:2461:
The following error occurred while executing this line:
C:\eclipselink\org.eclipse.persistence\eclipselink.runtime\jpa\eclipselink.jpa.test\antbuild.xml:2566:
The following error occurred while executing this line:
C:\eclipselink\org.eclipse.persistence\eclipselink.runtime\jpa\eclipselink.jpa.test\antbuild.xml:2173:
Exception [EclipseLink-40007] (Eclipse Persistence Services -
2.5.0.v20120922-3d4600c):
org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: An exception was thrown while weaving:
./build/unwoven-eclipselink-advanced-model_ejb.jar
Internal Exception: javax.persistence.PersistenceException: Exception
[EclipseLink-28018] (Eclipse Persistence Services -
2.5.0.v20120922-3d4600c):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [default] failed.
Internal Exception: javax.persistence.PersistenceException: Exception
[EclipseLink-28007] (Eclipse Persistence Services -
2.5.0.v20120922-3d4600c):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Failed to instantiate ServerPlatform of type
[org.eclipse.persistence.platform.server.glassfish.GlassfishPlatform]
specified in [eclipselink.target-server] property.
Internal Exception: java.lang.NoSuchMethodException:
org.eclipse.persistence.platform.server.glassfish.GlassfishPlatform.<init>(org.eclipse.persistence.sessions.DatabaseSession)
Comment 1 Tom Ware CLA 2013-06-03 13:21:59 EDT
Here are the steps to recreate:

1. ant server-install / ant server-start / server-setup
2. add "run.metadata.cache.test.suite=true" in test.properties
3. ant server-test-advanced (invoke this model only to simplify the reproduce)
4. ant server-stop
5. remove "run.metadata.cache.test.suite=true" from test.properties
6. add "use.project.cache=true" to test.properties
6.5 add "server.weaving=static" to test.properties
7. go to jpa\eclipselink.jpa.test, edit antbuild.xml to comment out all the lines for "add-project-cache-properties" target
9. add following two lines in persistence.xml under jpa\eclipselink.jpa.test\resource\eclipselink-advanced-model\server
     <property name="eclipselink.project-cache" value="java-serialization"/>
    <property name="eclipselink.project-cache.java-serialization.file-location" value="C:\eclipselink\repo\eclipselink.runtime\jpa\eclipselink.jpa.test\pcfile\eclipselink-advanced-model\MetadataCachingTestProject.file"/>

     note: you might need to change the trunk location "C:\eclipselink\repo\eclipselink.runtime" as yours
10. ant server-test-advanced
Comment 2 Tom Ware CLA 2013-06-03 13:24:16 EDT
The problem occurs during static weaving, before the server is even involved.

I believe the problem is that the classpath the weaver is run with does not have enough classes to load the serialized project.  Running the static weaver with project caching on will require more classes on the classpath since the serialized project will potentially have things like the login setup.

The classpath will have to resemble what was in the environment where the cache was generated.
Comment 3 Tom Ware CLA 2013-06-03 13:35:26 EDT
Caching a project based on a server deployment and then static weaving the same persistence unit based on the cache is a strange thing to do.

The way you should do this is to static weave and then deploy to the server.

If you want to workaround this issue, you just have to make everying available on your server classpath available when you static weave.

Closing as WONTFIX
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:31:51 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink