Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Weaving and OSGi
Weaving and OSGi [message #635391] Tue, 26 October 2010 16:12 Go to next message
Stephan Mann is currently offline Stephan MannFriend
Messages: 22
Registered: August 2010
Junior Member
Hi,

we're trying to get code weaving running inside an OSGi container and we
are getting nowhere. The symptom at the moment is the following exception:

java.lang.ClassNotFoundException:
org.eclipse.persistence.jpa.equinox.weaving.IWeaver
(see [4] for full trace)

The environment is a Riena server (OSGi and Jetty) on Eclipse 3.6 using
MySQL as data base. EclipseLink is version 2.1.1 (OSGi bundles Zip),
last downloaded today.

We have followed the wiki page [1]. Only in the Equinox configuration
section we diverged as we defined all start levels via the Eclipse run
configuration and passed along the second to forth row of these options
as VM arguments. Judging from the difference with and without the VM
arguments, this is working.

But the server is not starting as the stacktrace shows. It is working
properly without code weaving but obviously, without lazy loading, this
is not worth much. We have tried to follow hints tweaking the
persistence provider [2,3] but also with no luck.

Since a colleague and I have spend the entire day without getting
anywhere and since we have no idea on how we could proceed, any hint
would be greatly appreciated.

tia, stephan


[1]
http://wiki.eclipse.org/EclipseLink/Examples/OSGi/Equinox_By te_Code_Weaving
[2]
http://old.nabble.com/Bytecode-weaving-in-equinox-eclipse-rc p-applications-p28502398.html
[3] http://www.eclipse.org/forums/index.php?t=msg&goto=48701 1&
[4] Full stacktrace:

Tue Oct 26 17:50:58 CEST 2010 ERROR [Framework Event Dispatcher] null
FrameworkEvent ERROR
org.osgi.framework.BundleException: Exception in
de.product.internal.server.Activator.start() of bundle de.product.server.
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:806)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:755)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:370)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:374)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1067)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:561)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:546)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:459)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:243)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:440)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:227)
at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:337)
Caused by: java.lang.NoClassDefFoundError:
org/eclipse/persistence/jpa/equinox/weaving/IWeaver
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.def ineClass(DefaultClassLoader.java:188)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineC lass(ClasspathManager.java:580)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findCla ssImpl(ClasspathManager.java:550)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClassImpl(ClasspathManager.java:490)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass_LockClassLoader(ClasspathManager.java:469)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:449)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:216)
at
org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass (BundleLoader.java:393)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInter nal(BundleLoader.java:469)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund leLoader.java:422)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund leLoader.java:410)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at
org.eclipse.persistence.internal.jpa.deployment.osgi.equinox .EquinoxInitializer.registerTransformer(EquinoxInitializer.j ava:99)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializ er.callPredeploy(JPAInitializer.java:94)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:127)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:65)
at javax.persistence.Persistence.createEntityManagerFactory(Unk nown Source)
at javax.persistence.Persistence.createEntityManagerFactory(Unk nown Source)
... 11 more
Caused by: java.lang.ClassNotFoundException:
org.eclipse.persistence.jpa.equinox.weaving.IWeaver
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInter nal(BundleLoader.java:460)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund leLoader.java:422)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund leLoader.java:410)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 39 more
Re: Weaving and OSGi [message #635438 is a reply to message #635391] Tue, 26 October 2010 19:06 Go to previous messageGo to next message
Shaun Smith is currently offline Shaun SmithFriend
Messages: 197
Registered: July 2009
Senior Member
Hi Stephan,

Is the org.eclipse.persistence.jpa.equinox.weaving bundle in the same folder as org.eclipse.osgi? We use the Equinox AdaptorHook framework [1] which requires co-location. In the example on [2] they are co-located but I see this restriction isn't documented. I'll add something about this.

--Shaun

[1] http://wiki.eclipse.org/Adaptor_Hooks
[2] http://wiki.eclipse.org/EclipseLink/Examples/OSGi/Equinox_By te_Code_Weaving

[Updated on: Tue, 26 October 2010 19:06]

Report message to a moderator

Re: Weaving and OSGi [message #635574 is a reply to message #635438] Wed, 27 October 2010 11:32 Go to previous messageGo to next message
Stephan Mann is currently offline Stephan MannFriend
Messages: 22
Registered: August 2010
Junior Member
On 26.10.2010 21:06, Shaun Smith wrote:
> Is the org.eclipse.persistence.jpa.equinox.weaving bundle in the same
> folder as org.eclipse.osgi?

No, it was not. After we merged our two folders from our target platform
we saw the very same exception as documented here [1]. Lucky for us, the
described fix applied too. So code weaving is working now. Thank you
very much Shaun!

stephan

[1] http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg04 612.html
Re: Weaving and OSGi [message #636520 is a reply to message #635574] Mon, 01 November 2010 16:37 Go to previous messageGo to next message
Stephan Mann is currently offline Stephan MannFriend
Messages: 22
Registered: August 2010
Junior Member
On 27.10.2010 13:32, Stephan Mann wrote:
> On 26.10.2010 21:06, Shaun Smith wrote:
>> Is the org.eclipse.persistence.jpa.equinox.weaving bundle in the same
>> folder as org.eclipse.osgi?

Hi,

after we got this to run we now face another problem that has left us
equally stumped as the first one. We are trying to get our PDE build
back up, but we can't even export the product from Eclipse IDE. The
error is the same during export or headless build:

A cycle was detected when generating the classpath
de.product.server_0.1.0.201011011332NGT,
org.eclipse.persistence.core_2.1.1.v20100817-r8050,
org.eclipse.persistence.core_2.1.1.v20100817-r8050.

We did some investigating and learned that persistence.core indeed has a
dependency on itself though I fail to understand how and why. The
imported packages are the same as described in the original post.

We can tell the IDE export to ignore this cycle but that will not help
our headless build. So again, if anyone has a hint, that would be great!

tia
stephan
Re: Weaving and OSGi [message #636917 is a reply to message #636520] Wed, 03 November 2010 11:19 Go to previous message
Stephan Mann is currently offline Stephan MannFriend
Messages: 22
Registered: August 2010
Junior Member
The source of this problem is a bug in the org.eclipse.persistence.dbws fragement which requries core despite core being its host bundle. So the solution is to remove this fragment from the target platform. Also, this shouldn't be a problem any longer when version 2.2 comes out because this fragment will be a standalone bundle by then.

Thanks again to Shaun for the great help.
stephan
Previous Topic:DynamicJAXBContext creation fails with NPE
Next Topic:EclipseLink 2.0 ManyToOne not working correctly
Goto Forum:
  


Current Time: Sun Dec 21 12:58:58 GMT 2014

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

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