geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mohammad Shamsi" <m.h.sh...@gmail.com>
Subject Re: how to lookup ejb from jndi, in a stand alone client. ?
Date Tue, 08 Apr 2008 07:09:45 GMT
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

Mime
View raw message