Hi, 
     
        You're getting an exception because you've specified that you
    must have weaving but EclipseLink is unable to weave.  To see how
    weaving can be enabled in OSGi take a look at: http://wiki.eclipse.org/EclipseLink/Examples/OSGi/Equinox_Byte_Code_Weaving. 
    However this approach is sensitive to bundle start order and you'll
    have to ensure that your RCP main is run last. 
     
        Note that the current EclipseLink OSGi support will eventually
    be replaced by Gemini JPA.  This will provide you with an OSGi
    Enterprise specification compliant way to use EclipseLink JPA. 
    There was a thread on the Gemini thread recently on RCP usage:  http://www.eclipse.org/forums/index.php/t/244936/ 
     
        Shaun 
     
    On 07/11/2011 5:05 AM, cliviu75 wrote:
    
      
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 
     
     
    --  
       
      Shaun Smith | Principal Product Manager 
        Phone: +1.905.502.3094 | Mobile: +1.416.558.6244
         
        Oracle Fusion Middleware, TopLink 
        ORACLE Canada | 100 Milverton Drive, Mississauga, Ontario | L5R
        4H1
      
       
      Oracle is committed to developing practices and
        products that help protect the environment
      
     
  
 |