geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lasantha Ranaweera <lasan...@opensource.lk>
Subject Re: Open-EJB application client problem
Date Fri, 14 Jul 2006 05:05:21 GMT
Hi Isuru,

It looks you are trying to access EJB from outside the JVM of 
application server. So that is why David says it should be a j2ee client 
(client residing in the same JVM of the app sever) to use "java:comp" 
like JNDI name . Also  note you have to narrow  down the object before 
using  it.

Following is a remotely refer EJB client that worked for me. Hope this 
will help.

        Properties props = new Properties();

     
props.setProperty("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");
     props.setProperty("java.naming.provider.url", "localhost:4201");
     props.setProperty("java.naming.security.principal","system");
     props.setProperty("java.naming.security.credentials","manager");
       
     javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext(props);
     Object objRef = initialContext.lookup("com.test.ejb.HelloBean");

     HelloHome home = 
(HelloHome)javax.rmi.PortableRemoteObject.narrow(objRef, HelloHome.class);
     Hello hello = home.create();

     hello.sayHello();
       
       

Thanks,
Lasantha Ranaweera
Senior Software Engineer,
Lanka Software Foundation,
Sri Lanka.

Isuru Samaraweera wrote:
> Hi David,
>  
> Its a J2EE client I am using.Here is the client code
>  
>  Hashtable ht=new Hashtable();
>   ht.put("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");
>   ht.put("java.naming.provider.url","127.0.0.1:4201");
>   ht.put("java.naming.security.principal","system");
>   ht.put("java.naming.security.credentials","manager");
>   
>   try
>   {
>   Context context = new InitialContext(ht);
>   StoreHome home =null; 
>    home=(StoreHome)context.lookup("java:comp/env/ejb/StoreLocal");
>  
>  Store store = home.create();
>   store.storeMax();
>   }
>
> Thank You,
> regards,
> Isuru
> */David Jencks <david_jencks@yahoo.com>/* wrote:
>
>     It looks to me as if you are using a non-j2ee app client but
>     trying to use jndi as if it is a j2ee app client.  From a
>     non-j2ee-app-client you have to look up whatever you specify as
>     jndi-name in the openejb config, and you have to use the
>     proprietary jndi configuration for openejb jndi.  In particular
>     you shouldn't be looking in java:comp unless you have a j2ee
>     client.  Can you clarify what you are trying to do?
>
>     thanks
>     david jencks
>
>     On Jul 11, 2006, at 11:14 AM, Isuru Samaraweera wrote:
>
>>     Hi All,
>>      
>>     I have successfully deployed an application with session bean  in
>>     geronimo1.1 
>>     However when I try to lookup the  session bean from a client
>>     application,jndi  name
>>     (java:comp/env/ejb/StoreLocal) was not bound.In the
>>     geronimoserver console following error was displayed.
>>      
>>     23:09:13,812 ERROR [JndiRequestHandler] JNDI request error
>>     java.lang.IllegalArgumentException: uri path must be in the form
>>     [groupId]/[arti
>>     factId]/[version]/[type] : /java:comp/env/ejb/StoreLocal
>>             at
>>     org.apache.geronimo.gbean.AbstractNameQuery.<init>(AbstractNameQuery.
>>     java:104)
>>             at
>>     org.openejb.ContainerIndex.getContainerIndex(ContainerIndex.java:208)
>>             at
>>     org.openejb.ContainerIndex$$FastClassByCGLIB$$6674ccb6.invoke(<genera
>>     ted>)
>>             at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>>             at
>>     org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethod
>>     Invoker.java:38)
>>             at
>>     org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperatio
>>     n.java:122)
>>             at
>>     org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.
>>     java:817)
>>             at
>>     org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:5
>>     7)
>>             at
>>     org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperat
>>     ionInvoker.java:35)
>>             at
>>     org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(Pro
>>     xyMethodInterceptor.java:96)
>>             at
>>     org.openejb.ContainerIndex$$EnhancerByCGLIB$$4d03a4f9.getContainerInd
>>     ex(<generated>)
>>             at
>>     org.openejb.server.ejbd.JndiRequestHandler.doLookup(JndiRequestHandle
>>     r.java:178)
>>             at
>>     org.openejb.server.ejbd.JndiRequestHandler.processRequest(JndiRequest
>>     Handler.java:115)
>>             at
>>     org.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:154)
>>             at
>>     org.openejb.server.ejbd.EjbServer.service(EjbServer.java:87)
>>             at
>>     org.openejb.server.ejbd.EjbServer$$FastClassByCGLIB$$d379d2ff.invoke(
>>     <generated>)
>>             at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>>             at
>>     org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethod
>>     Invoker.java:38)
>>             at
>>     org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperatio
>>     n.java:122)
>>             at
>>     org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.
>>     java:817)
>>             at
>>     org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:5
>>     7)
>>             at
>>     org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperat
>>     ionInvoker.java:35)
>>             at
>>     org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(Pro
>>     xyMethodInterceptor.java:96)
>>             at
>>     org.activeio.xnet.ServerService$$EnhancerByCGLIB$$9ba58c2.service(<ge
>>     nerated>)
>>             at org.activeio.xnet.ServicePool$2.run(ServicePool.java:67)
>>             at org.activeio.xnet.ServicePool$3.run(ServicePool.java:90)
>>             at
>>     org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:172)
>>             at
>>     org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(Th
>>     readPool.java:289)
>>             at
>>     EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown So
>>     urce)
>>             at java.lang.Thread.run(Thread.java:595)
>>      
>>     I have put following jar files in the classpath.
>>      
>>     geronimo-kernel-1.1-SNAPSHOT.jar
>>     geronimo-spec-j2ee-1.4-rc4.jar
>>     openejb-core-2.0-SNAPSHOT.jar
>>     cglib-nodep-2.1.jar
>>     geronimo-security-1.1-SNAPSHOT.jar
>>      
>>     Can anybody suggest a solution for this problem?
>>      
>>     Thank You,
>>     regards,
>>     Isuru
>>
>>     ------------------------------------------------------------------------
>>     Want to be your own boss? Learn how on Yahoo! Small Business.
>>     <http://us.rd.yahoo.com/evt=41244/*http://smallbusiness.yahoo.com/r-index>
>
>
> ------------------------------------------------------------------------
> Yahoo! Music Unlimited - Access over 1 million songs. Try it free. 
> <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yahoo.com/unlimited/%20>




Mime
View raw message