Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 57294 invoked from network); 8 Apr 2008 07:10:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Apr 2008 07:10:18 -0000 Received: (qmail 58730 invoked by uid 500); 8 Apr 2008 07:10:18 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 58172 invoked by uid 500); 8 Apr 2008 07:10:17 -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 58161 invoked by uid 99); 8 Apr 2008 07:10:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Apr 2008 00:10:17 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of m.h.shams@gmail.com designates 72.14.214.237 as permitted sender) Received: from [72.14.214.237] (HELO hu-out-0506.google.com) (72.14.214.237) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Apr 2008 07:09:35 +0000 Received: by hu-out-0506.google.com with SMTP id 27so629143hub.15 for ; Tue, 08 Apr 2008 00:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=BmbsT334l8gbkiLREek4rTLdolgp08UsAtRCtbA7Gyw=; b=keDa0wGEuiEV8MMXic3jJbIirjBTdq+YVjCZWKUCpUv/fzSKkncqCgP+1GcmI8ygSiK1ZUimQiZMVq8F8e9RxxMaGZ3Na8GYQEaP2OS75fjHsWLdg/Oi6hCbLYRyQXEdGE4dJB8rZATKf8Q5k1Ug6cyARlmKSnxPIA6E7oCWw+I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=jhwzZI9714U+unSySUqcBG3MHAliYRQGMDXt05G2krivjnRsq0aoAnc42By9oWYINwn+f8n1mu86/QusiV7igIQoF5/nBNG3ApsvmYJ91UmkqyXUWO2DwudDTGn0wS1MaLjltl8D2omhDWRs4Q1yCEQV+rszYkMmztLZhuYJFrU= Received: by 10.82.175.17 with SMTP id x17mr9358570bue.23.1207638586013; Tue, 08 Apr 2008 00:09:46 -0700 (PDT) Received: by 10.82.124.7 with HTTP; Tue, 8 Apr 2008 00:09:45 -0700 (PDT) Message-ID: <92e0cdfc0804080009i24fb7417ne6ba8bc099bda201@mail.gmail.com> Date: Mon, 7 Apr 2008 23:09:45 -0800 From: "Mohammad Shamsi" To: user@geronimo.apache.org Subject: Re: how to lookup ejb from jndi, in a stand alone client. ? In-Reply-To: <6E2CD001-9A25-41B4-8945-C484510D7258@yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15902_3585637.1207638585961" References: <92e0cdfc0804072320p79657154i1f5a7ee1b8cd0065@mail.gmail.com> <6E2CD001-9A25-41B4-8945-C484510D7258@yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_15902_3585637.1207638585961 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline openejb3 beta 2 (client and server) is in app lib. i change my code like this : Properties environment = new Properties(); environment.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory"); environment.put(Context.PROVIDER_URL, "ejbd://localhost:4201"); try { InitialContext context = new InitialContext(environment); Object o = context.lookup("SampleBeanRemote"); System.out.println(o.getClass().getName()); } catch (NamingException e) { e.printStackTrace(); } but i got another exception again : java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/ejb/NoSuchEJBException at java.lang.ClassLoader.defineClass1(Native Method) my bean class is SampleBean and it has to interface SampleRemote and SampleLocal where can i find a sample to lookup remotely from jndi ??? On Mon, Apr 7, 2008 at 10:53 PM, David Jencks wrote: > I get confused by the jndi "directory" part but suspect that one problem > is your use of InitialDirContext rather than InitialContext. > > Also are you sure you are using the openejb client library that goes with > the server? While we've tried to keep compatibility with older versions > there may have been some changes in the authentication bits.... I know there > were in the code if not the protocol. > > thanks > david jencks > > > On Apr 7, 2008, at 11:20 PM, Mohammad Shamsi wrote: > > Hi All, > > > > in Gmo 2.1, i want to lookup a EJB from a standalone client > > > > i write this code : > > > > Properties environment = new Properties(); > > environment.put("java.naming.factory.initial", > > "org.openejb.client.RemoteInitialContextFactory"); > > environment.put("java.naming.provider.url", "localhost:4201"); > > > > try { > > InitialContext context = new InitialDirContext(environment); > > > > Object o = context.lookup("SampleBean"); > > > > but i got this exception : > > > > javax.naming.AuthenticationException: Cannot read the response from the > > server (OEJP/2.0) : null; nested exception is: > > java.io.OptionalDataException > > at org.openejb.client.JNDIContext.authenticate(JNDIContext.java:196) > > at > > org.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:181) > > > > > > any idea ? > > -- > > sincerely yours > > M. H. Shamsi > > > > -- sincerely yours M. H. Shamsi ------=_Part_15902_3585637.1207638585961 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline openejb3 beta 2 (client and server) is in app lib.

i change my code like this :

        Properties environment = new Properties();
        environment.setProperty(Context.INITIAL_CONTEXT_FACTORY,       "org.apache.openejb.client.RemoteInitialContextFactory");
        environment.put(Context.PROVIDER_URL, "ejbd://localhost:4201");

        try {
            InitialContext context = new InitialContext(environment);

            Object o = context.lookup("SampleBeanRemote");

            System.out.println(o.getClass().getName());
        } catch (NamingException e) {
            e.printStackTrace();
        }


but i got another exception again :

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/ejb/NoSuchEJBException
    at java.lang.ClassLoader.defineClass1(Native Method)


my bean class is SampleBean and it has to interface SampleRemote and SampleLocal

where can i find a  sample to lookup remotely from jndi ???


On Mon, Apr 7, 2008 at 10:53 PM, David Jencks <david_jencks@yahoo.com> wrote:
I get confused by the jndi "directory" part but suspect that one problem is your use of InitialDirContext rather than InitialContext.

Also are you sure you are using the openejb client library that goes with the server?  While we've tried to keep compatibility with older versions there may have been some changes in the authentication bits.... I know there were in the code if not the protocol.

thanks
david jencks


On Apr 7, 2008, at 11:20 PM, Mohammad Shamsi wrote:

Hi All,

in Gmo 2.1, i want to lookup a EJB from a standalone client

i write this code :

       Properties environment = new Properties();
       environment.put("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory");
       environment.put("java.naming.provider.url", "localhost:4201");

       try {
           InitialContext context = new InitialDirContext(environment);

           Object o = context.lookup("SampleBean");

but i got this exception :

javax.naming.AuthenticationException: Cannot read the response from the server (OEJP/2.0) : null; nested exception is:
   java.io.OptionalDataException
   at org.openejb.client.JNDIContext.authenticate(JNDIContext.java:196)
   at org.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:181)


any idea ?
--
sincerely yours
M. H. Shamsi




--
sincerely yours
M. H. Shamsi ------=_Part_15902_3585637.1207638585961--