gpt4 book ai didi

java - 将 Soap 消息发送到 JMS 队列

转载 作者:行者123 更新时间:2023-11-30 07:38:39 25 4
gpt4 key购买 nike

我正在尝试接收 SOAP 消息并将其发送到 JMS 队列,但它返回此错误消息:

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)严重:位于 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);

最佳答案

问题,就像异常所说的那样,是您试图将 com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl 转换为 java.io.Serialized ,但该类没有实现该接口(interface)。
您需要以不同的方式传递 SOAP 负载,请参阅 https://www.w3.org/TR/soapjms/#binding-message-body

关于java - 将 Soap 消息发送到 JMS 队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35011087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com