Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problem with sdo in OSGi bundle (classloader?)
Problem with sdo in OSGi bundle (classloader?) [message #503053] Thu, 10 December 2009 17:04 Go to next message
Claus Straube is currently offline Claus Straube
Messages: 2
Registered: December 2009
Junior Member
Hi all,

we habe a big issue with eclipselink sdo in spring dm server (2.0.0M6). The deployment of eclipselink an related artifacts runs without problems. We can deploy our classes, too. But if we run an test the application crashes.

We've got a single service (OSGi bundle), which handels all SDO operations (create, serialize, etc.). This bundle uses SDOHelperContext to create the SDO context:

import org.eclipse.persistence.sdo.helper.SDOHelperContext;
import commonj.sdo.helper.HelperContext;

private HelperContext scope;

public HelperContext getScope() {
	if(this.scope == null){
		this.scope =  new SDOHelperContext();
	}
	return scope;
}


If we call this OSGi bundle, the application crashes. This looks for me like a classloader issue, because the classloader is looking for org.eclipse.persistence.sdo.SDODataObject in one of our bundles. It seems, if he tries to use the classloader of this bundle and can't (of course) find the SDO class. Here is the complete stacktrace:

[2009-12-10 17:48:01.721] ltMessageListenerContainer-1 org.springframework.jms.listener.DefaultMessageListenerContainer  Execution of JMS message listener failed, and no ErrorHandler has been set. java.lang.NoClassDefFoundError: org/eclipse/persistence/sdo/SDODataObject
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:637)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:482)
	at org.eclipse.persistence.sdo.helper.SDOClassLoader.createGeneric(SDOClassLoader.java:99)
	at org.eclipse.persistence.sdo.helper.SDOClassLoader.loadClass(SDOClassLoader.java:72)
	at org.eclipse.persistence.sdo.SDOType.getInstanceClass(SDOType.java:151)
	at org.eclipse.persistence.sdo.types.SDOWrapperType.<init>(SDOWrapperType.java:79)
	at org.eclipse.persistence.sdo.types.SDOWrapperType.<init>(SDOWrapperType.java:59)
	at org.eclipse.persistence.sdo.helper.delegates.SDOTypeHelperDelegate.initWrapperTypes(SDOTypeHelperDelegate.java:143)
	at org.eclipse.persistence.sdo.helper.delegates.SDOTypeHelperDelegate.<init>(SDOTypeHelperDelegate.java:131)
	at org.eclipse.persistence.sdo.helper.SDOHelperContext.initialize(SDOHelperContext.java:123)
	at org.eclipse.persistence.sdo.helper.SDOHelperContext.<init>(SDOHelperContext.java:114)
	at org.eclipse.persistence.sdo.helper.SDOHelperContext.<init>(SDOHelperContext.java:104)
	at com.catify.core.sdo.internal.services.impl.SdoServiceImpl.getScope(SdoServiceImpl.java:111)
	at com.catify.core.sdo.internal.services.impl.SdoServiceImpl.registerXmlSchema(SdoServiceImpl.java:35)
	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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy270.registerXmlSchema(Unknown Source)
	at com.catify.test.adapter.ws.internal.WebserviceAdapterCall.call(WebserviceAdapterCall.java:46)
	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.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:193)
	at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:115)
	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:122)
	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61)
	at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:186)
	at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:155)
	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
	at org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
	at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:148)
	at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
	at org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
	at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:83)
	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:559)
	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)
	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:976)
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:968)
	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:870)
	at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.sdo.SDODataObject not found from bundle [com.catify.test.adapter.ws]
	at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
	at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
	at org.eclipse.persistence.sdo.helper.SDOClassLoader.loadClass(SDOClassLoader.java:51)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
	... 60 common frames omitted
Caused by: com.springsource.kernel.osgi.framework.ExtendedClassNotFoundException: org.eclipse.persistence.sdo.SDODataObject in KernelBundleClassLoader: [bundle=com.catify.test.adapter.ws_1.0.0.SNAPSHOT]
	at com.springsource.kernel.osgi.framework.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:145)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
	at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
	... 64 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.sdo.SDODataObject
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at com.springsource.kernel.osgi.framework.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:141)
	... 69 common frames omitted


Any help is welcome. Thanks in advance!

Claus

[Updated on: Thu, 10 December 2009 17:06]

Report message to a moderator

Re: Problem with sdo in OSGi bundle (classloader?) [message #505769 is a reply to message #503053] Mon, 04 January 2010 20:41 Go to previous message
Shaun Smith is currently offline Shaun Smith
Messages: 197
Registered: July 2009
Senior Member
Hi Claus,

I'm sorry I missed your posting but I hope my comments are still useful.

You should be using the constructor for SDOHelperContext that takes a classloader to ensure that all of your domain classes, schemas, and XML documents are visible in the context. In OSGi, the bundle itself is an ideal candidate as it provides classloader-like API and can be adapted [1]. EclipseLink uses this technique in JPA.

Unfortunately, in reproducing your problem we discovered another problem [2] which we fortunately have a fix for and which will be available in a nightly build as soon as it is promoted.

--Shaun

[1] http://wiki.eclipse.org/index.php/BundleProxyClassLoader_rec ipe
[2] https://bugs.eclipse.org/298792
Previous Topic:JPA 2.0 and MySQL 5.1 ERROR
Next Topic:Eclipselink 1.1.3 query hang up
Goto Forum:
  


Current Time: Fri Oct 31 17:19:15 GMT 2014

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

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