3
我使用骆驼2.10.3骆驼POJO与JAXB数据格式异常产生
这里是我的骆驼背景:
<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
<endpoint id="webserviceStart" uri="direct:webserviceStart"/>
<dataFormats>
<jaxb id="jaxb" prettyPrint="true"
contextPath="com.jaxbtest.package" />
</dataFormats>
<route id="myRoute">
<from ref="webserviceStart" />
<marshal ref="jaxb" />
<to uri="spring-ws:http://wshost:8010/service"/>
<unmarshal ref="jaxb" />
</route>
</camelContext>
此代码:
@Component
public class WebserviceClient
{
@EndpointInject(ref = "webserviceStart")
ProducerTemplate _producer;
public Response invoke(Request input)
{
return (Response) _producer.sendBody(input).getOut().getBody();
}
}
此代码(以下“使用@Produce隐藏您的代码中的骆驼API”部分http://camel.apache.org/pojo-producing.html)不包括:
@Component
public class WebserviceClient
{
public static interface MyWebservice
{
Response invoke(@Body Request body);
}
@EndpointInject(ref = "webserviceStart")
MyWebservice _producer;
public Response invoke(Request input)
{
return (Response) _producer.invoke(input);
}
}
它抛出一个异常:
Caused by: java.io.IOException: javax.xml.bind.JAXBException: class org.apache.camel.component.bean.BeanInvocation nor any of its super class is known to this context.
at org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:103)
at org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:59)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
如果这是骆驼的已知错误,没有人知道有关它的问题?我应该为此创建一个新的JIRA吗?这似乎是POJO生产的一个简单用例。
你可以看到contextPath是在' '元素中指定的。除了代码工作的第一个例子。 –
Strelok
2013-04-29 05:46:06