Home » Eclipse Projects » EclipseLink » Can't get static weaving working(Toplink=>Eclipselink Upgrade, unable to get weaving working)
Can't get static weaving working [message #663726] |
Wed, 06 April 2011 06:48  |
Eclipse User |
|
|
|
Hi
I am upgrading a Toplink Essentials project running on OC4J 10.3.1.1 to Eclipselink (2.0.2 currently) but can't get static weaving working, and hence lazy loading won't work. I think apart from that the code is ok under Eclipselink because when I change my entity relationships from LAZY to EAGER it all works fine. The deployment EAR file contains a jar with several EJB 3.0 stateless session beans exposing Java-first web services. The application has been running successfully in the wild for about 16 months now.
Anyway, how I did it was like this:
1) Add to my ANT build:
<taskdef name="eclipselink.weave"
classname=" org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask ">
<classpath>
<fileset file="${eclipselink.weave.classpath}"/>
</classpath>
</taskdef>
2) Run this task on the compiled application .class files and , then proceed as I did before ie create a jar with this and persistence.xml, package that jar in an ear along with some OC4J and EJB 3.0 descriptors, then deploy the ear file
When I do, I get a null pointer exception as below:
11/04/06 10:53:34 WARNING: DeployerRunnable.run java.lang.InstantiationException: Application: democustomer is in failed state as initialization failedoracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Application: democustomer is in failed state as initialization failed
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase .java:126)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunna ble.doRun(OC4JDeployerRunnable.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable. run(DeployerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker. run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.InstantiationException: Application: democustomer is in failed state as initialization failed
at com.evermind.server.Application.setConfig(Application.java:4 71)
at com.evermind.server.Application.setConfig(Application.java:3 14)
at com.evermind.server.ApplicationServer.addApplication(Applica tionServer.java:1853)
at oracle.oc4j.admin.internal.ApplicationDeployer.addApplicatio n(ApplicationDeployer.java:512)
at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(Appl icationDeployer.java:196)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase .java:93)
... 4 more
Caused by: java.lang.InstantiationException: Error initializing ejb-modules: nested exception is: java.lang.NullPointerException
at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.j ava:1064)
at com.evermind.server.ApplicationStateRunning.initializeApplic ation(ApplicationStateRunning.java:217)
and this in stderr:
2011-04-06 10:53:31.660 NOTIFICATION Processing EJB module: democustomer.jar
2011-04-06 10:53:33.019 WARNING OWS-00086 The nested parameterized generic type java.util.Set<java.util.Map.java.util.Map$Entry<K, V>> is not supported.
2011-04-06 10:53:33.021 WARNING OWS-00086 The nested parameterized generic type java.util.Map<java.lang.String, java.util.Vector<java.util.List<java.lang.String>>> is not supported.
2011-04-06 10:53:33.029 WARNING OWS-00086 The nested parameterized generic type java.util.Map<java.lang.Class, java.util.Map<org.eclipse.persistence.internal.sessions.ObjectChangeSet, org.eclipse.persistence.internal.sessions.ObjectChangeSet>> is not supported.
2011-04-06 10:53:33.029 WARNING OWS-00086 The nested parameterized generic type java.util.Map<java.lang.Class, java.util.Map<org.eclipse.persistence.internal.sessions.ObjectChangeSet, org.eclipse.persistence.internal.sessions.ObjectChangeSet>> is not supported.
2011-04-06 10:53:33.042 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField, java.util.List<org.eclipse.persistence.mappings.DatabaseMapping >> is not supported.
2011-04-06 10:53:33.043 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField, java.util.List<org.eclipse.persistence.mappings.DatabaseMapping >> is not supported.
2011-04-06 10:53:33.043 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField, java.util.List<org.eclipse.persistence.mappings.DatabaseMapping >> is not supported.
2011-04-06 10:53:33.049 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable, java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.helper.DatabaseField>> is not supported.
2011-04-06 10:53:33.052 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable, java.util.Set<org.eclipse.persistence.internal.helper.DatabaseTable >> is not supported.
2011-04-06 10:53:33.052 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable, java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.helper.DatabaseField>> is not supported.
2011-04-06 10:53:33.053 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable, java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.helper.DatabaseField>> is not supported.
2011-04-06 10:53:33.054 WARNING OWS-00086 The nested parameterized generic type java.util.Map<java.lang.String, java.util.List<java.lang.String>> is not supported.
2011-04-06 10:53:33.074 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable, java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.helper.DatabaseField>> is not supported.
2011-04-06 10:53:33.075 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable, java.util.Set<org.eclipse.persistence.internal.helper.DatabaseTable >> is not supported.
2011-04-06 10:53:33.075 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable, java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.helper.DatabaseField>> is not supported.
2011-04-06 10:53:33.075 WARNING OWS-00086 The nested parameterized generic type java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable, java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.helper.DatabaseField>> is not supported.
2011-04-06 10:53:34.881 WARNING OWS-00061 Ignoring property name "SIZES" in class "com.prologic.cims.services.bindings.filterList.SizeRangeCT" because it is not JAX-RPC compliant
2011-04-06 10:53:34.881 WARNING OWS-00061 Ignoring property name "FITS" in class "com.prologic.cims.services.bindings.filterList.SizeRangeCT" because it is not JAX-RPC compliant
11/04/06 10:53:34 oracle.j2ee.ws.common.tools.api.ValidationException: org.eclipse.persistence.internal.helper.DatabaseField - class "org.eclipse.persistence.internal.helper.DatabaseField" cannot have a JavaBean property "typeName" and a public member of the same name.
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.modeler.rmi.ValueTypeModeler .processTypeMappingRegistry(ValueTypeModeler.java:295)
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.modeler.rmi.ValueTypeModeler .processTypeMappingRegistry(ValueTypeModeler.java:131)
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.modeler.rmi.ValueTypeModeler .buildModel(ValueTypeModeler.java:112)
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.modeler.rmi.RmiModeler.build Model(RmiModeler.java:172)
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel( ModelInfo.java:173)
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.Processor.runModeler(Process or.java:72)
11/04/06 10:53:34 at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerato r$DeploymentCompileTool.run(DeploymentGenerator.java:200)
11/04/06 10:53:34 at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerato r.generateDeploymentArtifacts(DeploymentGenerator.java:131)
11/04/06 10:53:34 at oracle.j2ee.ws.common.metadata.annotation.EJBWebServiceAnnot ationParser.parseAnnotatedBean(EJBWebServiceAnnotationParser .java:165)
11/04/06 10:53:34 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11/04/06 10:53:34 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
11/04/06 10:53:34 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
11/04/06 10:53:34 at java.lang.reflect.Method.invoke(Method.java:597)
11/04/06 10:53:34 at oracle.j2ee.ws.server.deployment.oc4j.WebServiceAnnotationLi stener.parseAnnotatedClass(WebServiceAnnotationListener.java :85)
11/04/06 10:53:34 at com.evermind.server.ejb.AnnotationParser.notifyAnnotationLis teners(AnnotationParser.java:201)
11/04/06 10:53:34 at com.evermind.server.ejb.AnnotationParser.parseAnnotations(An notationParser.java:73)
11/04/06 10:53:34 at com.evermind.server.ejb.EJBPackageDeployment.parseMetaData(E JBPackageDeployment.java:939)
11/04/06 10:53:34 at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.j ava:832)
11/04/06 10:53:34 at com.evermind.server.ApplicationStateRunning.initializeApplic ation(ApplicationStateRunning.java:217)
11/04/06 10:53:34 at com.evermind.server.Application.setConfig(Application.java:4 13)
11/04/06 10:53:34 at com.evermind.server.Application.setConfig(Application.java:3 14)
11/04/06 10:53:34 at com.evermind.server.ApplicationServer.addApplication(Applica tionServer.java:1853)
11/04/06 10:53:34 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplicatio n(ApplicationDeployer.java:512)
11/04/06 10:53:34 at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(Appl icationDeployer.java:196)
11/04/06 10:53:34 at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase .java:93)
11/04/06 10:53:34 at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunna ble.doRun(OC4JDeployerRunnable.java:52)
11/04/06 10:53:34 at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable. run(DeployerRunnable.java:81)
11/04/06 10:53:34 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker. run(ReleasableResourcePooledExecutor.java:303)
11/04/06 10:53:34 at java.lang.Thread.run(Thread.java:619)
11/04/06 10:53:34 Caused by: oracle.j2ee.ws.common.processor.modeler.rmi.InvalidParameter Exception: org.eclipse.persistence.internal.helper.DatabaseField - class "org.eclipse.persistence.internal.helper.DatabaseField" cannot have a JavaBean property "typeName" and a public member of the same name.
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.modeler.rmi.RmiType.classTyp e(RmiType.java:129)
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.modeler.rmi.RmiType.getRmiTy pe(RmiType.java:189)
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.modeler.rmi.RmiType.getRmiTy pe(RmiType.java:168)
11/04/06 10:53:34 at oracle.j2ee.ws.common.processor.modeler.rmi.ValueTypeModeler .processTypeMappingRegistry(ValueTypeModeler.java:255)
11/04/06 10:53:34 ... 28 more
But I don't expose the eclipse classes in my APIs so I have no idea what might be going on here. Any ideas, anyone ?
My persistence.xml file contains this snippet
<property name="eclipselink.weaving" value="static"/>
<property name="eclipselink.weaving.lazy" value="true"/>
<property name="eclipselink.weaving.internal" value="true"/>
<property name="eclipselink.logging.level" value="FINEST"/>
I have tried dynamic weaving but I get a whole different set of problems to do with classes not being found when I add the required javaagent setting to the JVM and when I add those to the JVM like this:
-Xbootclasspath/a:C:\ecommerce\lib_external\eclipselink2.0.2 \javax.persistence_2.0.0.v201002051058.jar;C:\ecommerce\lib_ external\eclipselink2.0.2\eclipselink.jar
I just get more similar errors but claiming not to find javax.* files. If I only include eclipselink.jar I am told that some persistence classes aren't found (I tried dropping the jar into the standard location for OC4J and replacing the existing persistence.jar but no go) and once I start adding to the boot classpath I think maybe everything is expected to be there. Could be wrong but I think I am going down a blind alley with that.
Anyway, any help would be much appreciated.
Regards
Richard
|
|
| | | | |
Re: Can't get static weaving working [message #668064 is a reply to message #663726] |
Tue, 03 May 2011 11:05   |
Eclipse User |
|
|
|
Hi chaps
That did the trick - my static weaving now appears to be working and is deployable, at least, the class files change when I run the static weave target and I can deploy them fine using the properties mentioned above. However- lazy loading is still not working as when I use either EntityManager.find or getReference to retrieve an entity and then use a getter for a relationship marked as FetchType.LAZY (method annotation), it returns null. This is weird because immediately before I can see the SQL issued retrieving this object.
I won't bore you with all the detail but I have an @Entity class CmsProduct which amongst other relationships has this in it (I did try without the join fetch too, but it didn't include that object in the SQL then):
@OneToOne (cascade = CascadeType.ALL,fetch=FetchType.LAZY)
@JoinFetch(value=JoinFetchType.OUTER)
@JoinColumn(name = "WORKFLOWID")
public CmsWorkflow getCmsWorkflow() {
return cmsWorkflow;
}
public void setCmsWorkflow(CmsWorkflow cmsWorkflow) {
this.cmsWorkflow = cmsWorkflow;
}
and then a class :
@Entity
@Table(name = "CMS_WORKFLOW")
public class CmsWorkflow implements Serializable {
.. etc..
Executing
CmsProduct result = site.getEntityManager().find(CmsProduct.class,
productid);
CmsWorkflow wkflresult =
result.getCmsWorkflow();
wkflresult result is null, but not under Toplink Essentials. I get the same if I use getReference() for find().
Any ideas - is it possible that weaving is actually not on ? I am using these settings now in persistence.xml for all persistence units:
<property name="eclipselink.weaving" value="static"/>
<property name="eclipselink.weaving.internal" value="false"/>
<property name="eclipselink.weaving.fetchgroups" value="false"/>
<property name="eclipselink.weaving.changetracking" value="false"/>
The SQL issued is as below so it does a join to the table CMS_WORKFLOW although it doesn't appear to retrieve any fields here - but it shouldn't need to, right ? That would happen when the getter is invoked ?
[EL Fine]: 2011-05-03 15:49:58.496--ServerSession(1656483996)--Connection(59975398 0)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--SEL ECT t1.PRODUCTID, t1.ADDITIONAL_INFO, t1.BF_MAT_CHAR_VAL, t1.DEFAULT_CIMS_COLOUR, t1.DEFAULT_IMG, t1.DESCRIPTION, t1.DETAILED_DESCRIPTION, t1.KEYWORDS, t1.SEASON, t1.STY_CODE, t1.STY_NUM, t1.STY_QUAL, t1.WORKFLOWID, t0.WORKFLOWID, t0.CREATED_DATE, t0.FIRSTLIVE_DATE, t0.GOLIVE_DATE, t0.LASTUPDATEDBY, t0.LOCK_DATE, t0.LOCK_MESSAGE, t0.LOCK_MESSAGE_DATE, t0.LOCK_MESSAGE_USER, t0.LOCKEDBY, t0.PREVIOUS_STATUS, t0.STATUS, t0.STOPLIVE_DATE, t0.UPDATED_DATE, t2.SEQUENCEID, t2.PRODUCTID, t2.AUDITID, t3.CATEGORYID, t3.CIMS_COLOUR, t3.PRODUCTID, t3.RANKING, t3.WORKFLOWID FROM CMS_PRODUCT t1 LEFT OUTER JOIN CMS_WORKFLOW t0 ON (t0.WORKFLOWID = t1.WORKFLOWID) LEFT OUTER JOIN CMS_PRODUCT_AUDIT t2 ON (t2.PRODUCTID = t1.PRODUCTID) LEFT OUTER JOIN CMS_PRODUCT_CATEGORY t3 ON (t3.PRODUCTID = t1.PRODUCTID)
.
Any ideas ?
Best regards
Richard
PS One thing I did notice in the OC4J startup is that I get messages from both Eclipselink and Toplink re the entities loaded (see below) - is it possible that the wrong libraries are being used ? To activate Eclipselink, I am using a shared library in OC4J with Java persistence 2.0 and Eclipselink 2.2.0 in, as per the Eclpselink UG wiki instructions. Should I also take some action to remove the toplink essentials jars, whichver they are ?
<snip>
[EL Config]: 2011-05-03 15:42:22.52--ServerSession(1370483982)--Thread(Thread[OC4J Launcher,5,main])--The alias name for the entity class [class com.prologic.cms.database.generated.CmsProduct] is being defaulted to: CmsProduct.
<snip>
[TopLink Config]: 2011.05.03 03:42:24.870--ServerSession(89421091)--The alias name for the entity class [class com.prologic.cms.database.generated.CmsProduct] is being defaulted to: CmsProduct.
[Updated on: Tue, 03 May 2011 11:10] by Moderator
|
|
| | | |
Goto Forum:
Current Time: Tue Jul 22 22:49:44 EDT 2025
Powered by FUDForum. Page generated in 0.27266 seconds
|