Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Enable eclipse-link dynamic weaving in an Eclipse RCP application

Hi Michael,
  Thanks for your answer ....

  In my case is actually also a simple RCP Application. I do not use org.eclipse.persistence.jpa.
osgi.PersistenceProvider because it ignores the dynamic weaving.
  I use org.eclipse.persistence.jpa.PersistenceProvider().createEntityManagerFactory() to get my persistence provider.

I have tried your hints to set the instrumentation agent in my Eclipse RCP project but with no success. By the way, at point 2,
I have found no "/org.eclipse.persistence.jpa/resource" / .

  If I set the javaagent to eclipselink.jar, the instrumentation is set, classloader sun.misc.Launcher$AppClassLoader is used.
Later, another classloader is used: org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader. When loaded with this loader, the initial instrumentation performed
with the system class loader is not recognized anymore . Then I got the exception : Value [true] for the property [eclipselink.weaving]
is incorrect when global instrumentation is null

  Thanks again ,

   Liviu


On Mon, Nov 7, 2011 at 3:57 PM, Michael O'Brien <Michael.F.Obrien@xxxxxxxxx> wrote:
Hi,
       I have seen this exception on occasion when setting up a new SE (non-EE container) application when the persistence provider agent is not set.  Usually you get "persistence provider not found" - but you may get the following depending on your persistence.xml where even though you are running EntityManagerSetup code from the JPA provider - the agent is not set.

       the key is the note:

"is incorrect when global instrumentation is null"

       In an EE server everything is managed properly for you - weaving is on by default
       In a non-OSGI (regular PDE) project, you set the weaving/instrumentation agent in one of at least 3 ways
1) include the aggregated eclipselink.jar (it contains the services directory)
2) include the resources folder of the JPA subproject
<classpathentry kind="lib" path="/org.eclipse.persistence.jpa/resource" />
3) include the services/javax.persistence.spi.PersistenceProvider file in your META-INF where your persistence.xml lives
       - set it to "org.eclipse.persistence.jpa.PersistenceProvider"

       This is all PDE related - so may not help in this OSGI case.

       Thank you
       /michael

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of cliviu75
Sent: November 7, 2011 05:05
To: eclipselink-users@xxxxxxxxxxx
Subject: [eclipselink-users] Enable eclipse-link dynamic weaving in an Eclipse RCP application


Hi,
 I'm trying to enable eclipse-link dynamic weaving in an Eclipse RCP
application.

 I've got the following stack trace:

  Internal Exception: javax.persistence.PersistenceException: Exception
[EclipseLink-28022] (Eclipse Persistence Services - 2.3.0.v20110604-r9504):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Value [true] for the property [eclipselink.weaving]
is incorrect when global instrumentation is null, value should either be
null, false, or static.
       at
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126)
       at
org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:115)
       at ServiceFactory.<init>(ServiceFactory.java:100)
       at ServiceFactory.login(ServiceFactory.java:69)
       at Application.login(Application.java:79)
       at Application.start(Application.java:26)
       at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
       at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
       at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
       at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
       at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
       at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
       at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
       at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: javax.persistence.PersistenceException: Exception
[EclipseLink-28022] (Eclipse Persistence Services - 2.3.0.v20110604-r9504):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Value [true] for the property [eclipselink.weaving]
is incorrect when global instrumentation is null, value should either be
null, false, or static.
       at
org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializer.checkWeaving(JavaSECMPInitializer.java:123)
       at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:88)
       at
org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:105)
       ... 17 more
Caused by: Exception [EclipseLink-28022] (Eclipse Persistence Services -
2.3.0.v20110604-r9504):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Value [true] for the property [eclipselink.weaving]
is incorrect when global instrumentation is null, value should either be
null, false, or static.
       at
org.eclipse.persistence.exceptions.EntityManagerSetupException.wrongWeavingPropertyValue(EntityManagerSetupException.java:253)
       ... 20 more


I mention that I tried to follow the instruction from this page :

http://wiki.eclipse.org/EclipseLink/Examples/OSGi/LazyLoadingRCP
the OSGi
Anyway, nothing happened when using the osgi PersistenceProvider to create
an EntityManagerFactory

with ...  new
org.eclipse.persistence.jpa.osgi.PersistenceProvider().createEntityManagerFactory()

for the simple reason that in class OSGiInitializer, check weaving overrides
the weaving property
 /**
    * Check whether weaving is possible and update the properties and
variable as appropriate
    * @param properties The list of properties to check for weaving and
update if weaving is not needed
    */
   public void checkWeaving(Map properties){
       String weaving = "false";
       properties.put(PersistenceUnitProperties.WEAVING, weaving);
       shouldCreateInternalLoader=false;
   }

In my persistence.xml I have set :

 <property name="eclipselink.weaving" value="true" />

Thank you very much in advance for any hint
--
View this message in context: http://old.nabble.com/Enable-eclipse-link-dynamic-weaving-in-an-Eclipse-RCP-application-tp32788713p32788713.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top