无法向weblogic队列发送消息

时间:2011-05-06 11:54:38

标签: java jms weblogic

Iam尝试将字符串消息发送到weblogic服务器中创建的JMS队列。我使用Eclipse ide,当我运行我的Web应用程序时,我收到以下错误,tomcat服务器关闭。错误是

javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is: 
    java.io.StreamCorruptedException: invalid type code: 31]
    at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:74)
    at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:32)
    at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:773)
    at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:673)
    at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:466)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:373)
    at weblogic.jndi.Environment.getContext(Environment.java:307)
    at weblogic.jndi.Environment.getContext(Environment.java:277)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.InitialContext.<init>(Unknown Source)
    at com.infotech.jms.JMSBEAQueueSend.sendMessage(JMSBEAQueueSend.java:48)
    at com.infotech.struts.actions.AppAction.execute(AppAction.java:75)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is: 
    java.io.StreamCorruptedException: invalid type code: 31
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:229)
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:224)
    at weblogic.common.internal.RMIBootServiceImpl_1001_WLStub.authenticate(Unknown Source)
    at weblogic.security.acl.internal.Security$1.run(Security.java:185)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.security.acl.internal.Security.authenticate(Security.java:181)
    at weblogic.jndi.WLInitialContextFactoryDelegate.authenticateRemotely(WLInitialContextFactoryDelegate.java:734)
    at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:667)
    ... 29 more
Caused by: java.io.StreamCorruptedException: invalid type code: 31
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:191)
    at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:227)
    ... 37 more

请帮帮我。感谢和最好的问候

1 个答案:

答案 0 :(得分:14)

基于对此问题的一些快速研究,它似乎是由在应用服务器和客户端之间使用不同的JDK级别引起的。我见过的大多数示例都表明,在Java 5上运行Weblogic时,在客户端上使用Java 6时会出现这种情况。

虽然我没有亲自尝试过,但建议将以下内容添加到客户端应用程序的启动命令中:

-Dsun.lang.ClassLoader.allowArraySyntax=true

设置此属性可在ClassLoader的loadClass方法中启用向后兼容模式。

以下是link to an Oracle forum question,提供了一些其他信息。

或者,如果要执行直接集成,则必须确保客户端和服务器运行相同的JVM级别。显然,这通常不是最佳解决方案。