Hi,
I'm starting an OPENEJB Server from a Java application thanks to
RemoteServer class (located into the org.apache.openejb.config package). In
fact, RemoteServer is a kind of wrapper which made a
Runtime.getRuntime().exec(args) with openejb-core.jar file to execute
OPENEJB Server.
Below, the code to start server
System.setProperty("openejb.home", "D:/OSGi/openejb-3.1.1");
String[] param = new String[1];
param[0] = "start";
RemoteServer.main(param);
I can list the EJB sessions available from the current Context like this:
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
props.put(Context.PROVIDER_URL, "httpejbd://127.0.0.1:4204");
Context ctx = new InitialContext(props);
NamingEnumeration<NameClassPair> list = ctx.list("");
while (list.hasMore()) {
System.out.println("name: " + list.next().getName());
}
Also, i can stop the current OPENEJB Server like this
param = new String[1];
param[0] = "stop";
RemoteServer.main(param);
So, i can restart a new OPENEJB Server according to the same configuration.
param = new String[1];
param[0] = "start";
RemoteServer.main(param);
But, now when i would like to list the EJB sessions (see previous code) from
the new instance of OPENEJB Server, i have a RuntimeException exception
which is throwned (java.lang.RuntimeException: Invalid response from server
:-1).
In fact, when a restart an OPENEJB Server in a same instance of JVM it
does'nt working.
I have checked this new OPENEJB Server with a new Java program (so a new
instance of JVM) and it is working.
It is important to note that i need to start an OpenEJB Server like this
because i need to deploy and undeploy EJBs. These EJBs are not located into
the same applications.
Any idea about this issue ?
Best regards
Mickael
--
View this message in context:
http://www.nabble.com/Starting-OpenEJB-server-from-a-java-code.-tp24643630p24643630.html
Sent from the OpenEJB User mailing list archive at Nabble.com.