在我的java课程中,我有以下内容:
from("direct:dcrm:input")
.routeId("dcrm-route"
.convertBodyTo(Message.class)
.setHeader(
"recipientListHeader",
simple("activemq:"+rdvrQueueName+ ".${body.controllerID}?jmsMessageType=Text&timeToLive="
+ rdvrMessageTimeToLive
+ "&deliveryPersistent=" + deliveryPersistent))
.choice()
.when(simple("${body.messageType} == 'rdvr'"))
.bean(new DcrmMessageHandler(), "process")
.marshal(requestMessage)
.recipientList(header("recipientListHeader"))
.onPrepare(new MesssageProcessor()).parallelProcessing()
.end()
.setBody(constant(StatusCode.SUCCESS))
.otherwise()
.endChoice();
在写Junit的时候,我是这样的:
@Test
public void testSendMatchingMessage() throws Exception {
String expectedBody = "<matched/>";
resultEndpoint.expectedBodiesReceived(expectedBody);
template.sendBodyAndHeader(expectedBody, "recipientListHeader", 0);
resultEndpoint.assertIsSatisfied();
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
//return new DcrmOutboundRoute();
return new RouteBuilder() {
@Override
public void configure() throws Exception {
// TODO Auto-generated method stub
from("direct:dcrm:input")
.filter(header("recipientListHeader").isEqualTo(constant(StatusCode.SUCCESS)))
.bean(new DcrmMessageHandler(), "process").to("mock:result");
}
};
}
但我收到了轰鸣声错误:
java.lang.ClassFormatError:方法中的Absent Code属性,在类文件javax / persistence / NoResultException中不是native或abstract at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) 在java.net.URLClassLoader.access $ 100(URLClassLoader.java:71) 在java.net.URLClassLoader $ 1.run(URLClassLoader.java:361) 在java.net.URLClassLoader $ 1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) 在java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308) 在java.lang.ClassLoader.loadClass(ClassLoader.java:358)
答案 0 :(得分:0)
检查您的类路径或Maven依赖项,尤其是引用JPA(javax.persistence)的依赖项。您应该具有groupId javax.persistence和artifactId persistence-api的依赖关系,请将其替换为org.hibernate.javax.persistence或org.eclipse.persistence依赖。