I was probably wrong. I think our JNDI lookup in GlassFish can work with
any context class loader, so the problem could be to do with the names
you are using to lookup. Could you tell what names you used to create
the topic and what names you were using to lookup. The code below uses
"jmsTopic," but the exception says:
/Caused by: java.lang.IllegalArgumentException: MQ:Topic:Invalid Topic
Name - jms/Topic /
Thanks,
Sahoo
Sahoo wrote:
> I think it is an issue with context class loader. Can you configure
> your Spring DM OSGi service to run in the context of the calling
> Servlet if such a configuration option available?
>
> Thanks,
> Sahoo
>
> glassfish_at_javadesktop.org wrote:
>> I'm trying to get a simple JMS Topic application running and I'm
>> having problems. My message producer is a pojo that's inside n OSGi
>> bundle that I've deployed. It gets called from within a service
>> that's exposed using Spring DM to a web servlet.
>> The code for the message producer:
>>
>> public void sendMessage(String data)
>> {
>> Context theContext = new InitialContext();
>> System.out.println("Getting Connection Factory.");
>> TopicConnectionFactory topicFactory =
>> (TopicConnectionFactory) theContext.lookup("jms/TopicFactory");
>>
>> System.out.println("Getting Topic.");
>> Topic topic = (Topic) theContext.lookup("jmsTopic");
>> // Here's where it fails
>>
>> topicConnection = topicFactory.createTopicConnection();
>> session = topicConnection.createTopicSession(false,
>> Session.AUTO_ACKNOWLEDGE);
>> publisher = session.createPublisher(topic);
>> message = session.createTextMessage(data);
>>
>> System.out.println("Sending Message.");
>> publisher.publish(message);
>> }
>>
>> I've created the Factory and the Topic using the Glassfish Admin
>> console (Resources->JMS Resources->Destination Resources). I also
>> tried it with creating the physical resource (Configuration->Java
>> Messaging Service->Physical Destinations).
>>
>> Stack Trace:
>>
>> [#|2010-04-19T09:01:37.462-0400|SEVERE|glassfishv3.0|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=40;_ThreadName=Thread-8;|javax.naming.CommunicationException:
>> Communication exception for SerialContext [Root exception is
>> com.sun.appserv.connectors.internal.api.PoolingException]
>> at
>> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:475)
>>
>> at javax.naming.InitialContext.lookup(InitialContext.java:392)
>> at javax.naming.InitialContext.lookup(InitialContext.java:392)
>> at
>> examples.services.mdb.MsgProducer.sendMessage(MsgProducer.java:47)
>> at
>> examples.services.impl.MyServiceImpl.getString(MyServiceImpl.java:47)
>> at HelloWorld.doGet(HelloWorld.java:40)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
>> at
>> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1518)
>>
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
>>
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:171)
>>
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:651)
>>
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
>>
>> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
>> at
>> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:87)
>>
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:158)
>>
>> at
>> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:328)
>>
>> at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:229)
>>
>> at
>> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
>>
>> at
>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:811)
>> at
>> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:708)
>> at
>> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1017)
>> at
>> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:171)
>>
>> 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:526)
>>
>> at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:507)
>>
>> at java.lang.Thread.run(Thread.java:619)
>> Caused by: 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:486)
>>
>> at
>> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:451)
>>
>> ... 32 more
>> 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)
>>
>> ... 36 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)
>>
>> ... 38 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)
>>
>> ... 38 more
>> Caused by: java.lang.IllegalArgumentException: MQ:Topic:Invalid Topic
>> Name - jms/Topic
>> at com.sun.messaging.Topic.setName(Topic.java:90)
>> ... 43 more
>>
>> What I'd really like to do is create a simple JMS app using Spring,
>> but nothing I try seems to work there either. When I add my bean
>> info to my spring xml file, the OSGI bundle deploys but doesn't
>> register the services. Are there any simple Spring JMS examples out
>> there that work in OSGi?
>>
>> Thanks,
>> Larry
>> [Message sent by forum member 'ltouve']
>>
>> http://forums.java.net/jive/thread.jspa?messageID=397816
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>