RE: Problem connecting to embedded JMS via JmsAdminServerIfc
Joseph Coffman <jcoffman-A08e6c8yq/[email protected]>
| Newsgroups | gmane.comp.java.openjms.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the reply Tim, I was getting a NullPointerException.
java.lang.NullPointerException
at
org.exolab.jms.server.AdminConnectionManager.createConnection(AdminConnectionManager.java:174)
at
org.exolab.jms.administration.intravm.IntravmJmsAdminConnection.<init>(IntravmJmsAdminConnection.java:93)
at
org.exolab.jms.administration.AdminConnectionFactory.create(AdminConnectionFactory.java:283)
at
org.exolab.jms.administration.AdminConnectionFactory.create(AdminConnectionFactory.java:186)
at com.bbn.test.JMSEmbeddedTest.main(JMSEmbeddedTest.java:21)
But, using JmsServer (as you suggested) seems to have fixed the issue,
changed one line to two:
>>new Thread(new
EmbeddedJmsServer("C:\\eclipse-SDK-3.0.1-win32\\eclipse\\workspace\\JMSTest\\openjms.xml"));
becomes:
>>JmsServer server = new
JmsServer("C:\\eclipse-SDK-3.0.1-win32\\eclipse\\workspace\\JMSTest\\openjms.xml");
>>server.init();
All other code and the config file left as it was, connection was made
without any problem. Thanks Tim!
/joe
At 11:31 AM 7/28/2005, you wrote:
>What exception do you get in the client?
>Also note that EmbeddedJmsServer is deprecated in 0.7.7.
>You should use:
> JmsServer server = new JmsServer("<path-to-openjms.xml>");
> server.init();
>
>-Tim
>
> > -----Original Message-----
> > From: openjms-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> > [mailto:openjms-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf
> > Of Joseph Coffman
> > Sent: Friday, 29 July 2005 12:56 AM
> > To: [email protected]
> > Subject: [openjms-user] Problem connecting to embedded JMS
> > via JmsAdminServerIfc
> >
> > Hello all,
> >
> > I'm attempting to start an embedded JMS server using the
> > EmbeddedJmsServer object. As an argument I pass the location
> > of my config file. I then attempt to connect to the embedded
> > server via the JmsAdminServerIfc object by calling the
> > create() method and passing it a url of "embedded://". I run
> > this in a try/catch loop until it successfully connects. The
> > problem is, it doesn't ever successfully connect. I've tried
> > a number of config file changes, I'm hoping it's a simple
> > config file problem. I've included both my config file and
> > code below. I'd greatly appreciate any pointers.
> >
> > Running jdk1.5.0_03 and openjms-0.7.6.1.
> >
> > Thanks very much,
> > /joe
> >
> > /**********************************************/
> > First, my config file:
> > /**********************************************/
> > <?xml version="1.0"?>
> > <Configuration>
> >
> > <!-- Optional. This represents the default configuration -->
> > <ServerConfiguration host="embedded" embeddedJNDI="true" />
> >
> > <Connectors>
> > <Connector scheme="embedded">
> > <ConnectionFactories>
> > <QueueConnectionFactory name="JmsQueueConnectionFactory" />
> > <TopicConnectionFactory name="JmsTopicConnectionFactory" />
> > </ConnectionFactories>
> > </Connector>
> > </Connectors>
> >
> > <!-- Required -->
> > <DatabaseConfiguration>
> > <JdbmDatabaseConfiguration name="openjms.db" />
> > </DatabaseConfiguration>
> >
> > <!-- Required -->
> > <AdminConfiguration script="${openjms.home}\bin\startup.bat" />
> >
> > <!-- Optional. If not specified, no destinations will be
> > created -->
> > <AdministeredDestinations>
> > <AdministeredTopic name="topic1">
> > <Subscriber name="sub1" />
> > <Subscriber name="sub2" />
> > </AdministeredTopic>
> >
> > <AdministeredQueue name="queue1" />
> > <AdministeredQueue name="queue2" />
> > <AdministeredQueue name="queue3" />
> >
> > <AdministeredQueue name="SchedulerQueue" />
> > <AdministeredQueue name="DownloadMasterQueue"/>
> > </AdministeredDestinations>
> >
> > <!-- Optional. If not specified, no users will be created -->
> > <Users>
> > <User name="admin" password="openjms" />
> > </Users>
> >
> > </Configuration>
> >
> > /*******************************************************/
> > Next, my code:
> > /*******************************************************/
> > package com.bbn.test;
> >
> > import java.util.*;
> > import org.exolab.jms.server.*;
> > import org.exolab.jms.administration.*;
> >
> > public class JMSEmbeddedTest {
> >
> > public static void main(String[] args) {
> > try{
> >
> > System.setProperty("openjms.home","C:\\openjms-0.7.6.1");
> > new Thread(new
> > EmbeddedJmsServer("C:\\eclipse-SDK-3.0.1-win32\\eclipse\\works
> > pace\\JMSTest\\openjms.xml"));
> > String url = "embedded://";
> > int i = 1;
> > while(i>0){
> > try{
> > JmsAdminServerIfc
> > admin = AdminConnectionFactory.create(url);
> > Vector queues =
> > admin.getAllDestinations();
> > Object o =
> > queues.firstElement();
> >
> > System.out.println(o.getClass());
> > admin.stopServer();
> > break;
> > }
> > catch(Exception e){
> > i++;
> > Thread.sleep(1000);
> > if (i%60==0)
> >
> > System.out.println(".");
> > else
> >
> > System.out.print(".");
> > }
> > }
> > }
> > catch(Exception e){
> > e.printStackTrace();
> > }
> > }
> > }
> >
> >
> > Joseph Coffman
> > BBNT Solutions
> > 703 284 1308
> > jcoffman-A08e6c8yq/[email protected]
> >
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference &
> > EXPO September 19-22, 2005 * San Francisco, CA * Development
> > Lifecycle Practices Agile & Plan-Driven Development *
> > Managing Projects & Teams * Testing & QA Security * Process
> > Improvement & Measurement * http://www.sqe.com/bsce5sf
> > _______________________________________________
> > openjms-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/openjms-user
> >
>
>
>
>-------------------------------------------------------
>SF.Net email is Sponsored by the Better Software Conference & EXPO September
>19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
>Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
>Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
>_______________________________________________
>openjms-user mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/openjms-user
Joseph Coffman
BBNT Solutions
703 284 1308
jcoffman-A08e6c8yq/[email protected]
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf