我正在尝试接收soap消息并将其发送到JMS Queue但它返回此错误消息:
Severe: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to java.io.Serializable
at kics.green.acs.tr069.web.servlet.TR069ACSFrontController.createJMSMessageForjmsACSMessageQueue(TR069ACSFrontController.java:409)
at kics.green.acs.tr069.web.servlet.TR069ACSFrontController.sendJMSMessageToACSMessageQueue(TR069ACSFrontController.java:421)
at kics.green.acs.tr069.web.servlet.TR069ACSFrontController.processRequest(TR069ACSFrontController.java:165)
at kics.green.acs.tr069.web.servlet.TR069ACSFrontController.doPost(TR069ACSFrontController.java:297)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at net.balusc.http.multipart.MultipartFilter.doFilter(MultipartFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:232)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:745)
严重:在kics.green.acs.tr069.web.servlet.TR069ACSFrontController.createJMSMessageForjmsACSMessageQueue(TR069ACSFrontController.java:409) 严重:在kics.green.acs.tr069.web.servlet.TR069ACSFrontController.sendJMSMessageToACSMessageQueue(TR069ACSFrontController.java:421) 严重:在kics.green.acs.tr069.web.servlet.TR069ACSFrontController.processRequest(TR069ACSFrontController.java:165) 严重:在kics.green.acs.tr069.web.servlet.TR069ACSFrontController.doPost(TR069ACSFrontController.java:297) 严重:在javax.servlet.http.HttpServlet.service(HttpServlet.java:754) 严重:在javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 严重:在org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539) 严重:at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343) 严重:在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) 严重:在net.balusc.http.multipart.MultipartFilter.doFilter(MultipartFilter.java:73) 严重:在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) 严重:在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) 严重:在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) 严重:在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 严重:在org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) 严重:在org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) 严重:在com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98) 严重:在com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91) 严重:在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162) 严重:在org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330) 严重:在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) 严重:在com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:232) 严重:在com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828) 严重:在com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725) 严重:在com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019) 严重:在com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 严重:在com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 严重:在com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 严重:在com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 严重:在com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 严重:在com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 严重:在com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 严重:在com.sun.grizzly.ContextTask.run(ContextTask.java:71) 严重:在com.sun.grizzly.util.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:532) 严重:在com.sun.grizzly.util.AbstractThreadPool $ Worker.run(AbstractThreadPool.java:513) 严重:在java.lang.Thread.run(Thread.java:745)
我正在使用glassfish 3.1.1。
这是代码:
private Message createJMSMessageForjmsACSMessageQueue(Session session, Object messageData) throws JMSException {
// TODO create and populate message to send
ObjectMessage om = session.createObjectMessage();
om.setObject((Serializable) messageData);
return om;
}
private void sendJMSMessageToACSMessageQueue(Object messageData) throws JMSException {
Connection connection = null;
Session session = null;
try {
connection = aCSMessageQueueFactory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(aCSMessageQueue);
messageProducer.send(createJMSMessageForjmsACSMessageQueue(session, messageData));
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (session != null) {
try {
session.close();
} catch (JMSException e) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Cannot close session", e);
}
}
if (connection != null) {
connection.close();
}
}
此行错误:
om.setObject((Serializable) messageData);
答案 0 :(得分:0)
问题就像异常所说的那样,你试图将 com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl 强制转换为 java.io.Serializable ,但该类没有实现该接口。
您需要以不同的方式传递SOAP有效负载,请参阅https://www.w3.org/TR/soapjms/#binding-message-body