On Jul 24, 2009, at 5:24 AM, Keulkeul wrote:


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 ?

Hi Mickael,

Couple questions, are you starting/stoping a standalone OpenEJB server or Tomcat+OpenEJB. It seems from the start command you are starting a plain OpenEJB server, but the httpejbd seems to indicate you are running a Tomcat+OpenEJB install.

The interesting thing is that in 3.1.1 you should get an "Unsupported ConnectionFactory URI scheme "httpejbd"." exception with a URL like that. Do you by chance have an old version of OpenEJB in the client classpath?

-David

Reply via email to