There is an issue in the SDO OSGi enablement. SDOUtil references
commonj.sdo.impl.HelperProvider.INSTANCE which is instantiated in a
static block. It tries to discover the implementation class using
either a system property named "commonj.sdo.impl.HelperProvider" or a
configuration file as
META-INF/services/commonj.sdo.impl.HelperProvider. The classloading
won't work with OSGi.
There is a bundle activator
(org.apache.tuscany.sdo.osgi.SdoBundleActivator) for tuscany-sdo-impl
bundle which tries to set up the instance as follows:
public void start(BundleContext bundleContext) throws Exception {
HelperProvider.setDefaultInstance(this.getClass().getClassLoader());
}
Can you try to start the tuscany-sdo-impl bundle first before you use
any SDO APIs?
Do you mean, I should start that bundle by calling the start method in
SdoBundleActivator? I would asume, that the OSGi container does that for
me. The bundle does not export org.apache.tuscany.sdo.osgi. So it's
impossible to reach the class from an other bundle.
We need the SDO context only in one single class (service), that is
responsible for all SDO handling. Is there a possibility to use SDO
without a global context?
Thanks in advance - Claus
Thanks,
Raymond
--------------------------------------------------
From: "Claus Straube" <[email protected]>
Sent: Wednesday, December 09, 2009 5:53 AM
To: <[email protected]>
Subject: Nullpointer Exception deploying Tuscany SDO in Spring DM Server
Hi all, Do you see a possibility to
we're trying to deploy apache tuscany sdo (tuscany-sdo-lib-1.1.1.jar)
in spring dm server (2.0.0.M6 / OpenJDK 1.6.0_0). This works without
exception and the state of the bundle is active. But we can't see any
exported interfaces (what we can do with other tuscany bundles). So
far no problem, but if we call the bundle we get a nullpointer
exception setting the helper context.
This is the implementation:
public class Foo {
private HelperContext scope;
public HelperContext getScope() {
if(this.scope == null) {
this.scope = SDOUtil.createHelperContext();
}
return this.scope;
}
}
This is our stacktrace:
[2009-12-09 11:33:56.256] ltMessageListenerContainer-1
org.springframework.jms.listener.DefaultMessageListenerContainer
Execution of JMS message listener failed, and no ErrorHandler has
been set. java.lang.ExceptionInInitializerError
at
com.catify.core.sdo.internal.services.impl.SdoServiceImpl.getScope(SdoServiceImpl.java:109)
at
com.catify.core.sdo.internal.services.impl.SdoServiceImpl.registerXmlSchema(SdoServiceImpl.java:32)
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 $Proxy226.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.NullPointerException
at org.apache.tuscany.sdo.api.SDOUtil.<clinit>(SDOUtil.java:48)
... 47 common frames omitted
Any help is welcome. Thanks in advance.
Best regards - Claus
--
claus straube
--
claus straube