geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: how to lookup ejb from jndi, in a stand alone client. ?
Date Tue, 08 Apr 2008 07:43:10 GMT
There's an extremely eclipse-centric tutorial at http:// 
cwiki.apache.org/GMOxDOC21/developing-an-application-client-to-access- 
ejb.html.  It looks to me as if it does have a lot of information on  
how to write the app if you are willing to either use eclipse or skip  
the eclipse instructions.

I think there may be a sample in the testsuite but I'm not sure where.

I don't recall seeing the error you get before.  What jvm are you  
using?  Is the geronimo-ejb_3.0_spec jar in your client classpath?

thanks
david jencks

On Apr 8, 2008, at 12:09 AM, Mohammad Shamsi wrote:

> 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