RE: Problems using embedded connector

"Tim Anderson" <[email protected]>
Newsgroups gmane.comp.java.openjms.user
Message-ID <[email protected]>
> From: A C
> 
> I've set up 0.7.7-alpha-1 using the stock openjms.xml config, 
> except the "rmi" connector has been replaced with an 
> "embedded" one. I am launching an embedded instance of a 
> JmsServer with the following code:
> 
>         JmsServer server = new JmsServer(jmsConfig);
>         server.init();
> 
> ... where jmsConfig is just the string path to the 
> openjms.xml file mentioned above.
> 
> When I attempt create an InitialContext with the following code:
> 
>         Hashtable properties = new Hashtable();
>         properties.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.exolab.jms.jndi.InitialContextFactory");
>         properties.put(Context.PROVIDER_URL, "embedded://");
>         Context context = new InitialContext(properties);
> 
> ... I see the following stack trace:
> 
> Exception in thread "main" 
> javax.naming.CommunicationException: Failed to get registry 
> service for URL: embedded:// [Root exception is
> java.rmi.ConnectIOException: Failed to create connection; 
> nested exception
> is:
> 	org.exolab.jms.net.connector.ConnectException: 
> Connection refused, URI=vm://openjms/]
> 	at
> org.exolab.jms.jndi.InitialContextFactory.getInitialContext(In
> itialContextFactory.java:145)
> 	at 
> javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
> 	at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
> 	at javax.naming.InitialContext.init(Unknown Source)
> 	at javax.naming.InitialContext.<init>(Unknown Source...
> 
> When I attempt to connect via the administrative interface 
> using the following code:
> 
>         String url = "embedded://";
>         JmsAdminServerIfc admin = AdminConnectionFactory.create(url);
> 
> ... I see the following stack trace:
> 
> Exception in thread "main" javax.jms.JMSException: Failed to 
> get registry service for URL: embedded://
> 	at
> org.exolab.jms.administration.net.JmsAdminConnectionImpl.<init
> >(JmsAdminConnectionImpl.java:110)
> 	at
> org.exolab.jms.administration.AdminConnectionFactory.create(Ad
> minConnectionFactory.java:107)
> 	at
> org.exolab.jms.administration.AdminConnectionFactory.create(Ad
> minConnectionFactory.java:91)...
> 
> Anything obvious that I'm missing? I've been using 
> "embedded://" on 0.7.6 without any issues to date... just 
> upgrading away a few bugs, but unfortunately have run into 
> another issue.
> 
> Thanks,
> -Albert
> 

Can't really tell from that stack trace.
Try dumping the stack of the root cause. Something like:
  exception.getRootCause().detail.printStackTrace()

It could mean that the server hasn't completed startup yet.
To determine when the server is accepting connections, configure
$OPENJMS_HOME/config/log4j.xml with the following:

  <category name="org.exolab.jms.server.net.RemoteServerConnector"
additivity="false">
    <priority value="INFO"/>
    <appender-ref ref="STDOUT"/>
  </category>

To find out what the embedded connector is doing, add:

  <category name="org.exolab.jms.net.vm" additivity="false">
    <priority value="DEBUG"/>
    <appender-ref ref="STDOUT"/>
    <appender-ref ref="openjms"/>
  </category>

You may also need to add:
  <category name="org.exolab.jms">
    <priority value="WARN"/>
    <appender-ref ref="STDOUT"/>
    <appender-ref ref="openjms"/>
  </category>

-Tim




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.