tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keulkeul <baron.mick...@gmail.com>
Subject Re: Starting OpenEJB server from a java code.
Date Tue, 28 Jul 2009 21:00:37 GMT



David Blevins wrote:
> 
> 
> 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
> 
> 
> 

Hi David,

Thanks for your replying.

While i was writing this post i made a big mistake. It's not "httpejb" but
"ejbd". I'm sorry. But the problem is the same. I was testing different
solutions and it was a bad copy and paste ;-)  

So i'm starting a standalone OpenEJB server not Tomcat + OpenEJB. All
OpenEJB server features are working during the first starting. But if i'm
starting a new instance server (of course the previous server instance is
turn off) it doesn't working.

Mickael  

-- 
View this message in context: http://www.nabble.com/Starting-OpenEJB-server-from-a-java-code.-tp24643630p24707762.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message