Я занимаюсь этой проблемой уже очень давно, и я действительно не могу понять, откуда возникла проблема, может быть, вы мне поможете.
Я создаю веб-приложение J2EE, используя темы JMS дляасинхронные сообщения.Проблема заключается в том, что при получении моей темы с поиском в InitialContext моя тема всегда устанавливается в ноль, и выбрасываются следующие исключения:
ATTENTION: RAR7096: Exception null while trying to set the value jms/Topic on property Name
GRAVE: enterprise_naming.serialctx_communication_exception
GRAVE: com.sun.appserv.connectors.internal.api.PoolingException
at com.sun.enterprise.resource.beans.AdministeredObjectResource.createAdministeredObject(AdministeredObjectResource.java:199)
at com.sun.enterprise.resource.naming.AdministeredObjectFactory.getObjectInstance(AdministeredObjectFactory.java:128)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:472)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:437)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.apache.jsp.index_jsp.jspInit(index_jsp.java from :36)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:90)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:208)
at org.apache.jasper.servlet.JspServletWrapper.getDependants(JspServletWrapper.java:317)
at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:615)
at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:483)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:618)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:483)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:373)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.security.PrivilegedActionException: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.resource.beans.AdministeredObjectResource.createAdministeredObject(AdministeredObjectResource.java:176)
... 41 more
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException
at com.sun.enterprise.connectors.util.SetMethodAction.handleException(SetMethodAction.java:140)
at com.sun.enterprise.connectors.util.SetMethodAction.run(SetMethodAction.java:126)
... 43 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.connectors.util.SetMethodAction.run(SetMethodAction.java:99)
... 43 more
Caused by: java.lang.IllegalArgumentException: MQ:Topic:Invalid Topic Name - jms/Topic
at com.sun.messaging.Topic.setName(Topic.java:90)
... 48 more
Вот мой код, проблемная строка - "topic = (Topic) ic.lookup ("jms / Topic"); "
<%!
@Resource(mappedName = "jms/ConnectionFactory")
ConnectionFactory connectionFactory;
@Resource(mappedName = "jms/Topic")
Topic topic;
Connection connection = null;
Session jmsSession = null;
MessageProducer messageProducer = null;
public void jspInit() {
try {
InitialContext ic = new InitialContext();
connectionFactory = (ConnectionFactory) ic.lookup("jms/ConnectionFactory");
topic = (Topic) ic.lookup("jms/Topic");
connection = connectionFactory.createConnection();
jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
messageProducer = jmsSession.createProducer(topic);
connection.start();
} catch (Exception e) {
System.out.println("Couldn't create nsl : " + e.getMessage());
}
}
Надеюсь, вы поможете мне выяснить, что не так в этом файле!
Спасибо!
РЕДАКТИРОВАТЬ: Ресурсы сервера