Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Talend ESB 7.1.1.20181026_1147
My route doesn't work when I try to use a Bean in Resource Class within a cREST component. Here's the error :
org.apache.camel.FailedToCreateRouteException: Failed to create route test4_cREST_1: Route(test4_cREST_1)[[From[cxfrs://http://127.0.0.1:xxxxxx@0... because of Failed to resolve endpoint: cxfrs://http://127.0.0.1:8191/testAPI?cxfRsEndpointConfigurer=%23endpointConfigurer_cREST_1&features=%23features_cREST_1&inInterceptors=%23inInterceptors_cREST_1&loggingFeatureEnabled=false&outInterceptors=%23outInterceptors_cREST_1&properties=%23properties_cREST_1&providers=%23providers&resourceClasses=minsoc.test4_0_1.test4%24Service_cREST_1 due to: minsoc.test4_0_1.test4$Service_cREST_1 org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route test4_cREST_1: Route(test4_cREST_1)[[From[cxfrs://http://127.0.0.1:xxxxxx@0... because of Failed to resolve endpoint: cxfrs://http://127.0.0.1:8191/testAPI?cxfRsEndpointConfigurer=%23endpointConfigurer_cREST_1&features=%23features_cREST_1&inInterceptors=%23inInterceptors_cREST_1&loggingFeatureEnabled=false&outInterceptors=%23outInterceptors_cREST_1&properties=%23properties_cREST_1&providers=%23providers&resourceClasses=minsoc.test4_0_1.test4%24Service_cREST_1 due to: minsoc.test4_0_1.test4$Service_cREST_1 at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1830) at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136) at org.apache.camel.main.Main.doStart(Main.java:139) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.main.MainSupport.run(MainSupport.java:170) at minsoc.test4_0_1.test4.run(test4.java:385) at minsoc.test4_0_1.test4.runJobInTOS(test4.java:482) at minsoc.test4_0_1.test4.main(test4.java:452) Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route test4_cREST_1: Route(test4_cREST_1)[[From[cxfrs://http://127.0.0.1:xxxxxx@0... because of Failed to resolve endpoint: cxfrs://http://127.0.0.1:8191/testAPI?cxfRsEndpointConfigurer=%23endpointConfigurer_cREST_1&features=%23features_cREST_1&inInterceptors=%23inInterceptors_cREST_1&loggingFeatureEnabled=false&outInterceptors=%23outInterceptors_cREST_1&properties=%23properties_cREST_1&providers=%23providers&resourceClasses=minsoc.test4_0_1.test4%24Service_cREST_1 due to: minsoc.test4_0_1.test4$Service_cREST_1 at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:209) at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1145) at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3731) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3445) at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209) at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3253) at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249) at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3272) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3249) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3165) at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) ... 6 more Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: cxfrs://http://127.0.0.1:8191/testAPI?cxfRsEndpointConfigurer=%23endpointConfigurer_cREST_1&features=%23features_cREST_1&inInterceptors=%23inInterceptors_cREST_1&loggingFeatureEnabled=false&outInterceptors=%23outInterceptors_cREST_1&properties=%23properties_cREST_1&providers=%23providers&resourceClasses=minsoc.test4_0_1.test4%24Service_cREST_1 due to: minsoc.test4_0_1.test4$Service_cREST_1 at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:758) at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:80) at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:219) at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:115) at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:121) at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:69) at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:97) at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1283) at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:204) ... 17 more Caused by: java.lang.ClassNotFoundException: minsoc.test4_0_1.test4$Service_cREST_1 at org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:80) at org.apache.camel.component.cxf.jaxrs.CxfRsComponent.createEndpoint(CxfRsComponent.java:111) at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:126) at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:711) ... 25 more
Here is my bean :
package beans; import org.apache.camel.CamelContext; import org.apache.cxf.jaxrs.ext.multipart.MultipartBody; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.Consumes; public interface test_insee { @javax.ws.rs.Path("/siren/{siren}") @javax.ws.rs.GET() @javax.ws.rs.Produces({"application/xml"}) Object getSiren( @javax.ws.rs.PathParam("siren") String siren); @javax.ws.rs.Path("/siren/{siren}/{debut}/{nombre}") @javax.ws.rs.GET() @javax.ws.rs.Produces({"application/xml"}) Object getEtabs( @javax.ws.rs.PathParam("siren") String siren, @javax.ws.rs.PathParam("debut") String debut, @javax.ws.rs.PathParam("nombre") String nombre); @javax.ws.rs.Path("/siret/{siret}") @javax.ws.rs.GET() @javax.ws.rs.Produces({"application/xml"}) Object getSiret( @javax.ws.rs.PathParam("siret") String siret); @javax.ws.rs.Path("/test/{uid_agrement}/pieces_jointes/") @javax.ws.rs.POST() @javax.ws.rs.Consumes({ "multipart/form-data" }) @javax.ws.rs.Produces("application/json; charset=UTF-8") Object postPieceJointe( @javax.ws.rs.PathParam("uid_organisme") String uid_organisme, MultipartBody payload); }
And here my simple route.
We have the exact same problem. so bump. Anxious to see the answer
Hello,
What's your main goal? Do you want to create a Resource Class to call a REST service?
Best regards
Sabrina
Hello Sabrina, thanks for replying,
My Resource Class is already created (The bean I embedded in the post). My main goal is to consume a POST request of form Multipart. I know the component cREST has this option if I choose the type "Manual", the problem is that this way consumes an object of type org.w3c.dom.Document and I want to consume another object, in this case of type org.apache.cxf.jaxrs.ext.multipart.MultipartBody, that's why I'm using my Bean in the Resource Class.
It's weird, because the same route works in Talend ESB version 6.3.2.20170902_1316.