Can't get connection factory according to examples
carfield Feb 23, 2002 1:16 PMI change my code according to this page:
http://www.jboss.org/online-manual/HTML/ch08s07.html#jms-jms-examples
Try to get connection factory via following code:
// Populate with needed properties
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "localhost:1099");
props.put("java.naming.rmi.security.manager", "yes");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
// Get the initial context with given properties
Context context = new InitialContext(props);
TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup("TopicConnectionFactory");
But I get the following error:
[INFO,OILServerILService] Client request resulted in a server exception:
javax.jms.JMSException: This destination does not exist !
at org.jboss.mq.server.JMSServer.createTopic(JMSServer.java:519)
at org.jboss.mq.il.oil.OILServerILService.run(OILServerILService.java:269)
at java.lang.Thread.run(Thread.java:498)
I run my JMS server with JBoss startup script, and according to manual,
I don't need to setup classpath. But I need to tell tomcat to load some
external so I edit my $JBOSS_DIST/bin/run.sh from
java $HOTSPOT $JAXP -classpath $JBOSS_CLASSPATH org.jboss.Main $@
to
java $HOTSPOT $JAXP -classpath $JBOSS_CLASSPATH:$CLASSPATH org.jboss.Main $@
The classpath don't contain JMS related information, is it relate to the
problem? If yes, is there any other to change the classpath of tomcat?
P.S.: My classpath is:
.:/opt/tomcat/lib/servlet.jar:/usr/share/pgsql/jdbc7.0-1.2.jar:/opt/IBMJava2-13/lib/tools.jar:/opt/jini1_2/lib/jini-core.jar:/opt/jini1_2/lib/jini-ext.jar:/opt/jini1_
2/lib/sun-util.jar:/usr/share/java/ant-optional-1.4.1.jar:/usr/share/java/ant-optional.jar:/usr/share/java/xalanservlet.jar:/usr/share/java/xerces.jar:/usr/share/java
/xercesSamples.jar:/usr/share/java/xalanj1compat.jar:/usr/share/java/jdbc2_0-stdext.jar:/usr/share/java/jakarta-regexp.jar:/usr/share/java/crimson.jar:/usr/share/java
/xerces-1.4.4.jar:/usr/share/java/xercesSamples-1.4.4.jar:/usr/share/java/xalansamples.jar:/usr/share/java/xalan.jar:/usr/share/java/xsltc.jar:/usr/share/java/ant-1.4
.1.jar:/usr/share/java/jaxp_parser.jar:/usr/share/java/ant.jar:/usr/share/java/poolman.jar:/usr/share/java/jakarta-regexp-1.2.jar:/usr/share/java/junit-3.7.jar:/usr/s
hare/java/junit.jar:/usr/share/java/bsf.jar:/usr/share/java/xalan-2.1.0.jar