camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miguel González (JIRA) <j...@apache.org>
Subject [jira] [Updated] (CAMEL-4185) CXFRS can't find my JAX-RS resource classes
Date Thu, 07 Jul 2011 14:21:17 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-4185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Miguel González updated CAMEL-4185:
-----------------------------------

    Description: 
I'm trying doing some testing to expose an OSGi/iPOJO component with a REST interface too. When I install the bundle on Camel-JOnAS, CXFRS can't build the route because it can't find any resource classes, even if I indicated it properly in the URI. To test, I'm using the classes found in https://svn.apache.org/repos/asf/camel/tags/camel-2.2.0/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/ and launching with the following one:
{code:title=ExampleCXF.java|borderStyle=solid}
public class ExampleCXF extends RouteBuilderComponent {
    private static final String CXF_RS_ENDPOINT_URI =
            "cxfrs://http://localhost:9000/customerservice?resourceClasses=org.ow2.jonas.sample.jaxrs.api.ICustomerService";
    /**
     * The logger.
     */
    private Log logger = LogFactory.getLog(this.getClass());

    private ICamelService camelService;

    /**
     * HTTP port number.
     */
    private String httpPort = "9000";

    /**
     * Name of files exchanged in CXF. Used by the second route.
     */
    private Map<String, String> filenames = new HashMap<String, String> ();

    /**
     * Constructor: saves the BundleContext.
     */
    public ExampleCXF(final BundleContext bundleContext) {
        super(bundleContext);
    }


    /**
     * Adds the OSGi HTTP service port and the
     * <code>target/fileToHelloService</code> directory into
     * {@link RouteBuilderComponent#registryReplacements}, calls
     * {@link RouteBuilderComponent#start()} and launches a self-test.
     */
    @Override
    public void start() throws Throwable {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        System.out.println("Current thread class loader = " + cl);
        try{
            Thread.currentThread().setContextClassLoader(ExampleCXF.class.getClassLoader());
            System.out.println("Bundle class loader = " + ExampleCXF.class.getClassLoader());
            super.start();
        }finally {
            Thread.currentThread().setContextClassLoader(cl);
        }

    }

    @Override
    public void stop() throws Throwable {
        super.stop();
        logger.debug("Going down.");
    }

    /**
     * Add routes to the CAMEL context.
     */
    @Override
    public void configure() throws Exception {
        super.configure();
        from(CXF_RS_ENDPOINT_URI).process(new Processor() {

            public void process(Exchange exchange) throws Exception {
                Message inMessage = exchange.getIn();
                // Get the operation name from in message
                String operationName = inMessage.getHeader(CxfConstants.OPERATION_NAME, String.class);
                if ("getCustomer".equals(operationName)) {
                    String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
                    if(!"GET".equals(httpMethod)) {
                        throw new IllegalAccessException("Get a wrong http method");
                    }
                    String path = inMessage.getHeader(Exchange.HTTP_PATH, String.class);
                    // The parameter of the invocation is stored in the body of in message
                    String id = (String) inMessage.getBody(String.class);
                    if ("/customerservice/customers/126".equals(path)) {
                        Customer customer = new Customer();
                        customer.setId(Long.parseLong(id));
                        customer.setName("Willem");
                        // We just put the response Object into the out message body
                        exchange.getOut().setBody(customer);
                    } else {
                        if ("/customerservice/customers/123".equals(path)) {
                            // send a customer response back
                            Response r = Response.status(200).entity("customer response back!").build();
                            exchange.getOut().setBody(r);
                            return;
                        }
                        if ("/customerservice/customers/456".equals(path)) {
                            Response r = Response.status(404).entity("Can't found the customer with uri " + path).build();
                            throw new WebApplicationException(r);
                        } else {
                            throw new RuntimeCamelException("Can't found the customer with uri " + path);
                        }
                    }
                }
                if ("updateCustomer".equals(operationName)) {
                    if(!"header1;header2".equals(inMessage.getHeader("test"))) {
                        throw new IllegalAccessException("Get a wrong customer message header");
                    }
                    String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
                    if(!"PUT".equals(httpMethod)) {
                        throw new IllegalAccessException("Get a wrong http method");
                    }
                    Customer customer = inMessage.getBody(Customer.class);
                    if(customer != null) {
                        throw new IllegalAccessException("Customer should not be null");
                    }
                    // Now you can do what you want on the customer object
                    if(!"Mary".equals(customer.getName())) {
                        throw new IllegalAccessException("Get a wrong customer name.");
                    }
                    // set the response back
                    exchange.getOut().setBody(Response.ok().build());
                }

            }

        });

        
    }

}
{code}
--------------------------------------------------------------------
The ICustomerService it's just an interface containing all methods from the original CustomerService and its JAX-RS annotations. This CustomerService has been exposed as an OSGi component as follows:
{code:xml}
<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="org.apache.felix.ipojo"
  xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/1.4.0/core.xsd">


  <component classname="org.ow2.jonas.sample.jaxrs.impl.ExampleCXF"
             name="ExampleCXF"
             public="false"
             immediate="true">

    <requires optional="false"
              specification="org.ow2.jonas.camel.service.api.ICamelService">
      <callback type="bind" method="setCamelService" />
    </requires>

    <callback transition="validate" method="start" />
    <callback transition="invalidate" method="stop" />
  </component>

  <instance component="ExampleCXF" />

</ipojo>
{code}
---------------------------------------------------------

And these are the import-exports:

{noformat}
Export-Package org.ow2.jonas.sample.jaxrs.api

Import-Package javax.ws.rs, \
               *

DynamicImport-Package org.apache.cxf.dosgi.dsw.qos, \
                      org.apache.cxf

Private-Package org.ow2.jonas.camel.component, \
                org.ow2.jonas.sample.jaxrs.impl}}
{noformat}
--------------------------------------------------------

Finally, the log and stack trace displayed on deployment:


{noformat}
2011-07-07 15:47:53,914 : CamelService.__startNewContext : Starting a new camel context
2011-07-07 15:47:53,915 : DefaultCamelContext.start : Apache Camel  (CamelContext: org.ow2.jonas.sample.jonas-jaxrs-sample) is starting
2011-07-07 15:47:53,915 : DefaultCamelContext.createManagementStrategy : JMX enabled. Using ManagedManagementStrategy.
2011-07-07 15:47:53,916 : DefaultManagementLifecycleStrategy.onContextStart : This CamelContext(org.ow2.jonas.sample.jonas-jaxrs-sample) will be registered using the name: org.ow2.jonas.sample.jonas-jaxrs-sample-171-2 due to clash with an existing name already registered in MBeanServer.
2011-07-07 15:47:53,958 : Activator$BundleTypeConverterLoader$Loader.load : Found 1 @Converter classes to load
2011-07-07 15:47:53,969 : Activator$BundleTypeConverterLoader$Loader.load : Found 13 @Converter classes to load
2011-07-07 15:47:53,980 : Activator$BundleTypeConverterLoader$Loader.load : Found 2 @Converter classes to load
2011-07-07 15:47:53,983 : Activator$BundleTypeConverterLoader$Loader.load : Found 0 @Converter classes to load
2011-07-07 15:47:54,047 : DefaultCamelContext.start : Total 0 routes, of which 0 is started.
2011-07-07 15:47:54,047 : DefaultCamelContext.start : Apache Camel  (CamelContext: org.ow2.jonas.sample.jonas-jaxrs-sample) started in 0.132 seconds
2011-07-07 15:47:54,048 : RouteBuilderComponent.start : Starting CAMEL context name for route org.ow2.jonas.sample.jonas-jaxrs-sample
2011-07-07 15:48:39,138 : ResourceUtils.checkMethodDispatcher : No resource methods have been found for resource class org.ow2.jonas.sample.jaxrs.api.ICustomerService
2011-07-07 16:10:04,228 : AbstractJAXRSFactoryBean.checkResources : No resource classes found
2011-07-07 16:10:04,229 : RouteBuilderComponent.start : Cannot start route jonas-jaxrs-sample-1.0-SNAPSHOT
org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:164)
	at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.<init>(CxfRsConsumer.java:38)
	at org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.createConsumer(CxfRsEndpoint.java:108)
	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)
	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:128)
	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1832)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1758)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1780)
	at org.apache.camel.impl.DefaultCamelContext.startRouteService(DefaultCamelContext.java:1667)
	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:708)
	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1643)
	at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:650)
	at org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:337)
	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:265)
	at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
	at org.ow2.jonas.camel.wrapper.CamelWrapper.addRoutes(CamelWrapper.java:158)
	at org.ow2.jonas.camel.service.impl.CamelService.__addRoutes(CamelService.java:229)
	at org.ow2.jonas.camel.service.impl.CamelService.addRoutes(CamelService.java)
	at org.ow2.jonas.camel.component.RouteBuilderComponent.start(RouteBuilderComponent.java:205)
	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.__start(ExampleCXF.java:73)
	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.start(ExampleCXF.java)
	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.apache.felix.ipojo.util.Callback.call(Callback.java:237)
	at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
	at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
	at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
	at org.apache.felix.ipojo.Extender.parse(Extender.java:269)
	at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
	at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
	at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
	at java.lang.Thread.run(Thread.java:619)
Caused by: javax.ws.rs.WebApplicationException
	at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:310)
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:116)
	... 42 more
2011-07-07 16:10:04,230 : LoggerService.log : [ERROR]  : [ExampleCXF-0] The callback method start has thrown an exception : null
org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:164)
	at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.<init>(CxfRsConsumer.java:38)
	at org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.createConsumer(CxfRsEndpoint.java:108)
	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)
	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:128)
	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1832)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1758)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1780)
	at org.apache.camel.impl.DefaultCamelContext.startRouteService(DefaultCamelContext.java:1667)
	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:708)
	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1643)
	at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:650)
	at org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:337)
	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:265)
	at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
	at org.ow2.jonas.camel.wrapper.CamelWrapper.addRoutes(CamelWrapper.java:158)
	at org.ow2.jonas.camel.service.impl.CamelService.__addRoutes(CamelService.java:229)
	at org.ow2.jonas.camel.service.impl.CamelService.addRoutes(CamelService.java)
	at org.ow2.jonas.camel.component.RouteBuilderComponent.start(RouteBuilderComponent.java:205)
	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.__start(ExampleCXF.java:73)
	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.start(ExampleCXF.java)
	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.apache.felix.ipojo.util.Callback.call(Callback.java:237)
	at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
	at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
	at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
	at org.apache.felix.ipojo.Extender.parse(Extender.java:269)
	at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
	at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
	at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
	at java.lang.Thread.run(Thread.java:619)
Caused by: javax.ws.rs.WebApplicationException
	at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:310)
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:116)
	... 42 more
2011-07-07 16:10:04,236 : LoggerService.log : [ERROR]  : null
java.lang.IllegalStateException
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:171)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
	at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
	at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
	at org.apache.felix.ipojo.Extender.parse(Extender.java:269)
	at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
	at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
	at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
	at java.lang.Thread.run(Thread.java:619)
{noformat}
--------------------------------------------------------

I suspect this has something to do with setting the adequate resource classes properly, but I'm kind of clueless right now.

  was:
I'm trying doing some testing to expose an OSGi/iPOJO component with a REST interface too. When I install the bundle on Camel-JOnAS, CXFRS can't build the route because it can't find any resource classes, even if I indicated it properly in the URI. To test, I'm using the classes found in https://svn.apache.org/repos/asf/camel/tags/camel-2.2.0/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/ and launching with the following one:

public class ExampleCXF extends RouteBuilderComponent {
    private static final String CXF_RS_ENDPOINT_URI =
            "cxfrs://http://localhost:9000/customerservice?resourceClasses=org.ow2.jonas.sample.jaxrs.api.ICustomerService";
    /**
     * The logger.
     */
    private Log logger = LogFactory.getLog(this.getClass());

    private ICamelService camelService;

    /**
     * HTTP port number.
     */
    private String httpPort = "9000";

    /**
     * Name of files exchanged in CXF. Used by the second route.
     */
    private Map<String, String> filenames = new HashMap<String, String> ();

    /**
     * Constructor: saves the BundleContext.
     */
    public ExampleCXF(final BundleContext bundleContext) {
        super(bundleContext);
    }


    /**
     * Adds the OSGi HTTP service port and the
     * <code>target/fileToHelloService</code> directory into
     * {@link RouteBuilderComponent#registryReplacements}, calls
     * {@link RouteBuilderComponent#start()} and launches a self-test.
     */
    @Override
    public void start() throws Throwable {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        System.out.println("Current thread class loader = " + cl);
        try{
            Thread.currentThread().setContextClassLoader(ExampleCXF.class.getClassLoader());
            System.out.println("Bundle class loader = " + ExampleCXF.class.getClassLoader());
            super.start();
        }finally {
            Thread.currentThread().setContextClassLoader(cl);
        }

    }

    @Override
    public void stop() throws Throwable {
        super.stop();
        logger.debug("Going down.");
    }

    /**
     * Add routes to the CAMEL context.
     */
    @Override
    public void configure() throws Exception {
        super.configure();
        from(CXF_RS_ENDPOINT_URI).process(new Processor() {

            public void process(Exchange exchange) throws Exception {
                Message inMessage = exchange.getIn();
                // Get the operation name from in message
                String operationName = inMessage.getHeader(CxfConstants.OPERATION_NAME, String.class);
                if ("getCustomer".equals(operationName)) {
                    String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
                    if(!"GET".equals(httpMethod)) {
                        throw new IllegalAccessException("Get a wrong http method");
                    }
                    String path = inMessage.getHeader(Exchange.HTTP_PATH, String.class);
                    // The parameter of the invocation is stored in the body of in message
                    String id = (String) inMessage.getBody(String.class);
                    if ("/customerservice/customers/126".equals(path)) {
                        Customer customer = new Customer();
                        customer.setId(Long.parseLong(id));
                        customer.setName("Willem");
                        // We just put the response Object into the out message body
                        exchange.getOut().setBody(customer);
                    } else {
                        if ("/customerservice/customers/123".equals(path)) {
                            // send a customer response back
                            Response r = Response.status(200).entity("customer response back!").build();
                            exchange.getOut().setBody(r);
                            return;
                        }
                        if ("/customerservice/customers/456".equals(path)) {
                            Response r = Response.status(404).entity("Can't found the customer with uri " + path).build();
                            throw new WebApplicationException(r);
                        } else {
                            throw new RuntimeCamelException("Can't found the customer with uri " + path);
                        }
                    }
                }
                if ("updateCustomer".equals(operationName)) {
                    if(!"header1;header2".equals(inMessage.getHeader("test"))) {
                        throw new IllegalAccessException("Get a wrong customer message header");
                    }
                    String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
                    if(!"PUT".equals(httpMethod)) {
                        throw new IllegalAccessException("Get a wrong http method");
                    }
                    Customer customer = inMessage.getBody(Customer.class);
                    if(customer != null) {
                        throw new IllegalAccessException("Customer should not be null");
                    }
                    // Now you can do what you want on the customer object
                    if(!"Mary".equals(customer.getName())) {
                        throw new IllegalAccessException("Get a wrong customer name.");
                    }
                    // set the response back
                    exchange.getOut().setBody(Response.ok().build());
                }

            }

        });

        
    }

}
--------------------------------------------------------------------
The ICustomerService it's just an interface containing all methods from the original CustomerService and its JAX-RS annotations. This CustomerService has been exposed as an OSGi component as follows:
<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="org.apache.felix.ipojo"
  xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/1.4.0/core.xsd">


  <component classname="org.ow2.jonas.sample.jaxrs.impl.ExampleCXF"
             name="ExampleCXF"
             public="false"
             immediate="true">

    <requires optional="false"
              specification="org.ow2.jonas.camel.service.api.ICamelService">
      <callback type="bind" method="setCamelService" />
    </requires>

    <callback transition="validate" method="start" />
    <callback transition="invalidate" method="stop" />
  </component>

  <instance component="ExampleCXF" />

</ipojo>
---------------------------------------------------------

And these are the import-exports:


Export-Package org.ow2.jonas.sample.jaxrs.api

Import-Package javax.ws.rs, \
               *

DynamicImport-Package org.apache.cxf.dosgi.dsw.qos, \
                      org.apache.cxf

Private-Package org.ow2.jonas.camel.component, \
                org.ow2.jonas.sample.jaxrs.impl
--------------------------------------------------------

Finally, the log and stack trace displayed on deployment:


2011-07-07 15:47:53,914 : CamelService.__startNewContext : Starting a new camel context
2011-07-07 15:47:53,915 : DefaultCamelContext.start : Apache Camel  (CamelContext: org.ow2.jonas.sample.jonas-jaxrs-sample) is starting
2011-07-07 15:47:53,915 : DefaultCamelContext.createManagementStrategy : JMX enabled. Using ManagedManagementStrategy.
2011-07-07 15:47:53,916 : DefaultManagementLifecycleStrategy.onContextStart : This CamelContext(org.ow2.jonas.sample.jonas-jaxrs-sample) will be registered using the name: org.ow2.jonas.sample.jonas-jaxrs-sample-171-2 due to clash with an existing name already registered in MBeanServer.
2011-07-07 15:47:53,958 : Activator$BundleTypeConverterLoader$Loader.load : Found 1 @Converter classes to load
2011-07-07 15:47:53,969 : Activator$BundleTypeConverterLoader$Loader.load : Found 13 @Converter classes to load
2011-07-07 15:47:53,980 : Activator$BundleTypeConverterLoader$Loader.load : Found 2 @Converter classes to load
2011-07-07 15:47:53,983 : Activator$BundleTypeConverterLoader$Loader.load : Found 0 @Converter classes to load
2011-07-07 15:47:54,047 : DefaultCamelContext.start : Total 0 routes, of which 0 is started.
2011-07-07 15:47:54,047 : DefaultCamelContext.start : Apache Camel  (CamelContext: org.ow2.jonas.sample.jonas-jaxrs-sample) started in 0.132 seconds
2011-07-07 15:47:54,048 : RouteBuilderComponent.start : Starting CAMEL context name for route org.ow2.jonas.sample.jonas-jaxrs-sample
2011-07-07 15:48:39,138 : ResourceUtils.checkMethodDispatcher : No resource methods have been found for resource class org.ow2.jonas.sample.jaxrs.api.ICustomerService
2011-07-07 16:10:04,228 : AbstractJAXRSFactoryBean.checkResources : No resource classes found
2011-07-07 16:10:04,229 : RouteBuilderComponent.start : Cannot start route jonas-jaxrs-sample-1.0-SNAPSHOT
org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:164)
	at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.<init>(CxfRsConsumer.java:38)
	at org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.createConsumer(CxfRsEndpoint.java:108)
	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)
	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:128)
	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1832)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1758)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1780)
	at org.apache.camel.impl.DefaultCamelContext.startRouteService(DefaultCamelContext.java:1667)
	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:708)
	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1643)
	at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:650)
	at org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:337)
	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:265)
	at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
	at org.ow2.jonas.camel.wrapper.CamelWrapper.addRoutes(CamelWrapper.java:158)
	at org.ow2.jonas.camel.service.impl.CamelService.__addRoutes(CamelService.java:229)
	at org.ow2.jonas.camel.service.impl.CamelService.addRoutes(CamelService.java)
	at org.ow2.jonas.camel.component.RouteBuilderComponent.start(RouteBuilderComponent.java:205)
	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.__start(ExampleCXF.java:73)
	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.start(ExampleCXF.java)
	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.apache.felix.ipojo.util.Callback.call(Callback.java:237)
	at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
	at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
	at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
	at org.apache.felix.ipojo.Extender.parse(Extender.java:269)
	at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
	at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
	at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
	at java.lang.Thread.run(Thread.java:619)
Caused by: javax.ws.rs.WebApplicationException
	at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:310)
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:116)
	... 42 more
2011-07-07 16:10:04,230 : LoggerService.log : [ERROR]  : [ExampleCXF-0] The callback method start has thrown an exception : null
org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:164)
	at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.<init>(CxfRsConsumer.java:38)
	at org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.createConsumer(CxfRsEndpoint.java:108)
	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)
	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:128)
	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1832)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1758)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1780)
	at org.apache.camel.impl.DefaultCamelContext.startRouteService(DefaultCamelContext.java:1667)
	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:708)
	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1643)
	at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:650)
	at org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:337)
	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:265)
	at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
	at org.ow2.jonas.camel.wrapper.CamelWrapper.addRoutes(CamelWrapper.java:158)
	at org.ow2.jonas.camel.service.impl.CamelService.__addRoutes(CamelService.java:229)
	at org.ow2.jonas.camel.service.impl.CamelService.addRoutes(CamelService.java)
	at org.ow2.jonas.camel.component.RouteBuilderComponent.start(RouteBuilderComponent.java:205)
	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.__start(ExampleCXF.java:73)
	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.start(ExampleCXF.java)
	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.apache.felix.ipojo.util.Callback.call(Callback.java:237)
	at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
	at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
	at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
	at org.apache.felix.ipojo.Extender.parse(Extender.java:269)
	at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
	at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
	at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
	at java.lang.Thread.run(Thread.java:619)
Caused by: javax.ws.rs.WebApplicationException
	at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:310)
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:116)
	... 42 more
2011-07-07 16:10:04,236 : LoggerService.log : [ERROR]  : null
java.lang.IllegalStateException
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:171)
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
	at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
	at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
	at org.apache.felix.ipojo.Extender.parse(Extender.java:269)
	at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
	at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
	at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
	at java.lang.Thread.run(Thread.java:619)
--------------------------------------------------------

I suspect this has something to do with setting the adequate resource classes properly, but I'm kind of clueless right now.


> CXFRS can't find my JAX-RS resource classes
> -------------------------------------------
>
>                 Key: CAMEL-4185
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4185
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.7.2
>         Environment: Ubuntu 10.10 | Server Camel-JOnAS 1.7.0
>            Reporter: Miguel González
>
> I'm trying doing some testing to expose an OSGi/iPOJO component with a REST interface too. When I install the bundle on Camel-JOnAS, CXFRS can't build the route because it can't find any resource classes, even if I indicated it properly in the URI. To test, I'm using the classes found in https://svn.apache.org/repos/asf/camel/tags/camel-2.2.0/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/ and launching with the following one:
> {code:title=ExampleCXF.java|borderStyle=solid}
> public class ExampleCXF extends RouteBuilderComponent {
>     private static final String CXF_RS_ENDPOINT_URI =
>             "cxfrs://http://localhost:9000/customerservice?resourceClasses=org.ow2.jonas.sample.jaxrs.api.ICustomerService";
>     /**
>      * The logger.
>      */
>     private Log logger = LogFactory.getLog(this.getClass());
>     private ICamelService camelService;
>     /**
>      * HTTP port number.
>      */
>     private String httpPort = "9000";
>     /**
>      * Name of files exchanged in CXF. Used by the second route.
>      */
>     private Map<String, String> filenames = new HashMap<String, String> ();
>     /**
>      * Constructor: saves the BundleContext.
>      */
>     public ExampleCXF(final BundleContext bundleContext) {
>         super(bundleContext);
>     }
>     /**
>      * Adds the OSGi HTTP service port and the
>      * <code>target/fileToHelloService</code> directory into
>      * {@link RouteBuilderComponent#registryReplacements}, calls
>      * {@link RouteBuilderComponent#start()} and launches a self-test.
>      */
>     @Override
>     public void start() throws Throwable {
>         ClassLoader cl = Thread.currentThread().getContextClassLoader();
>         System.out.println("Current thread class loader = " + cl);
>         try{
>             Thread.currentThread().setContextClassLoader(ExampleCXF.class.getClassLoader());
>             System.out.println("Bundle class loader = " + ExampleCXF.class.getClassLoader());
>             super.start();
>         }finally {
>             Thread.currentThread().setContextClassLoader(cl);
>         }
>     }
>     @Override
>     public void stop() throws Throwable {
>         super.stop();
>         logger.debug("Going down.");
>     }
>     /**
>      * Add routes to the CAMEL context.
>      */
>     @Override
>     public void configure() throws Exception {
>         super.configure();
>         from(CXF_RS_ENDPOINT_URI).process(new Processor() {
>             public void process(Exchange exchange) throws Exception {
>                 Message inMessage = exchange.getIn();
>                 // Get the operation name from in message
>                 String operationName = inMessage.getHeader(CxfConstants.OPERATION_NAME, String.class);
>                 if ("getCustomer".equals(operationName)) {
>                     String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
>                     if(!"GET".equals(httpMethod)) {
>                         throw new IllegalAccessException("Get a wrong http method");
>                     }
>                     String path = inMessage.getHeader(Exchange.HTTP_PATH, String.class);
>                     // The parameter of the invocation is stored in the body of in message
>                     String id = (String) inMessage.getBody(String.class);
>                     if ("/customerservice/customers/126".equals(path)) {
>                         Customer customer = new Customer();
>                         customer.setId(Long.parseLong(id));
>                         customer.setName("Willem");
>                         // We just put the response Object into the out message body
>                         exchange.getOut().setBody(customer);
>                     } else {
>                         if ("/customerservice/customers/123".equals(path)) {
>                             // send a customer response back
>                             Response r = Response.status(200).entity("customer response back!").build();
>                             exchange.getOut().setBody(r);
>                             return;
>                         }
>                         if ("/customerservice/customers/456".equals(path)) {
>                             Response r = Response.status(404).entity("Can't found the customer with uri " + path).build();
>                             throw new WebApplicationException(r);
>                         } else {
>                             throw new RuntimeCamelException("Can't found the customer with uri " + path);
>                         }
>                     }
>                 }
>                 if ("updateCustomer".equals(operationName)) {
>                     if(!"header1;header2".equals(inMessage.getHeader("test"))) {
>                         throw new IllegalAccessException("Get a wrong customer message header");
>                     }
>                     String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
>                     if(!"PUT".equals(httpMethod)) {
>                         throw new IllegalAccessException("Get a wrong http method");
>                     }
>                     Customer customer = inMessage.getBody(Customer.class);
>                     if(customer != null) {
>                         throw new IllegalAccessException("Customer should not be null");
>                     }
>                     // Now you can do what you want on the customer object
>                     if(!"Mary".equals(customer.getName())) {
>                         throw new IllegalAccessException("Get a wrong customer name.");
>                     }
>                     // set the response back
>                     exchange.getOut().setBody(Response.ok().build());
>                 }
>             }
>         });
>         
>     }
> }
> {code}
> --------------------------------------------------------------------
> The ICustomerService it's just an interface containing all methods from the original CustomerService and its JAX-RS annotations. This CustomerService has been exposed as an OSGi component as follows:
> {code:xml}
> <ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xmlns="org.apache.felix.ipojo"
>   xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/1.4.0/core.xsd">
>   <component classname="org.ow2.jonas.sample.jaxrs.impl.ExampleCXF"
>              name="ExampleCXF"
>              public="false"
>              immediate="true">
>     <requires optional="false"
>               specification="org.ow2.jonas.camel.service.api.ICamelService">
>       <callback type="bind" method="setCamelService" />
>     </requires>
>     <callback transition="validate" method="start" />
>     <callback transition="invalidate" method="stop" />
>   </component>
>   <instance component="ExampleCXF" />
> </ipojo>
> {code}
> ---------------------------------------------------------
> And these are the import-exports:
> {noformat}
> Export-Package org.ow2.jonas.sample.jaxrs.api
> Import-Package javax.ws.rs, \
>                *
> DynamicImport-Package org.apache.cxf.dosgi.dsw.qos, \
>                       org.apache.cxf
> Private-Package org.ow2.jonas.camel.component, \
>                 org.ow2.jonas.sample.jaxrs.impl}}
> {noformat}
> --------------------------------------------------------
> Finally, the log and stack trace displayed on deployment:
> {noformat}
> 2011-07-07 15:47:53,914 : CamelService.__startNewContext : Starting a new camel context
> 2011-07-07 15:47:53,915 : DefaultCamelContext.start : Apache Camel  (CamelContext: org.ow2.jonas.sample.jonas-jaxrs-sample) is starting
> 2011-07-07 15:47:53,915 : DefaultCamelContext.createManagementStrategy : JMX enabled. Using ManagedManagementStrategy.
> 2011-07-07 15:47:53,916 : DefaultManagementLifecycleStrategy.onContextStart : This CamelContext(org.ow2.jonas.sample.jonas-jaxrs-sample) will be registered using the name: org.ow2.jonas.sample.jonas-jaxrs-sample-171-2 due to clash with an existing name already registered in MBeanServer.
> 2011-07-07 15:47:53,958 : Activator$BundleTypeConverterLoader$Loader.load : Found 1 @Converter classes to load
> 2011-07-07 15:47:53,969 : Activator$BundleTypeConverterLoader$Loader.load : Found 13 @Converter classes to load
> 2011-07-07 15:47:53,980 : Activator$BundleTypeConverterLoader$Loader.load : Found 2 @Converter classes to load
> 2011-07-07 15:47:53,983 : Activator$BundleTypeConverterLoader$Loader.load : Found 0 @Converter classes to load
> 2011-07-07 15:47:54,047 : DefaultCamelContext.start : Total 0 routes, of which 0 is started.
> 2011-07-07 15:47:54,047 : DefaultCamelContext.start : Apache Camel  (CamelContext: org.ow2.jonas.sample.jonas-jaxrs-sample) started in 0.132 seconds
> 2011-07-07 15:47:54,048 : RouteBuilderComponent.start : Starting CAMEL context name for route org.ow2.jonas.sample.jonas-jaxrs-sample
> 2011-07-07 15:48:39,138 : ResourceUtils.checkMethodDispatcher : No resource methods have been found for resource class org.ow2.jonas.sample.jaxrs.api.ICustomerService
> 2011-07-07 16:10:04,228 : AbstractJAXRSFactoryBean.checkResources : No resource classes found
> 2011-07-07 16:10:04,229 : RouteBuilderComponent.start : Cannot start route jonas-jaxrs-sample-1.0-SNAPSHOT
> org.apache.cxf.service.factory.ServiceConstructionException
> 	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:164)
> 	at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.<init>(CxfRsConsumer.java:38)
> 	at org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.createConsumer(CxfRsEndpoint.java:108)
> 	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)
> 	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)
> 	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:128)
> 	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1832)
> 	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1758)
> 	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1780)
> 	at org.apache.camel.impl.DefaultCamelContext.startRouteService(DefaultCamelContext.java:1667)
> 	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:708)
> 	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1643)
> 	at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:650)
> 	at org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:337)
> 	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:265)
> 	at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
> 	at org.ow2.jonas.camel.wrapper.CamelWrapper.addRoutes(CamelWrapper.java:158)
> 	at org.ow2.jonas.camel.service.impl.CamelService.__addRoutes(CamelService.java:229)
> 	at org.ow2.jonas.camel.service.impl.CamelService.addRoutes(CamelService.java)
> 	at org.ow2.jonas.camel.component.RouteBuilderComponent.start(RouteBuilderComponent.java:205)
> 	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.__start(ExampleCXF.java:73)
> 	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.start(ExampleCXF.java)
> 	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.apache.felix.ipojo.util.Callback.call(Callback.java:237)
> 	at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
> 	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
> 	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
> 	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
> 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
> 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
> 	at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
> 	at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
> 	at org.apache.felix.ipojo.Extender.parse(Extender.java:269)
> 	at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
> 	at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
> 	at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: javax.ws.rs.WebApplicationException
> 	at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:310)
> 	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:116)
> 	... 42 more
> 2011-07-07 16:10:04,230 : LoggerService.log : [ERROR]  : [ExampleCXF-0] The callback method start has thrown an exception : null
> org.apache.cxf.service.factory.ServiceConstructionException
> 	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:164)
> 	at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.<init>(CxfRsConsumer.java:38)
> 	at org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.createConsumer(CxfRsEndpoint.java:108)
> 	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)
> 	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)
> 	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:128)
> 	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1832)
> 	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1758)
> 	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1780)
> 	at org.apache.camel.impl.DefaultCamelContext.startRouteService(DefaultCamelContext.java:1667)
> 	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:708)
> 	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1643)
> 	at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:650)
> 	at org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:337)
> 	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:265)
> 	at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
> 	at org.ow2.jonas.camel.wrapper.CamelWrapper.addRoutes(CamelWrapper.java:158)
> 	at org.ow2.jonas.camel.service.impl.CamelService.__addRoutes(CamelService.java:229)
> 	at org.ow2.jonas.camel.service.impl.CamelService.addRoutes(CamelService.java)
> 	at org.ow2.jonas.camel.component.RouteBuilderComponent.start(RouteBuilderComponent.java:205)
> 	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.__start(ExampleCXF.java:73)
> 	at org.ow2.jonas.sample.jaxrs.impl.ExampleCXF.start(ExampleCXF.java)
> 	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.apache.felix.ipojo.util.Callback.call(Callback.java:237)
> 	at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
> 	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
> 	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
> 	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
> 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
> 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
> 	at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
> 	at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
> 	at org.apache.felix.ipojo.Extender.parse(Extender.java:269)
> 	at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
> 	at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
> 	at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: javax.ws.rs.WebApplicationException
> 	at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:310)
> 	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:116)
> 	... 42 more
> 2011-07-07 16:10:04,236 : LoggerService.log : [ERROR]  : null
> java.lang.IllegalStateException
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:171)
> 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
> 	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
> 	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
> 	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
> 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
> 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
> 	at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
> 	at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
> 	at org.apache.felix.ipojo.Extender.parse(Extender.java:269)
> 	at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
> 	at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
> 	at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
> 	at java.lang.Thread.run(Thread.java:619)
> {noformat}
> --------------------------------------------------------
> I suspect this has something to do with setting the adequate resource classes properly, but I'm kind of clueless right now.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message