Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 96032 invoked from network); 20 Sep 2007 01:11:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Sep 2007 01:11:01 -0000 Received: (qmail 7609 invoked by uid 500); 20 Sep 2007 01:10:52 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 7012 invoked by uid 500); 20 Sep 2007 01:10:51 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 7001 invoked by uid 99); 20 Sep 2007 01:10:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Sep 2007 18:10:51 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dblevins@visi.com designates 208.42.176.213 as permitted sender) Received: from [208.42.176.213] (HELO g2host.com) (208.42.176.213) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Sep 2007 01:12:44 +0000 Received: from [76.167.141.63] (account dblevins@visi.com HELO [192.168.42.22]) by mailfront2.g2host.com (CommuniGate Pro SMTP 5.1.10) with ESMTPSA id 17843022; Wed, 19 Sep 2007 20:10:14 -0500 In-Reply-To: <12769437.post@talk.nabble.com> References: <831791.84270.qm@web57514.mail.re1.yahoo.com> <20070629100352.181451e9c2a7ebbcd6ae28cea81146c8.3479d30ad9.wbe@email.secureserver.net> <11387214.post@talk.nabble.com> <11389626.post@talk.nabble.com> <12680611.post@talk.nabble.com> <5eb405c70709141113l72f5c43em46fb37587ef17092@mail.gmail.com> <12682887.post@talk.nabble.com> <12769437.post@talk.nabble.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: David Jencks Content-Transfer-Encoding: 7bit From: David Blevins Subject: Re: jndi lookup in remote client for geronimo v2 Date: Wed, 19 Sep 2007 18:10:11 -0700 To: user@geronimo.apache.org X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org On Sep 18, 2007, at 6:57 PM, vrm wrote: > > After alot of messing around, I found the answer to my problem. The > correct > way to reference an EJB from an openejb-client is to use the > following = > > artifactid.jar/beanname/fullpathtointerface > > so in my case, inside the EAR was TheEJB.jar = > > TheEJB.jar/TheBean/com.mydomain.ejbtest.TheInterface > > That seemed to work. Not sure if its my error in setting up the > EAR, but > using the ".jar" at the end solved the problem. Great to hear it's working. I think there may be a difference in the default artifactId for an ejb jar in an ear vs a standalone ejb jar. I was chatting with David J. about this and we determined that the default artifactId for an ejb jar is the same regardless if it was in an ear or out... but it doesn't seem like this is the case. It seems you clearly get MyEjbs.jar in an ear and MyEjbs (no .jar) out of an ear. This is likely something we should fix. -David > > > > > vrm wrote: >> >> Thanks for the examples - Is there any difference between the Context >> Lookup in an EJB-JAR vs an EAR ? >> >> I'm still getting a naming exception and I followed both the examples >> exactly. Here are some files associated with my configuration = >> >> --------------- >> If my geronimo-application.xml = >> >> >> > xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2"> >> >> >> com.mydomain.ejbtest >> EjbTest >> 1.0o >> ear >> >> >> >> >> --------------- >> openejb-jar.xml = >> >> >> >> >> >> com.mydomain.ejbtest >> TheEJB >> 1.1 >> car >> >> >> >> com.mydomain.ejbtest >> MyQueueConnectionFactory >> 1.0 >> rar >> >> >> com.mydomain.ejbtest >> MysqlDatabase >> 1.0 >> rar >> >> >> >> >> >> >> >> >> --------------- >> The EJB Bean = >> >> @Stateless(name="TheBean") >> @Remote(TheInterface.class) >> public class TheBean implements TheInterface{ >> >> >> --------------- >> The Interface = >> >> @Remote >> public interface TheInterface { >> >> >> --------------- >> The Client = >> >> Properties ejbprop = new Properties(); >> ejbprop.put >> ("java.naming.factory.initial","org.apache.openejb.client.RemoteIniti >> alContextFactory"); >> ejbprop.put("java.naming.provider.url", "ejbd://127.0.0.1:4201"); >> javax.naming.InitialContext ctx = new >> javax.naming.InitialContext(EJBprops); >> TheInterface obj = >> (TheInterface)ctx.lookup("TheEJB/TheBean/ >> com.mydomain.ejbtest.TheInterface"); >> >> >> >> >> >> Jarek Gawor-2 wrote: >>> >>> I have some tests in Geronimo that might help. >>> >>> If you have a EJB 2.x take a look at: >>> http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/ >>> webservices-testsuite/jaxrpc-tests/jaxrpc-ejb/ >>> >>> And for the client take a look at the testEJB() function in >>> http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/ >>> webservices-testsuite/jaxrpc-tests/jaxrpc-ejb/src/test/java/org/ >>> apache/geronimo/testsuite/testset/JaxRPCTest.java?view=markup >>> >>> If you have EJB 3.0 take a look at: >>> http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/ >>> webservices-testsuite/jaxws-tests/jaxws-ejb/ >>> >>> And for the client take a look at the testEJB() function in >>> http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/ >>> webservices-testsuite/jaxws-tests/jaxws-ejb/src/test/java/org/ >>> apache/geronimo/testsuite/testset/JaxWSTest.java?view=markup >>> >>> Jarek >>> >>> On 9/14/07, vrm wrote: >>>> >>>> I'm having the exact same issue. I've spent 2 days looking >>>> around and >>>> there >>>> is no examples or documentations available for a Remote openejb >>>> client >>>> accessing an EJB on Geronimo 2. >>>> >>>> Anybody have an EAR for Geronimo2 and an Openejb-Client app >>>> accessing >>>> it? >>>> >>>> The Exception I get = >>>> javax.naming.NameNotFoundException: /TheBean does not exist in the >>>> system. >>>> Check that the app was successfully deployed. >>>> >>>> I've tried the following for InitialContext.lookup = >>>> (artifactid)/(TheBean)/(TheInterface) >>>> (artifactid)/(Interface) >>>> (ejbBean)/(Interface) >>>> (artifactid)/(TheBean)/(Full Path to Interface) >>>> ...and many more variations of this >>>> >>>> >>>> My EJB Interface = >>>> >>>> @Remote >>>> public interface TheInterface { >>>> >>>> >>>> My Bean = >>>> @Stateless >>>> public class TheBean implements TheInterface { >>>> >>>> >>>> Anybody get this to work or have examples, please post. >>>> >>>> >>>> >>>> >>>> Xiao-fei Song wrote: >>>>> >>>>> Hi, >>>>> >>>>> Just wanted to let you know I modified a little bit about the >>>>> code: >>>>> >>>>> props.setProperty("java.naming.factory.initial", >>>>> "org.apache.openejb.client.RemoteInitialContextFactory"); >>>>> props.setProperty("java.naming.provider.url", >>>> "127.0.0.1:4201"); >>>>> props.setProperty("java.naming.security.principal", >>>>> "system"); >>>>> props.setProperty("java.naming.security.credentials", >>>> "manager"); >>>>> >>>>> Context ic = new InitialContext(props); >>>>> System.out.println("ic = " + ic); >>>>> >>>>> Object objRef = ic.lookup("MySessionRemoteHome"); >>>>> System.out.println("objRef = " + objRef); >>>>> >>>>> test.abc.MySessionRemoteHome home = >>>>> (test.abc.MySessionRemoteHome)PortableRemoteObject.narrow(objRef, >>>>> test.abc.MySessionRemoteHome.class); >>>>> System.out.println("home = " + home); >>>>> >>>>> test.abc.MySessionRemote remote = home.create(); >>>>> System.out.println("remote = " + remote); >>>>> >>>>> String message = remote.getString(); >>>>> System.out.println("message = " + message); >>>>> >>>>> >>>>> and it works okay on geronimo 1.2 beta. So this really makes me >>>> confused, >>>>> is this a regression or intended to be. Can someone in this alias >>>> please >>>>> respond me? >>>>> >>>>> Thanks, >>>>> Chris >>>>> >>>>> >>>>> Xiao-fei Song wrote: >>>>>> >>>>>> Hi Mark, >>>>>> >>>>>> Thanks for your response. >>>>>> >>>>>> 1. For the time being, I don't really care if the client is >>>>>> really >>>>>> "remote". From my tests, it looks like only "127.0.0.1" is >>>>>> accepted >>>>>> otherwise the connects just failed. I don't know where the >>>> documentation >>>>>> can be found on this. >>>>>> >>>>>> 2. Yes I assume all the libraries are there for the EJB call. And >>>> they >>>>>> are: >>>>>> >>>>>> cglig-nodep >>>>>> geronimo-kernel >>>>>> openejb-core >>>>>> openejb-client >>>>>> j2ee.jar (from j2ee ri) >>>>>> >>>>>> 3. Unfortunately it does not work with "ejb/ >>>>>> MySessionRemoteHome" and >>>> here >>>>>> is what I got: >>>>>> >>>>>> ic = javax.naming.InitialContext@1e51060 >>>>>> Exception in thread "main" javax.naming.NameNotFoundException: >>>>>> /ejb/MySessionRemoteHome does not exist in the system. Check >>>>>> that >>>> the >>>>>> app was successfully deployed. >>>>>> at >>>>>> org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java: >>>>>> 231) >>>>>> at javax.naming.InitialContext.lookup(Unknown Source) >>>>>> at apachegclient.TestClient.main(TestClient.java:43) >>>>>> >>>>>> >>>>>> I would say my first experiences with Genonimo is frustrated >>>>>> because >>>> I >>>>>> just spent a whole day on a very simple task. Anyway, if you >>>>>> have the >>>>>> sample code (both the ejb and the ejb client) that works with >>>> geronimo >>>>>> v2, please send it to my email address. >>>>>> >>>>>> Thanks, >>>>>> Chris >>>>>> >>>>>> >>>>>> >>>>>> Mark Aufdencamp wrote: >>>>>>> >>>>>>> Hi Chris, >>>>>>> >>>>>>> I'll give it a shot at helping you. I've been able to do this >>>> thanks to >>>>>>> much help from others on this list. >>>>>>> >>>>>>> Are you truly doing this as a remote client from a different >>>>>>> machine >>>>>>> than the server? If so, the IP addres your using for the naming >>>>>>> provider should be the server address, rather than the local >>>> loopback >>>>>>> address. >>>>>>> >>>>>>> Do you have all of the required remote client libraries in >>>>>>> the class >>>>>>> path for the remote EJB call? I can look back at my notes and >>>> provide >>>>>>> these if you need them. >>>>>>> >>>>>>> I believe the remote name will probably be proceeded by >>>>>>> "ejb". As >>>> in >>>>>>> "ejb/MySessionRemoteHome". >>>>>>> >>>>>>> I can dig up some code of my own that works if you'ld like. >>>>>>> >>>>>>> Hope this helps some. >>>>>>> >>>>>>> Mark Aufdencamp >>>>>>> Mark@Aufdencamp.com >>>>>>> >>>>>>>> -------- Original Message -------- >>>>>>>> Subject: jndi lookup in remote client for geronimo v2 >>>>>>>> From: Xiao-fei Song >>>>>>>> Date: Fri, June 29, 2007 7:04 am >>>>>>>> To: user@geronimo.apache.org >>>>>>>> >>>>>>>> Hi guys, >>>>>>>> >>>>>>>> I have developed an EJB 2.x stateless session using >>>>>>>> netbeans, and I >>>>>>>> want to write a very simple stand alone ejb client to access >>>>>>>> it in >>>>>>>> geronimo v2. The code looks like below: >>>>>>>> >>>>>>>> >>>>>>>> props.setProperty("java.naming.factory.initial", >>>>>>>> "org.openejb.client.RemoteInitialContextFactory"); >>>>>>>> props.setProperty("java.naming.provider.url", >>>>>>>> "127.0.0.1:4201"); >>>>>>>> //props.setProperty("java.naming.security.principal", >>>>>>>> "testuser"); >>>>>>>> //props.setProperty("java.naming.security.credentials", >>>>>>>> "testpassword"); >>>>>>>> >>>>>>>> Context ic = new InitialContext(props); >>>>>>>> System.out.println("ic = " + ic); >>>>>>>> >>>>>>>> Object objRef = ic.lookup("MySessionRemoteHome"); >>>>>>>> >>>>>>>> I read the documentation and it looks like the only way to >>>>>>>> lookup >>>> in >>>>>>>> the remote client is through jndi-name in openejb-jar.xml. >>>>>>>> And I >>>> have >>>>>>>> done that as below: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1" >>>>>>>> xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1" >>>>>>>> xmlns:sys="http://geronimo.apache.org/xml/ns/ >>>>>>>> deployment-1.2"> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> MySessionBean >>>>>>>> MySessionRemoteHome >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> After the ejb is deployed to geronimo, I ran the client and >>>>>>>> found >>>>>>>> below error: >>>>>>>> >>>>>>>> ic = javax.naming.InitialContext@1e51060 >>>>>>>> Exception in thread "main" javax.naming.NameNotFoundException: >>>>>>>> /MySessionRemoteHome does not exist in the system. Check >>>>>>>> that the >>>> app >>>>>>>> was successfully deployed. >>>>>>>> at >>>>>>>> org.apache.openejb.client.JNDIContext.lookup >>>>>>>> (JNDIContext.java:231) >>>>>>>> at javax.naming.InitialContext.lookup(Unknown Source) >>>>>>>> at apachegclient.TestClient.main(TestClient.java:43) >>>>>>>> >>>>>>>> >>>>>>>> Anyone has any idea what's going on? >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Chris >>>>>>>> >>>>>>>> >>>>>>>> --------------------------------- >>>>>>>> Ready for the edge of your seat? Check out tonight's top >>>>>>>> picks on >>>>>>>> Yahoo! TV. >>>>>>>> >>>>>>>> --------------------------------- >>>>>>>> Now that's room service! Choose from over 150,000 hotels >>>>>>>> in 45,000 destinations on Yahoo! Travel to find your fit. >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/jndi-lookup-in-remote-client-for-geronimo- >>>> v2-tf3999496s134.html#a12680611 >>>> Sent from the Apache Geronimo - Users mailing list archive at >>>> Nabble.com. >>>> >>>> >>> >>> >> >> > > -- > View this message in context: http://www.nabble.com/jndi-lookup-in- > remote-client-for-geronimo-v2-tf3999496s134.html#a12769437 > Sent from the Apache Geronimo - Users mailing list archive at > Nabble.com. > >