Ich habe folgende APIS mit CXF REST Service und Apache Camel implementiert.Aufruf eines REST-Dienstes in einem anderen REST-Dienst (Apache Camel)
Beide diese APIs sind von POST
Typ und wird json
Eingabe akzeptieren.
- Erster API wird ein einzelnes
json
Objekt nehmen und einige Aktionen auf der Durchführung undjson
aktualisiert zurückzukehren. - Zweite API soll ein
json
Array von Objekten des vorherigen Typs nehmen und erste API für jedes Objekt im Array aufrufen.
Hier finden Sie meine Kamelroute für die zweite API.
Leider erhalte ich einen Fehler beim Aufruf der ersten API innerhalb der hier geteilten Kamelroute.
die Stapelüberwachung ist wie folgt:
Fehlgeschlagen Lieferung (Meldungs: ID-localhost-35741-1477139495717-17-3 auf ExchangeID: ID-localhost-35741-1477139495717-17-4) . Erschöpft nach Zustellungsversuch: 1 abgefangen: java.lang.IllegalArgumentException: Ungültige uri:/api/listAction/api/listAction. Wenn Sie Forwarding/Überbrückung http Endpunkte sind, dann aktivieren Sie die Option bridgeEndpoint auf dem Endpunkt: Endpunkt [http://localhost:9090/api/compute]
Nachrichtenverlauf -------------------- -------------------------------------------------- -------------------------------------------------- --------------- RouteId ProcessorId
Verstrichene Zeit (ms) [listActionRoute] [listActionRoute] [direct-vm: // listAction-service
] [957] [demoRoute] [log39] [log
] [70] [demoRoute] [recipientList17] [recipientList [einfach {direct-vm: $ {heade r.operationName} -Dienst}]
] [887] [listActionRoute] [log35] [log
] [846] [listActionRoute] [setBody15] [setBody [simple {$ {body [0]}}]
] [1] [listActionRoute] [bean10] [bean [[email protected]]
] [12] [listActionRoute] [loop8] [loop [simple {$ {}} Body.Size ]
] [23] [listActionRoute] [log36] [log
] [1] [listActionRoute] [setBody16] [setBody [simple {$ {body [$ {property.CamelLoopIndex}]}}]
] [ 2] [listActionRoute] [log37] [log
] [1] [listActionRoute] [marshal17] [marshal [org.apache.camel.model.dataformat.JsonDataFormat @ 74104d19]
] [2] [listActionRoute] [setHeader26] [setHeader [CamelHttpMethod]
] [1] [listActionRoute] [recipientList16] [recipientList [simple {http://localhost:9090/api/compute}]
] [15]Austausch --------------------------------------------- -------------------------------------------------- ---------------------------------------- Exchange [Id ID-localhost-35741-1477139495717 -17-4 ExchangePattern InOut Headers
{accept = text/html, application/XHTML + xml, application/xml; q = 0,9, /; q = 0,8, accept-encoding = gzip, abzulassen, Accept-Language = en-US, DE; q = 0,5, breadcrumbId = ID-localhost-35741-1477139495717-18-1, CamelAcceptContentType = text /html,application/xhtml+xml,application/xml;q=0.9, /; q = 0,8, CamelCxfMessage = {org.apache.cxf.message.MessageFIXED_PARAMETER_ORDER = false, org.apache.cxf.resource. method = public java.lang.String com.demo.endpoints.DemoResource.listAction (java.util.List), http://base.path = http://localhost:9091, HTTP.REQUEST = (POST /api/listAction) @ 585231269 org .eclipse.jetty.server.Request @ 22e1eba5, org.apache.cxf.transport.Destination = org.apache.cxf .transport.http_jetty.JettyHTTPDestination @ 26de7b21, HTTP.CONFIG = null, jaxrs.template.parameters = {FINAL_MATCH_GROUP = [/]}, org.apache.cxf.message.Message.QUERY_STRING = null, org.apache. cxf.jaxrs.model.OperationResourceInfoStack = [[email protected]], org.apache.cxf.message.Message.ENCODING = ISO-8859-1, HTTP.CONTEXT = ServletContext @ oejshContextHandler {, null}, Inhaltstyp = application/json, org.apache.cxf.security.Security[email protected]7f64c12c, org.apache.cxf.continuations .ContinuationProvider = org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider @ 5275a1a6, org.apache.cxf.message.Message.PROTOCOL_ Headers = {accept = [text/html, application/XHTML + xml, application/xml; q = 0,9, /; q = 0,8], accept-encoding = [gzip, abzulassen], Accept-Language = [en -US, en; q = 0,5], Verbindung = [Keep-alive], Content-Length = [120], content-type = [application/json], Host = [localhost: 9091], User-Agent = [Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv: 49,0) Gecko/20100101 Firefox/49,0]}, org.apache.cxf.request.url = http://localhost:9091/api/listAction, accept = text/html, application/XHTML + xml, application/xml; q = 0,9, /; q = 0,8, org.apache.cxf.request.uri =/api/listaction, org.apache.cxf.message.Message.PATH_INFO =/api/listaction, org.apache.cxf.transport.https .CertConstraints = null, HTTP.RESPONSE = HTTP/1,1 200, org.apache.cxf.request.method = POST, org.apache.cxf.async.post.response.dispatch = true, org .apache.cxf.message.Message.IN_INTERCEPTORS = [org.apache.cxf.transport.https.CertConstraintsI nterceptor @ 55180f7], HTTP_CONTEXT_MATCH_STRATEGY = Stamm, http.service.redirection = null, path_to_match_slash =/api/listaction, org.apache.cxf.configuration.security.AuthorizationPolicy = null}, CamelCxfRsOperationResourceInfoStack = [org.apache. [email protected]], CamelCxfRsResponseClass = class java.lang.String, CamelCxfRsResponseGenericType = Klasse java.lang.String, CamelHttpCharacterEncoding = ISO-8859-1, CamelHttpMethod = POST, CamelHttpPath =/api/listaction, CamelHttpUri =/api/listaction, CamelRedelivered = false, CamelRedeliveryCounter = 0, Verbindung = keep-alive, Content-Length = 120, Inhaltstyp = application/json, Host = localhost: 9091, OperationName = ListeAction, User-Agent = Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv: 49.0) Gecko/20100101 Firefox/49,0} Körperbau
byte [] body { "name": "Herr XYZ Herr", "Gehalt": 100,0}]Stacktrace
java.lang.IllegalArgumentException: Ungültige uri:/api/listAction/api/listAction. Wenn Sie weiterleiten/Überbrückung http Endpunkte, dann aktivieren Sie die bridgeEndpoint Option auf dem Endpunkt: Endpoint [http://localhost:9090/api/compute]
Kann jemand mir helfen, zu verstehen, warum bin ich diesen Fehler und wie dieses Problem zu lösen?
Das löste das Problem. Vielen Dank. – niyasc
cool, froh, dass es dein Problem gelöst hat. –