[Dev] Class Not Found exception when deploying a JAX-RS service in a Carbon component

2012-05-31 Thread Tharindu Mathew
Hi,

When I try to deploy a service I get the following exception at [1], which
reports of a CNF issue for the class com.sun.ws.rs.ext.RuntimeDelegateImpl.

I later found this class in the
jersey-bundlehttp://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.8/and
added it to repository/components/lib and the results were the same.

Then I added this to lib/endorsed and it produced the exception at [2]. I
then added the javax.ws.rs.jsr311-api-1.1.1.jar and cxf jars to
lib/endorsed as well and it produced the exception at [3].

Any idea how to resolve this issue?

[1]

[2012-05-31 11:53:11,349] ERROR
{org.wso2.carbon.bam.restapi.internal.RestAPIServiceComponent} -
org.apache.cxf.service.factory.ServiceConstructionException
at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:194)
 at
org.wso2.carbon.bam.restapi.internal.RestAPIServiceComponent.activate(RestAPIServiceComponent.java:44)
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.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:252)
 at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:346)
 at
org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:588)
at
org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:196)
 at
org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:441)
at
org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:213)
 at
org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:800)
at
org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:767)
 at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException:
com.sun.ws.rs.ext.RuntimeDelegateImpl
at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:122)
 at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:91)
at javax.ws.rs.core.Response$ResponseBuilder.newInstance(Response.java:356)
 at javax.ws.rs.core.Response.status(Response.java:104)
at javax.ws.rs.core.Response.status(Response.java:116)
 at
javax.ws.rs.WebApplicationException.init(WebApplicationException.java:106)
at
javax.ws.rs.WebApplicationException.init(WebApplicationException.java:64)
 at
org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:312)
at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:144)
 ... 16 more
Caused by: java.lang.ClassNotFoundException:
com.sun.ws.rs.ext.RuntimeDelegateImpl
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
 at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
 at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
 at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
 at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:62)
at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:155)
 at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:105)
... 24 more

[2] -

[2012-05-31 11:58:46,597] ERROR
{org.wso2.carbon.bam.restapi.internal.RestAPIServiceComponent} -
 javax/ws/rs/ext/RuntimeDelegate
java.lang.NoClassDefFoundError: javax/ws/rs/ext/RuntimeDelegate
 at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:926)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
 at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:509)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
 at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at
org.eclipse.core.runtime.internal.adaptor.ContextFinder.loadClass(ContextFinder.java:126)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:247)
at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:60)
 at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:117)
at 

Re: [Dev] Class Not Found exception when deploying a JAX-RS service in a Carbon component

2012-05-31 Thread Isuru Suriarachchi
Hi Tharindu,

I think the execution has gone on a wrong path due to some issue. When
deploying JAX-RS services in AS (webapps) we don't need
the com.sun.ws.rs.ext package. And also javax.ws.rs.jsr311-api-1.1.1.jar is
already there in our OSGi environment.

What I suggest is, start by running the CXF sample (that I pointed to you)
which programetically registers a JAX-RS service. Then try to convert the
same code into an OSGi bundle. May be embed needed dependencies to start
with.

Thanks,
~Isuru

On Thu, May 31, 2012 at 12:10 PM, Tharindu Mathew thari...@wso2.com wrote:

 Hi,

 When I try to deploy a service I get the following exception at [1], which
 reports of a CNF issue for the
 class com.sun.ws.rs.ext.RuntimeDelegateImpl.

 I later found this class in the 
 jersey-bundlehttp://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.8/and
  added it to repository/components/lib and the results were the same.

 Then I added this to lib/endorsed and it produced the exception at [2]. I
 then added the javax.ws.rs.jsr311-api-1.1.1.jar and cxf jars to
 lib/endorsed as well and it produced the exception at [3].

 Any idea how to resolve this issue?

 [1]

 [2012-05-31 11:53:11,349] ERROR
 {org.wso2.carbon.bam.restapi.internal.RestAPIServiceComponent} -
 org.apache.cxf.service.factory.ServiceConstructionException
 at
 org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:194)
  at
 org.wso2.carbon.bam.restapi.internal.RestAPIServiceComponent.activate(RestAPIServiceComponent.java:44)
 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.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:252)
  at
 org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
 at
 org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:346)
  at
 org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:588)
 at
 org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:196)
  at
 org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:441)
 at
 org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:213)
  at
 org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:800)
 at
 org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:767)
  at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
 at java.lang.Thread.run(Thread.java:680)
 Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException:
 com.sun.ws.rs.ext.RuntimeDelegateImpl
 at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:122)
  at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:91)
 at javax.ws.rs.core.Response$ResponseBuilder.newInstance(Response.java:356)
  at javax.ws.rs.core.Response.status(Response.java:104)
 at javax.ws.rs.core.Response.status(Response.java:116)
  at
 javax.ws.rs.WebApplicationException.init(WebApplicationException.java:106)
 at
 javax.ws.rs.WebApplicationException.init(WebApplicationException.java:64)
  at
 org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:312)
 at
 org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:144)
  ... 16 more
 Caused by: java.lang.ClassNotFoundException:
 com.sun.ws.rs.ext.RuntimeDelegateImpl
 at
 org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
  at
 org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
 at
 org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
  at
 org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:169)
  at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:62)
 at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:155)
  at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:105)
 ... 24 more

 [2] -

 [2012-05-31 11:58:46,597] ERROR
 {org.wso2.carbon.bam.restapi.internal.RestAPIServiceComponent} -
  javax/ws/rs/ext/RuntimeDelegate
 java.lang.NoClassDefFoundError: javax/ws/rs/ext/RuntimeDelegate
  at java.lang.ClassLoader.findBootstrapClass(Native Method)
 at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:926)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  at
 org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:509)
 at
 

Re: [Dev] Class Not Found exception when deploying a JAX-RS service in a Carbon component

2012-05-31 Thread Pradeep Fernando
Hi,

AFAIK, this happens when, jax-rs api jars cannot find the JAXRS impl
classes. According to the spec, it get the impl class using a system
property. If not found defaults to,
com.sun.ws.rs.ext.RuntimeDelegateImpl.

--Pradeep
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Class Not Found exception when deploying a JAX-RS service in a Carbon component

2012-05-31 Thread Tharindu Mathew
Yes, seems to be the case. CXF has an osgi sample. Let me try that and see
if it works.

On Thu, May 31, 2012 at 1:08 PM, Pradeep Fernando prad...@wso2.com wrote:

 Hi,

 AFAIK, this happens when, jax-rs api jars cannot find the JAXRS impl
 classes. According to the spec, it get the impl class using a system
 property. If not found defaults to,
 com.sun.ws.rs.ext.RuntimeDelegateImpl.

 --Pradeep




-- 
Regards,

Tharindu

blog: http://mackiemathew.com/
M: +9459908
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Class Not Found exception when deploying a JAX-RS service in a Carbon component

2012-05-31 Thread Tharindu Mathew
Managed to get it to work finally. Put down the steps at [1] if someone
needs it.

WIll have to replace the jsr 311 implementation. Hope this can be done
without affecting AS jax-ws deployment.

[1] -
http://mackiemathew.com/2012/05/31/fixing-cnf-cxf-jax-rs-osgi-container/

On Thu, May 31, 2012 at 1:22 PM, Tharindu Mathew thari...@wso2.com wrote:

 Yes, seems to be the case. CXF has an osgi sample. Let me try that and see
 if it works.


 On Thu, May 31, 2012 at 1:08 PM, Pradeep Fernando prad...@wso2.comwrote:

 Hi,

 AFAIK, this happens when, jax-rs api jars cannot find the JAXRS impl
 classes. According to the spec, it get the impl class using a system
 property. If not found defaults to,
 com.sun.ws.rs.ext.RuntimeDelegateImpl.

 --Pradeep




 --
 Regards,

 Tharindu

 blog: http://mackiemathew.com/
 M: +9459908




-- 
Regards,

Tharindu

blog: http://mackiemathew.com/
M: +9459908
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev