Connecting to JBoss ESB 4.9 from deployed JBoss 6 application
jcadam14 Dec 19, 2011 1:19 PMI have the following code in a deployed application running on JBoss 6.0.0:
Hashtable p = new Hashtable();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL, "jnp://XX.XXX.XX.XX:1099"); //ip address of ESB server, which is started with run.bat -b XX.XXX.XX.XX
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
Context context = new InitialContext(p);
ConnectionFactory factory = (ConnectionFactory) context.lookup("ConnectionFactory");
conn = factory.createConnection();
conn.start();
Session session = conn.createSession(false, 0);
TextMessage message = session.createTextMessage(schedule.getScheduleData());
Topic topic = (Topic)context.lookup(VALIDATION_DESTINATION);
MessageProducer prod = session.createProducer(topic);
prod.send(message);
The code throws an exception when trying to start the connection. Here's the stack trace starting at the class that calls conn.start() location:
2011-12-19 10:59:34,198 ERROR [STDERR] (http-155.157.208.50-8080-85) java.lang.NullPointerException
2011-12-19 10:59:34,198 ERROR [STDERR] (http-155.157.208.50-8080-85) at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:87)
2011-12-19 10:59:34,198 ERROR [STDERR] (http-155.157.208.50-8080-85) at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
2011-12-19 10:59:34,198 ERROR [STDERR] (http-155.157.208.50-8080-85) at org.jboss.jms.client.delegate.ClientConnectionDelegate$start_N8025343665958530775.invokeNext(ClientConnectionDelegate$start_N8025343665958530775.java)
2011-12-19 10:59:34,213 ERROR [STDERR] (http-155.157.208.50-8080-85) at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
2011-12-19 10:59:34,213 ERROR [STDERR] (http-155.157.208.50-8080-85) at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
2011-12-19 10:59:34,213 ERROR [STDERR] (http-155.157.208.50-8080-85) at org.jboss.jms.client.delegate.ClientConnectionDelegate$start_N8025343665958530775.invokeNext(ClientConnectionDelegate$start_N8025343665958530775.java)
2011-12-19 10:59:34,213 ERROR [STDERR] (http-155.157.208.50-8080-85) at org.jboss.jms.client.delegate.ClientConnectionDelegate.start(ClientConnectionDelegate.java)
2011-12-19 10:59:34,213 ERROR [STDERR] (http-155.157.208.50-8080-85) at org.jboss.jms.client.JBossConnection.start(JBossConnection.java:121)
2011-12-19 10:59:34,213 ERROR [STDERR] (http-155.157.208.50-8080-85) at com.rsc.npoess.exportmngr.ValidationService.validateSchedule(ValidationService.java:143)
Is there a trick of trying to connect the two? I have the javassist.jar, jboss-aop-jdk50-client.jar and jboss-messaging-client.jar in my projects lib directory. I'm sure I'm just missing some sort of configuration in JBoss 6? Or can you even mix the two messaging systems?