servicemix 4.3.2 骆驼 cxf 生产者到 cxf-nmr 消费者不工作
我一直在尝试使用camel cxf 生产者让两个单独的包通过 nmr 端点进行通信。我整个星期都在研究这个问题,但到目前为止我还无法让它发挥作用。
然而,我可以像 cxf-camel-nmr 示例一样使用所有 nmr 端点,没有问题,所以我知道该捆绑包没问题。说真的,这是一个超级简单的 hello world 原型,但我无法让它工作。
任何帮助或建议都会很棒!
环境:Java 1.5 Apache Servicemix 4.3.2(原始安装)
在 servicemix 中,我有两个单独的 osgi 包。我无法让我的camel cxf 生产者成功调用 nmr 端点,并且对如何修复的线索为零。
Bundle #1 cxf-nmr //消费者
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/transport/nmr/cxf-transport-nmr.xml" />
<jaxws:endpoint id="helloWorld1"
implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
address="nmr:HelloWorld1" />
</beans>
Bundle #2 //生产者
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://servicemix.apache.org/http/1.0 http://servicemix.apache.org/http/1.0/servicemix-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/transport/nmr/cxf-transport-nmr.xml" />
<import resource="classpath:org/apache/servicemix/camel/nmr/camel-nmr.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxf:bean:testEndpoint"/>
<to uri="nmr:HelloWorld1"/>
</route>
</camel:camelContext>
<cxf:cxfEndpoint
id="testEndpoint"
address="http://localhost:9090/test"
serviceClass="org.apache.servicemix.examples.cxf.HelloWorld">
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD" />
</cxf:properties>
</cxf:cxfEndpoint>
</beans>
--
#################
soap request response
#################
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:sayHi xmlns:m="http://cxf.examples.servicemix.apache.org/">
<arg0>foobar</arg0>
</m:sayHi>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
STATUS: 500
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>java.lang.NullPointerException</faultstring></soap:Fault></soap:Body></soap:Envelope>
--
####################
Console Output - No Idea How To Fix
####################
18:56:04,544 | ERROR | oWorld1-thread-1 | NMRDestination | - - | error preparing message
java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]
at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]
18:56:04,547 | WARN | oWorld1-thread-1 | NMR | 83 - org.apache.servicemix.nmr.core - 1.4.0 | Error processing exchange [
id: a778d16c-2955-41de-89e8-7775f4f976bf
mep: InOut
status: Active
role: Provider
target: PropertyMatchingReference[{NAME=HelloWorld1}]
properties: [
jaxwsContext = {javax.xml.ws.wsdl.operation={http://cxf.examples.servicemix.apache.org/}sayHi, javax.xml.ws.wsdl.description=http://localhost:9090/test?wsdl, javax.xml.ws.wsdl.service={http://cxf.examples.servicemix.apache.org/}HelloWorldService, javax.xml.ws.wsdl.interface={http://cxf.examples.servicemix.apache.org/}HelloWorld, javax.xml.ws.wsdl.port={http://cxf.examples.servicemix.apache.org/}HelloWorldPort}
CamelToEndpoint = nmr://HelloWorld1
org.apache.cxf.service.model.BindingOperationInfo = [BindingOperationInfo: {http://cxf.examples.servicemix.apache.org/}sayHi]
mtom-enabled = false
CamelCreatedTimestamp = Thu Jun 09 18:56:04 PDT 2011
CamelCXFDataFormat = PAYLOAD
]
]
org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:151)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]
at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]
Caused by: java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
... 6 more
18:56:04,552 | ERROR | f2d4607-thread-1 | DefaultErrorHandler | 68 - org.apache.camel.camel-core - 2.6.0 | Failed delivery for exchangeId: ID-Dana-PC-45880-1307670949817-0-2. Exhausted after delivery attempt: 1 caught: org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException
org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:151)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]
at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]
Caused by: java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
... 6 more
18:56:04,553 | WARN | qtp407691725-242 | PhaseInterceptorChain | - - | Interceptor for {http://cxf.examples.servicemix.apache.org/}HelloWorldService#{http://cxf.examples.servicemix.apache.org/}sayHi has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: java.lang.NullPointerException
at org.apache.camel.component.cxf.CxfConsumer$1.checkFailure(CxfConsumer.java:219)[118:org.apache.camel.camel-cxf:2.6.0]
at org.apache.camel.component.cxf.CxfConsumer$1.setResponseBack(CxfConsumer.java:196)[118:org.apache.camel.camel-cxf:2.6.0]
at org.apache.camel.component.cxf.CxfConsumer$1.asyncInvoke(CxfConsumer.java:116)[118:org.apache.camel.camel-cxf:2.6.0]
at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:73)[118:org.apache.camel.camel-cxf:2.6.0]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:224)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:70)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:311)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:280)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[116:org.apache.cxf.bundle:2.3.2]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:931)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:868)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:185)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.Server.handleAsync(Server.java:397)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:601)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:410)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:508)[144:org.eclipse.jetty.io:7.2.2.v20101205]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)[144:org.eclipse.jetty.io:7.2.2.v20101205]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)[144:org.eclipse.jetty.io:7.2.2.v20101205]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:451)[143:org.eclipse.jetty.util:7.2.2.v20101205]
at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]
Caused by: org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:151)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]
... 1 more
Caused by: java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
... 6 more
I've been trying to get two separate bundles to communicate via a nmr endpoint using a camel cxf producer. I have been working on this all week and so far I can't get it to work.
I can however all the nmr endpoint just as in example cxf-camel-nmr without issue so I know that bundle is ok. Seriously this is a super simple hello world prototype and I can't get it to work.
Any help or suggestions would be awesome!!
Env: Java 1.5
Apache Servicemix 4.3.2 (virgin installation)
In servicemix I have two separate osgi bundles. I am unable to get my camel cxf producer to successfully call the nmr endpoint and have zero clue on how to fix.
Bundle #1 cxf-nmr //consumer
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/transport/nmr/cxf-transport-nmr.xml" />
<jaxws:endpoint id="helloWorld1"
implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
address="nmr:HelloWorld1" />
</beans>
Bundle #2 //producer
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://servicemix.apache.org/http/1.0 http://servicemix.apache.org/http/1.0/servicemix-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/transport/nmr/cxf-transport-nmr.xml" />
<import resource="classpath:org/apache/servicemix/camel/nmr/camel-nmr.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxf:bean:testEndpoint"/>
<to uri="nmr:HelloWorld1"/>
</route>
</camel:camelContext>
<cxf:cxfEndpoint
id="testEndpoint"
address="http://localhost:9090/test"
serviceClass="org.apache.servicemix.examples.cxf.HelloWorld">
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD" />
</cxf:properties>
</cxf:cxfEndpoint>
</beans>
--
#################
soap request response
#################
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:sayHi xmlns:m="http://cxf.examples.servicemix.apache.org/">
<arg0>foobar</arg0>
</m:sayHi>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
STATUS: 500
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>java.lang.NullPointerException</faultstring></soap:Fault></soap:Body></soap:Envelope>
--
####################
Console Output - No Idea How To Fix
####################
18:56:04,544 | ERROR | oWorld1-thread-1 | NMRDestination | - - | error preparing message
java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]
at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]
18:56:04,547 | WARN | oWorld1-thread-1 | NMR | 83 - org.apache.servicemix.nmr.core - 1.4.0 | Error processing exchange [
id: a778d16c-2955-41de-89e8-7775f4f976bf
mep: InOut
status: Active
role: Provider
target: PropertyMatchingReference[{NAME=HelloWorld1}]
properties: [
jaxwsContext = {javax.xml.ws.wsdl.operation={http://cxf.examples.servicemix.apache.org/}sayHi, javax.xml.ws.wsdl.description=http://localhost:9090/test?wsdl, javax.xml.ws.wsdl.service={http://cxf.examples.servicemix.apache.org/}HelloWorldService, javax.xml.ws.wsdl.interface={http://cxf.examples.servicemix.apache.org/}HelloWorld, javax.xml.ws.wsdl.port={http://cxf.examples.servicemix.apache.org/}HelloWorldPort}
CamelToEndpoint = nmr://HelloWorld1
org.apache.cxf.service.model.BindingOperationInfo = [BindingOperationInfo: {http://cxf.examples.servicemix.apache.org/}sayHi]
mtom-enabled = false
CamelCreatedTimestamp = Thu Jun 09 18:56:04 PDT 2011
CamelCXFDataFormat = PAYLOAD
]
]
org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:151)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]
at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]
Caused by: java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
... 6 more
18:56:04,552 | ERROR | f2d4607-thread-1 | DefaultErrorHandler | 68 - org.apache.camel.camel-core - 2.6.0 | Failed delivery for exchangeId: ID-Dana-PC-45880-1307670949817-0-2. Exhausted after delivery attempt: 1 caught: org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException
org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:151)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]
at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]
Caused by: java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
... 6 more
18:56:04,553 | WARN | qtp407691725-242 | PhaseInterceptorChain | - - | Interceptor for {http://cxf.examples.servicemix.apache.org/}HelloWorldService#{http://cxf.examples.servicemix.apache.org/}sayHi has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: java.lang.NullPointerException
at org.apache.camel.component.cxf.CxfConsumer$1.checkFailure(CxfConsumer.java:219)[118:org.apache.camel.camel-cxf:2.6.0]
at org.apache.camel.component.cxf.CxfConsumer$1.setResponseBack(CxfConsumer.java:196)[118:org.apache.camel.camel-cxf:2.6.0]
at org.apache.camel.component.cxf.CxfConsumer$1.asyncInvoke(CxfConsumer.java:116)[118:org.apache.camel.camel-cxf:2.6.0]
at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:73)[118:org.apache.camel.camel-cxf:2.6.0]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:224)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:70)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:311)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:280)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[116:org.apache.cxf.bundle:2.3.2]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:931)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:868)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:185)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.Server.handleAsync(Server.java:397)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:601)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:410)[149:org.eclipse.jetty.server:7.2.2.v20101205]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:508)[144:org.eclipse.jetty.io:7.2.2.v20101205]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)[144:org.eclipse.jetty.io:7.2.2.v20101205]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)[144:org.eclipse.jetty.io:7.2.2.v20101205]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:451)[143:org.eclipse.jetty.util:7.2.2.v20101205]
at java.lang.Thread.run(Thread.java:595)[:1.5.0_22]
Caused by: org.apache.servicemix.nmr.api.ServiceMixException: java.lang.NullPointerException
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:151)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[83:org.apache.servicemix.nmr.core:1.4.0]
at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[83:org.apache.servicemix.nmr.core:1.4.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)[:1.5.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)[:1.5.0_22]
... 1 more
Caused by: java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1183)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:427)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:380)[116:org.apache.cxf.bundle:2.3.2]
at org.apache.servicemix.cxf.transport.nmr.NMRMessageHelper.convertMessageToInputStream(NMRMessageHelper.java:43)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:127)[203:org.apache.servicemix.cxf.transport.nmr:4.3.0]
... 6 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来我过去两天一直在处理完全相同的问题。我相信我现在已经解决了这个问题。我发现以下内容:
StaxUtils 中的 NPE 似乎是由于
source
(javax.xml.transform.Source
) 为null
造成的。当exchange.getIn().getBody(Source.class)
在NMRDestination
中返回null
时,它可以为null
班级。这就是事情变得有点难看的地方。让我们退后一步。要查看消息传入时是否有正文,您需要打开
TRACE
日志级别。您可以在 servicemix 控制台中使用log:set TRACE
命令执行此操作。ExchangeUtils#display(Exchange)
仅在 TRACE 中使用打印正文的选项进行调用,甚至在 DEBUG 中也不会。打开 TRACE 后,您将看到如下内容:In.content
部分本质上是消息的正文。我确信你的交换有一个像我一样的身体。这意味着它在 NMR/Camel 路由模式中的某个地方“丢失”了。exchange.getIn().getBody(Source.class)
会执行特殊的转换逻辑,如果未单击某些内容,该逻辑可能会默默地 (!) 返回 null。看一下 org.apache.camel.impl.converter.BaseTypeConverterRegistry#doConvertTo()。当我阅读 TRACE 日志时,我注意到另一个微妙的(几乎仅供参考)跟踪消息:关于 org.apache.xml.serializer.ToXMLStream 对于我的包不可见。我认为 NMR 无法将消息转换为 Source 对象,并且没有告诉我任何相关信息。
解决方案:我最终将
org.apache.xml.serializer
与org.apache一起添加到我的
(一旦我添加了序列化器导入,接下来发生的事情就是Import-Package
maven指令中。 xalanClassNotFountException
抱怨org.apache.xalan.xsltc.trax.DOM2SAX)。一切都在运行时存在,都在lib/endorsed
中,只是直到现在我的服务包才可见。现在它可以工作了,我的消息已到达目标端点。另一件需要注意的事情是 Camel 内容的
streamCache
属性。在最新版本的 Camel 中,默认情况下流资源不会被缓存,并且您的代码将无法多次从流中读取数据,除非它被缓存。剩下的问题是为什么我必须让服务“意识到”NMR/Camel 需要沿着路线发送我的消息的那些依赖关系。确实没有意义。
It looks like I have been dealing with exactly same issue for the last two days. I believe I have by now solved it. Here's what I found out:
The NPE in StaxUtils seems to be due to a
source
(javax.xml.transform.Source
) beingnull
. it can benull
whenexchange.getIn().getBody(Source.class)
returnsnull
in theNMRDestination
class. Here's where things get a little ugly. Let's make a step back.To see whether your message had a body when it came in you would need to turn on
TRACE
log level. You can do that in servicemix console withlog:set TRACE
command.ExchangeUtils#display(Exchange)
only gets called with the option to print out body in TRACE, not even in DEBUG. With TRACE on you will see things like:the
In.content
section is essentially the body of the message. I am sure your exchange had a body just like mine did. Which means it was "lost" somewhere within the NMR/Camel routing schema.The
exchange.getIn().getBody(Source.class)
goes through a special conversion logic that may silently (!) return null if something doesn't click. Take a look atorg.apache.camel.impl.converter.BaseTypeConverterRegistry#doConvertTo()
.When I was reading TRACE logs I noticed another subtle (almost an FYI) trace message about
org.apache.xml.serializer.ToXMLStream
not being visible to my bundle. I figured NMR was failing to convert the message to the Source object and was telling me nothing about it.SOLUTION: I ended up adding
org.apache.xml.serializer
to myImport-Package
maven instruction along withorg.apache.xalan
(once I added the serializer import the next thing that blew up wasClassNotFountException
complaining aboutorg.apache.xalan.xsltc.trax.DOM2SAX
). Everything is there in runtime, it's all inlib/endorsed
, it's just wasn't visible to my service bundle until now.It now works and my message is at the destination endpoint. One more thing to pay attention to is the
streamCache
attribute of the Camel content. There's something about stream resources not being cached by default in latest versions of Camel and your code won't be able to read from a stream multiple times unless it's cached.The question that remains is why do I have to make the service "aware" of those dependencies NMR/Camel needs to send my message down the route. Doesn't really make sense.