1 2 Previous Next 25 Replies Latest reply on Oct 15, 2012 3:27 PM by Anton Nikulin

    Camel Rest binding JSON

    Anton Nikulin Newbie

      i have such issue.

       

       

      I have Camel-REST-binding in my switchyard.xml

      <sca:service name="OrderServiceREST" promote="OrderServiceBean/OrderService">

            <sca:interface.java interface="com.magick.trade_service.service.OrderService"/>

                  <camel:binding.camel configURI="cxfrs://http://localhost:18001/order?resourceClasses=com.magick.trade_service.service.OrderResource"/>

      </sca:service>

       

      It's works well with XML requests, but it can't parse JSON ones. And deploying app on the server I have such warning:

      01:51:33,987 INFO  [org.apache.cxf.jaxrs.provider.ProviderFactory] (MSC service thread 1-6) Problem with setting the default provider org.apache.cxf.jaxrs.provider.JSONProviderorg/codehaus/jettison/mapped/TypeConverter
      what should i do it can be able to transform JSON requests?

       

      Can you help me please?

        • 1. Re: Camel Rest binding JSON
          Magesh Bojan Master

          We have not completely tested the JSON provider compatibility and usage. Hence it has not been enabled in SwitchYard configuration. The error message indicates that there is no Provider implemnetation in the classpath. Although you can add it in the module definition, it may not work properly. I have created this JIRA for adding JSON support. Meanwhile, you can try our RESTEasy binding that comes with default support for JSON.

          • 2. Re: Camel Rest binding JSON
            Anton Nikulin Newbie

            And could I make some transformer which will transform data from JSON to XML and insert it in SwitchYard?

            • 3. Re: Camel Rest binding JSON
              Keith Babo Master

              Are you using something specific in the Camel CXF component that would prevent you from using the RESTEasy gateway?  In that case, you can use JSON straight away and you don't have to convert to XML at all.

              • 4. Re: Camel Rest binding JSON
                Anton Nikulin Newbie

                I tried to use RESTeasy binding, but had some issues with this and used Camel CXF. OK, if RESTeasy can use JSON, i'd try to integrate it once more. Thanks.

                • 5. Re: Camel Rest binding JSON
                  Keith Babo Master

                  If you run into issues using the RESTEasy binding then we definitely want to hear about them. :-)

                  • 6. Re: Camel Rest binding JSON
                    Anton Nikulin Newbie

                    When I'm trying to deploy rest-binding example, in console i can see smth like that:

                     

                    05:43:18,206 INFO  [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-7) Route: direct:{urn:switchyard-quickstart:resteasy-binding:1.0}Warehouse started and consuming from: Endpoint[direct://%7Burn:switchyard-quickstart:resteasy-binding:1.0%7DWarehouse]

                    05:43:18,429 INFO  [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-7) Route: direct:{urn:switchyard-quickstart:resteasy-binding:1.0}OrderService started and consuming from: Endpoint[direct://%7Burn:switchyard-quickstart:resteasy-binding:1.0%7DOrderService]

                    05:43:18,555 INFO  [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-7) Route: direct:{urn:switchyard-quickstart:resteasy-binding:1.0}WarehouseService started and consuming from: Endpoint[direct://%7Burn:switchyard-quickstart:resteasy-binding:1.0%7DWarehouseService

                     

                    However, when I try to run test using mvn exec:java -Dexec.args="new"  as in reedme said, i have

                     

                    <html><head><title>JBoss Web/7.0.13.Final - Error report</title><style><!--H1 {f

                    ont-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-siz

                    e:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#5

                    25D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;backg

                    round-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;c

                    olor:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color

                    :white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;backgro

                    und:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}H

                    R {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /rest-binding

                    /order</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>

                    message</b> <u>/rest-binding/order</u></p><p><b>description</b> <u>The requested

                    resource (/rest-binding/order) is not available.</u></p><HR size="1" noshade="n

                    oshade"><h3>JBoss Web/7.0.13.Final</h3></body></html>

                     

                    instead of <order><orderId>1</orderId></order>.

                    • 7. Re: Camel Rest binding JSON
                      Magesh Bojan Master

                      Could you attach the complete log of this deployment? My guess is that the RESTEasy component has not been enabled. A snapshot of your standlone.xml or the config that you have started up, could also help.

                      • 8. Re: Camel Rest binding JSON
                        Anton Nikulin Newbie

                        Yes, you're right. I didn't have properly configured RESTeasy component.
                        Thanks a lot.

                        • 9. Re: Camel Rest binding JSON
                          Anton Nikulin Newbie

                          I successfully integrated with RESTeasy component, but now I have another problem.
                          Please, can you help me with it?

                           

                          I still want to receive data in REST binding through JSON. I have such POJO JAXB annotation class:

                           

                           

                          @XmlAccessorType(XmlAccessType.FIELD)

                          @XmlRootElement(name = "item")

                          public class Item {

                           

                           

                              @XmlElement(name = "itemId")

                              private Integer itemId;

                              @XmlElement(name = "name")

                              private String name;

                           

                           

                              public Item() {

                              }

                           

                           

                              public Item(Integer itemId, String name) {

                                  itemId = itemId;

                                  name = name;

                              }

                           

                           

                              public Integer getItemId() {

                                  return itemId;

                              }

                           

                           

                              public void setItemId(Integer itemId) {

                                  itemId = itemId;

                              }

                           

                           

                              public String getName() {

                                  return name;

                              }

                           

                           

                              public void setName(String name) {

                                  name = name;

                              }

                           

                          }

                           

                          and such JAX-RS annotated interface


                          @Path("/order")

                          public interface OrderResource {

                           

                           

                              @POST

                              @Path("/")

                              public void getOrder(Item item);

                          }

                           

                          But when I deploy this app to AS7 and try to send

                          {

                          "item": {"itemId":"1",

                                       "name": "Hydrogen Atom"

                                      }

                          }

                           

                          I have such exception:

                          02:01:58,015 WARN  [org.jboss.resteasy.core.SynchronousDispatcher] (http-localhost-127.0.0.1-8080-1) Failed executing POST /order/: org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException: javax.xml.bind.UnmarshalException

                          - with linked exception:

                          [org.xml.sax.SAXParseException: Content is not allowed in prolog.]

                                    at org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.readFrom(AbstractJAXBProvider.java:125) [resteasy-jaxb-provider-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:105) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.read(GZIPDecodingInterceptor.java:61) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:108) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:169) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:124) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:147) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar:]

                                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

                                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

                                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

                                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

                                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

                                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

                                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

                                    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

                                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

                                    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]

                          Caused by: javax.xml.bind.UnmarshalException

                          - with linked exception:

                          [org.xml.sax.SAXParseException: Content is not allowed in prolog.]

                                    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:314) [jboss-jaxb-api_2.2_spec-1.0.3.Final.jar:1.0.3.Final]

                                    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:526) [jaxb-impl-2.2.4.jar:2.2.4]

                                    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:223) [jaxb-impl-2.2.4.jar:2.2.4]

                                    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:189) [jaxb-impl-2.2.4.jar:2.2.4]

                                    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:136) [jboss-jaxb-api_2.2_spec-1.0.3.Final.jar:1.0.3.Final]

                                    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:104) [jboss-jaxb-api_2.2_spec-1.0.3.Final.jar:1.0.3.Final]

                                    at org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.readFrom(AbstractJAXBProvider.java:121) [resteasy-jaxb-provider-2.3.2.Final.jar:]

                                    ... 28 more

                          Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.

                                    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:175) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:394) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:322) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:281) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.impl.XMLScanner.reportFatalError(XMLScanner.java:1459) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:870) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:555) [xercesImpl-2.9.1-jbossas-1.jar:]

                                    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:217) [jaxb-impl-2.2.4.jar:2.2.4]

                                    ... 32 more

                           

                          However when I send the dame message in XML format, everything is OK.

                           

                          Thanks

                          • 10. Re: Camel Rest binding JSON
                            Magesh Bojan Master

                            You can use @Consumes and @Produces annotations. You can declare it at class level or fine tune at method level

                            @Consumes("application/json")
                            @Produces("application/json")
                            
                            • 11. Re: Camel Rest binding JSON
                              Anton Nikulin Newbie

                              Thanks a lot for help.

                               

                              Unfortunatelly I have once more issue. I have Date field in POJO file and want it to be deserialized with my class. I added such annotations

                               

                              @JsonProperty

                                        @JsonDeserialize(using = JsonDateDeserializer.class)

                                        @XmlElement(name = "expiration")

                              and created appropriate class:

                              import java.io.IOException;

                              import java.text.ParseException;

                              import java.text.SimpleDateFormat;

                              import java.util.Date;

                               

                               

                              import org.codehaus.jackson.JsonParser;

                              import org.codehaus.jackson.JsonProcessingException;

                              import org.codehaus.jackson.map.DeserializationContext;

                              import org.codehaus.jackson.map.JsonDeserializer;

                               

                               

                              public class JsonDateDeserializer extends JsonDeserializer<Date> {

                               

                               

                                        @Override

                                        public Date deserialize(JsonParser jp, DeserializationContext ctxt)

                                                            throws IOException, JsonProcessingException {

                                                  SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

                                                  String date = jp.getText();

                                                  try {

                                                            return format.parse(date);

                                                  } catch (ParseException e) {

                                                            e.printStackTrace();

                                                            throw new RuntimeException(e);

                                                  }

                                        }

                               

                               

                              }

                              However when I try to deploy it on server I have such exception:

                              23:40:22,855 WARN  [org.jboss.modules] (MSC service thread 1-5) Failed to define class com.magick.trade_service.service.transformer.JsonDateDeserializer in Module "deployment.tradeservice.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/magick/trade_service/service/transformer/JsonDateDeserializer (Module "deployment.tradeservice.jar:main" from Service Module Loader)

                                        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)

                                        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)

                                        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)

                                        at org.jboss.modules.Module.loadModuleClass(Module.java:517)

                                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                                        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.weld.bootstrap.BeanDeployer.loadClass(BeanDeployer.java:98) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:77) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:123) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:349) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.as.weld.services.WeldService.start(WeldService.java:76) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]

                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]

                                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]

                              Caused by: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonDeserializer

                                        at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_30]

                                        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_30]

                                        at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_30]

                                        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_30]

                                        at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

                                        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)

                                        ... 21 more

                              Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonDeserializer from [Module "deployment.tradeservice.jar:main" from Service Module Loader]

                                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                                        ... 27 more

                               

                               

                              23:40:22,901 INFO  [org.jboss.weld.ClassLoading] (MSC service thread 1-5) WELD-000119 Not generating any bean definitions from com.magick.trade_service.service.transformer.JsonDateDeserializer because of underlying class loading error

                              23:40:22,904 INFO  [org.jboss.weld.ClassLoading] (MSC service thread 1-5) catching: org.jboss.weld.resources.spi.ResourceLoadingException: java.lang.ClassNotFoundException: com.magick.trade_service.service.transformer.JsonDateDeserializer from [Module "deployment.tradeservice.jar:main" from Service Module Loader]

                                        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:74) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.weld.bootstrap.BeanDeployer.loadClass(BeanDeployer.java:98) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:77) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:123) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:349) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.as.weld.services.WeldService.start(WeldService.java:76) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]

                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]

                                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]

                              Caused by: java.lang.ClassNotFoundException: com.magick.trade_service.service.transformer.JsonDateDeserializer from [Module "deployment.tradeservice.jar:main" from Service Module Loader]

                                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                                        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        ... 12 more

                               

                               

                              23:40:22,938 WARN  [org.jboss.modules] (MSC service thread 1-5) Failed to define class com.magick.trade_service.service.transformer.JsonDateSerializer in Module "deployment.tradeservice.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/magick/trade_service/service/transformer/JsonDateSerializer (Module "deployment.tradeservice.jar:main" from Service Module Loader)

                                        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)

                                        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)

                                        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)

                                        at org.jboss.modules.Module.loadModuleClass(Module.java:517)

                                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                                        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.weld.bootstrap.BeanDeployer.loadClass(BeanDeployer.java:98) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:77) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:123) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:349) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.as.weld.services.WeldService.start(WeldService.java:76) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]

                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]

                                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]

                              Caused by: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonSerializer

                                        at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_30]

                                        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_30]

                                        at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_30]

                                        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_30]

                                        at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

                                        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)

                                        ... 21 more

                              Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonSerializer from [Module "deployment.tradeservice.jar:main" from Service Module Loader]

                                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                                        ... 27 more

                               

                               

                              23:40:22,997 INFO  [org.jboss.weld.ClassLoading] (MSC service thread 1-5) WELD-000119 Not generating any bean definitions from com.magick.trade_service.service.transformer.JsonDateSerializer because of underlying class loading error

                              23:40:22,999 INFO  [org.jboss.weld.ClassLoading] (MSC service thread 1-5) catching: org.jboss.weld.resources.spi.ResourceLoadingException: java.lang.ClassNotFoundException: com.magick.trade_service.service.transformer.JsonDateSerializer from [Module "deployment.tradeservice.jar:main" from Service Module Loader]

                                        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:74) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.weld.bootstrap.BeanDeployer.loadClass(BeanDeployer.java:98) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:77) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:123) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:349) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                                        at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.as.weld.services.WeldService.start(WeldService.java:76) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]

                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]

                                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]

                              Caused by: java.lang.ClassNotFoundException: com.magick.trade_service.service.transformer.JsonDateSerializer from [Module "deployment.tradeservice.jar:main" from Service Module Loader]

                                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                                        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                                        ... 12 more

                              Server has module with JsonSerializer class.

                               


                              Thanks,

                              • 12. Re: Camel Rest binding JSON
                                Magesh Bojan Master

                                I have created this JIRA to fix this issue. Meanwhile, you can manually add the module dependency to org/switchyard/component/resteasy/main/module.xml

                                <module xmlns="urn:jboss:module:1.0" name="org.switchyard.component.resteasy">
                                
                                
                                    <resources>
                                        <resource-root path="switchyard-component-resteasy-0.6.0-SNAPSHOT.jar"/>
                                    </resources>
                                
                                
                                    <dependencies>
                                        <module name="javax.api"/>
                                ...
                                        <module name="org.jboss.resteasy.resteasy-jackson-provider"/>
                                        <module name="org.codehaus.jackson.jackson-mapper-asl"/>
                                ...
                                    </dependencies>
                                </module>
                                
                                

                                • 13. Re: Camel Rest binding JSON
                                  Magesh Bojan Master

                                  You could also try this syntax that would automatically export the dependencies from that module

                                  <module name="org.jboss.resteasy.resteasy-jackson-provider" export="true"/>
                                  
                                  • 14. Re: Camel Rest binding JSON
                                    Magesh Bojan Master

                                    Anton,

                                     

                                    Could you also mark the posts that helped you, so that other community members can benefit from the same?

                                    1 2 Previous Next