You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Jazon <re...@gmail.com> on 2009/01/30 16:11:07 UTC

JNDI lookup fails after Geronimo restarted

Hello,
I have the following test program, which runs fine to lookup a remote
stateless session bean.
But the problem is when my program is running, I restart Geronimo, the JNDI
lookup will always fail even after Geronimo is fully restarted.
I am not sure it is a problem of Geronimo or Openejb.
Anyone knows how to solve this or work around it?
Thanks

public class testRemote {

    public static void testEjb()throws Exception{
        Properties p = new Properties();
        p.setProperty("java.naming.factory.initial",
"org.apache.openejb.client.RemoteInitialContextFactory");
        p.setProperty("java.naming.provider.url", "ejbd://localhost:4201");
        p.setProperty("java.naming.security.principal", "system");
        p.setProperty("java.naming.security.credentials", "manager");
        p.setProperty("openejb.authentication.realmName", "geronimo-admin");
        InitialContext context = new InitialContext(p);

        MyService service = (MyService)
context.lookup("MyServiceImplRemote");
        Object o = service.getAllCustomers();
        System.out.println(o);
    }

    public static void main(String[] args) throws Exception{
        while (true){
            try{
                testEjb();

            }catch(Exception e){
                e.printStackTrace();
            }
            Thread.sleep(5000);
        }
    }

Re: JNDI lookup fails after Geronimo restarted

Posted by David Blevins <da...@visi.com>.
This one slipped off my radar, sorry for the delay.

First thing to verify is that the openejb client and server versions  
match.  Best approach is to grab the openejb-client jar from the  
repository of your geronimo install.

-David

On Jan 30, 2009, at 1:56 PM, Jazon wrote:

> I tried with both 2.1.3 and 2.2-SNAPSHOT, They both have this issue.
> the stacktrace is like:
>
> java.lang.RuntimeException: Invalid response from server: -1
>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java: 
> 292)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>     at edu.uiuc.fs.ejb.testRemote.testEjb(testRemote.java:26)
>     at edu.uiuc.fs.ejb.testRemote.main(testRemote.java:35)
>
>
>
> On Fri, Jan 30, 2009 at 3:29 PM, David Blevins  
> <da...@visi.com> wrote:
> Hi Jazon,
>
> What version of Geronimo are you using and can you post the  
> stacktrace?
>
> -David
>
>
> On Jan 30, 2009, at 7:11 AM, Jazon wrote:
>
> Hello,
> I have the following test program, which runs fine to lookup a  
> remote stateless session bean.
> But the problem is when my program is running, I restart Geronimo,  
> the JNDI lookup will always fail even after Geronimo is fully  
> restarted.
> I am not sure it is a problem of Geronimo or Openejb.
> Anyone knows how to solve this or work around it?
> Thanks
>
> public class testRemote {
>
>    public static void testEjb()throws Exception{
>        Properties p = new Properties();
>        p.setProperty("java.naming.factory.initial",  
> "org.apache.openejb.client.RemoteInitialContextFactory");
>        p.setProperty("java.naming.provider.url", "ejbd://localhost: 
> 4201");
>        p.setProperty("java.naming.security.principal", "system");
>        p.setProperty("java.naming.security.credentials", "manager");
>        p.setProperty("openejb.authentication.realmName", "geronimo- 
> admin");
>        InitialContext context = new InitialContext(p);
>
>        MyService service = (MyService)  
> context.lookup("MyServiceImplRemote");
>        Object o = service.getAllCustomers();
>        System.out.println(o);
>    }
>
>    public static void main(String[] args) throws Exception{
>        while (true){
>            try{
>                testEjb();
>
>            }catch(Exception e){
>                e.printStackTrace();
>            }
>            Thread.sleep(5000);
>        }
>    }
>
>


Re: JNDI lookup fails after Geronimo restarted

Posted by Jazon <re...@gmail.com>.
I tried with both 2.1.3 and 2.2-SNAPSHOT, They both have this issue.
the stacktrace is like:

java.lang.RuntimeException: Invalid response from server: -1
    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:292)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at edu.uiuc.fs.ejb.testRemote.testEjb(testRemote.java:26)
    at edu.uiuc.fs.ejb.testRemote.main(testRemote.java:35)



On Fri, Jan 30, 2009 at 3:29 PM, David Blevins <da...@visi.com>wrote:

> Hi Jazon,
>
> What version of Geronimo are you using and can you post the stacktrace?
>
> -David
>
>
> On Jan 30, 2009, at 7:11 AM, Jazon wrote:
>
>  Hello,
>> I have the following test program, which runs fine to lookup a remote
>> stateless session bean.
>> But the problem is when my program is running, I restart Geronimo, the
>> JNDI lookup will always fail even after Geronimo is fully restarted.
>> I am not sure it is a problem of Geronimo or Openejb.
>> Anyone knows how to solve this or work around it?
>> Thanks
>>
>> public class testRemote {
>>
>>    public static void testEjb()throws Exception{
>>        Properties p = new Properties();
>>        p.setProperty("java.naming.factory.initial",
>> "org.apache.openejb.client.RemoteInitialContextFactory");
>>        p.setProperty("java.naming.provider.url", "ejbd://localhost:4201");
>>        p.setProperty("java.naming.security.principal", "system");
>>        p.setProperty("java.naming.security.credentials", "manager");
>>        p.setProperty("openejb.authentication.realmName",
>> "geronimo-admin");
>>        InitialContext context = new InitialContext(p);
>>
>>        MyService service = (MyService)
>> context.lookup("MyServiceImplRemote");
>>        Object o = service.getAllCustomers();
>>        System.out.println(o);
>>    }
>>
>>    public static void main(String[] args) throws Exception{
>>        while (true){
>>            try{
>>                testEjb();
>>
>>            }catch(Exception e){
>>                e.printStackTrace();
>>            }
>>            Thread.sleep(5000);
>>        }
>>    }
>>
>
>

Re: JNDI lookup fails after Geronimo restarted

Posted by David Blevins <da...@visi.com>.
Hi Jazon,

What version of Geronimo are you using and can you post the stacktrace?

-David

On Jan 30, 2009, at 7:11 AM, Jazon wrote:

> Hello,
> I have the following test program, which runs fine to lookup a  
> remote stateless session bean.
> But the problem is when my program is running, I restart Geronimo,  
> the JNDI lookup will always fail even after Geronimo is fully  
> restarted.
> I am not sure it is a problem of Geronimo or Openejb.
> Anyone knows how to solve this or work around it?
> Thanks
>
> public class testRemote {
>
>     public static void testEjb()throws Exception{
>         Properties p = new Properties();
>         p.setProperty("java.naming.factory.initial",  
> "org.apache.openejb.client.RemoteInitialContextFactory");
>         p.setProperty("java.naming.provider.url", "ejbd://localhost: 
> 4201");
>         p.setProperty("java.naming.security.principal", "system");
>         p.setProperty("java.naming.security.credentials", "manager");
>         p.setProperty("openejb.authentication.realmName", "geronimo- 
> admin");
>         InitialContext context = new InitialContext(p);
>
>         MyService service = (MyService)  
> context.lookup("MyServiceImplRemote");
>         Object o = service.getAllCustomers();
>         System.out.println(o);
>     }
>
>     public static void main(String[] args) throws Exception{
>         while (true){
>             try{
>                 testEjb();
>
>             }catch(Exception e){
>                 e.printStackTrace();
>             }
>             Thread.sleep(5000);
>         }
>     }