RE: embedded openjms server
"Tim Anderson" <tima-k+1zm/[email protected]>
| Newsgroups | gmane.comp.java.openjms.devel |
|---|---|
| Message-ID | <[email protected]> |
It *should* work, although I haven't tried it with tcp.
What version of OpenJMS are you using?
Note that if all calls to OpenJMS are in the one JVM,
then the tcp connector is overkill - you should use the
embedded connector instead:
https://sourceforge.net/forum/message.php?msg_id=1810335
Regards,
Tim
-----Original Message-----
From: openjms-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:openjms-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org]On Behalf Of Hsieh,
Chih-Cheng
Sent: Thursday, February 20, 2003 8:49 AM
To: openjms-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [openjms-developer] embedded openjms server
Hi,
I would like to run JMS Server as a component in another Java Application(
in the same VM). Here is what I did:
//configFile is the xml file for OpenJMS configuration. I used tcp_jms.xml
in %OPENJMS_HOME%\config directory as the base
EmbeddedJmsServer jmsServer = new EmbeddedJmsServer(configFile);
In my command console widnow I see TCP JNDI Server started as following:
15:46:30.290 INFO [VSE Manager Server] - Started TCP JNDI Server on port
3035
.
.
After this line, I don't see any other printouts as what I see when I run
the startjms.bat located in OPENJMS_HOME%\bin directory.
15:53:36.798 INFO [main] - Started TCP JNDI Server on port 3035
15:53:37.126 INFO [main] - Started the JNDI service
15:53:37.126 INFO [main] - Started service [ThreadPoolManager]
15:53:37.126 INFO [main] - Started service [EventManagerThread]
15:53:37.485 INFO [main] - Removed expired messages.
15:53:37.485 INFO [main] - Started service [DatabaseService]
15:53:37.485 INFO [main] - Started service [Scheduler]
15:53:37.485 INFO [main] - Started service [LeaseManagerReaper]
15:53:37.485 INFO [main] - Registering Garbage Collection every 60000 for
memory.
15:53:37.485 INFO [main] - Registering Garbage Collection every 120000 for
other resources.
15:53:37.501 INFO [main] - Started service [GCCollectionService]
15:53:37.595 INFO [main] - Started service [MessageManager]
I believe that something is not quite right. I also tried to write a
simple test program and try to create the initialContext as following.
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--------
Hashtable props = new Hashtable();
String sHost = "localhost";
String sPort = "3035";
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.exolab.jms.jndi.mipc.IpcJndiInitialContextFactory");
String sURL = "tcp://" + sHost + ":" + sPort + "/";
props.put(Context.PROVIDER_URL, sURL);
try
{
Context context = new InitialContext(props);
}
catch(Exception e)
{
}
I got following exception.
javax.naming.CommunicationException: Failed to connect to JNDI service: Read
tim
ed out. Root exception is java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.net.SocketInputStream.read(SocketInputStream.java:182)
at java.io.DataInputStream.readInt(DataInputStream.java:392)
at org.exolab.core.ipc.TcpService.receive(Unknown Source)
at org.exolab.core.ipc.Client.receive(Unknown Source)
at
org.exolab.jms.jndi.mipc.IpcJndiInitialContextFactory.getInitialConte
xt(Unknown Source)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
62)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
Can someone give me some idea, what I did wrong? Is it possible to run
OpenJMS as an embedded component in another Java application?
Thanks,
Chih-Cheng Hsieh