Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problem with dynamic weaving in equinox
Problem with dynamic weaving in equinox [message #663774] Wed, 06 April 2011 13:15 Go to next message
Andy  is currently offline Andy Friend
Messages: 2
Registered: April 2011
Junior Member
Hey folks!

I am working on a small JPA bundle which should make use of dynamic weaving in order to get lazy loading to work. Unfortunately, I couldn't get it to work and I have no idea what I am doing wrong. Sad Without dynamic weaving everything works fine.

I followed the offical tutorial ( http://wiki.eclipse.org/EclipseLink/Examples/OSGi/Equinox_By te_Code_Weaving), added the required bundles, added support for dynamic weaving in persistence.xml and started equinox with the parameter " -Dosgi.framework.extensions=org.eclipse.persistence.jpa.equi nox.weaving ".

However, when I try to start my weaving test bundle I get the following exception:
[EL Finer]: Thread(Thread[OSGi Console,5,main])--JavaSECMPInitializer - registering transformer for weaving.jpa.
org.osgi.framework.BundleException: Exception in weaving.test.Activator.start() of bundle weaving.test.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:276)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:252)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:156)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:141)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:105)
	at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/persistence/internal/jpa/deployment/osgi/equinox/EquinoxWeaver
java.lang.NoClassDefFoundError: org/eclipse/persistence/internal/jpa/deployment/osgi/equinox/EquinoxWeaver
	at org.eclipse.persistence.internal.jpa.deployment.osgi.equinox.EquinoxInitializer.registerTransformer(EquinoxInitializer.java:97)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:107)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initPersistenceUnits(JPAInitializer.java:309)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initialize(JPAInitializer.java:262)
	at org.eclipse.persistence.jpa.osgi.PersistenceProvider.getInitializer(PersistenceProvider.java:82)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:71)
	at weaving.test.Activator.start(Activator.java:34)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:276)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:252)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:156)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:141)
	at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:105)
	at java.lang.Thread.run(Thread.java:636)




My installed bundles are:
id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.6.2.R36x_v20110210
	            Fragments=1
1	RESOLVED    org.eclipse.persistence.jpa.equinox.weaving_2.2.0.v20110202-r8913
	            Master=0
2	ACTIVE      org.eclipse.osgi.services_3.2.100.v20100503
3	ACTIVE      org.eclipse.equinox.cm_1.0.200.v20100520
4	ACTIVE      org.eclipse.equinox.common_3.6.0.v20100503
5	ACTIVE      org.eclipse.update.configurator_3.3.100.v20100512
7	ACTIVE      javax.persistence_2.0.3.v201010191057
8	ACTIVE      org.eclipse.persistence.antlr_2.2.0.v20110202-r8913
10	ACTIVE      org.eclipse.persistence.asm_2.2.0.v20110202-r8913
11	ACTIVE      org.eclipse.persistence.jpa_2.2.0.v20110202-r8913
13	ACTIVE      org.apache.derby_10.1.2.1_v200803061811
16	ACTIVE      org.eclipse.persistence.core_2.2.0.v20110202-r8913
17	RESOLVED    org.eclipse.persistence.jpa.equinox_2.2.0.v20110202-r8913
	            Master=19
19	ACTIVE      org.eclipse.persistence.jpa.osgi_2.2.0.v20110202-r8913
	            Fragments=17
20	RESOLVED    weaving.test_1.0.0



My Activator:
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PersistenceUnitProperties.CLASSLOADER, this.getClass().getClassLoader());

EntityManagerFactory entityManagerFactory = new PersistenceProvider("org.eclipse.persistence.internal.jpa.deployment.osgi.equinox.EquinoxInitializer").createEntityManagerFactory("weaving.jpa", properties);	
      
EntityManager em = entityManagerFactory.createEntityManager();        


I couldn't find any bundle which exports the EquinoxWeaver class. Has anyone an idea what is going wrong with my bundle?

Many thanks in advance and best regards!
Andy
Re: Problem with dynamic weaving in equinox [message #664122 is a reply to message #663774] Thu, 07 April 2011 14:37 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Not sure on dynamic weaving in Equinox, but you could try using static weaving instead. (run the static weaving ant task on your jar during your build script).


James : Wiki : Book : Blog : Twitter
Previous Topic:InstantiationException due to abstract Entity
Next Topic:JAXB webservice exception
Goto Forum:
  


Current Time: Sat Dec 20 18:54:58 GMT 2014

Powered by FUDForum. Page generated in 0.08158 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software