All you need is the orion.jar. Here is an example
client:
package com.test;
import java.rmi.RemoteException;
import java.util.*;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.ejb.EJBException;
import javax.ejb.FinderException;
import javax.rmi.PortableRemoteObject;
import javax.naming.*;
public class HelloWorldEJBClient {
public HelloWorldEJBClient() {
try {
Properties env = new Properties();
env.put(
Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory"
);
env.put( Context.PROVIDER_URL,
"ormi://localhost/HelloApp" );
env.put( Context.SECURITY_PRINCIPAL, "admin" );
env.put(Context.SECURITY_CREDENTIALS, "password" );
InitialContext ic = new InitialContext( env );
HelloWorldHome home = (HelloWorldHome)ic.lookup(
"HelloWorld" );
HelloWorld remote = home.create();
String str = remote.printHelloWorld();
System.out.println(str);
}
catch (Exception except) {
except.printStackTrace();
}
}
public static void main(String[] argv) {
HelloWorldEJBClient client = new
HelloWorldEJBClient();
}
}
Good Luck,
Khaled
--- David Libke <[EMAIL PROTECTED]> wrote:
> Peter,
>
> The problem you are experiencing is because the JNDI
> locations need to be
> changed when the location of the client jar is
> changed -- namely change
> 'java:comp/env/' to 'java:hello/client/' or some
> other path that is
> appropriate. 'java:comp/env' is reserved for the
> application server's
> environment resources; thus, a different JNDI entry
> must be created for your
> application client when it is outside of the server.
>
> Good luck on synchronizing all the xml entry names.
>
> Dave
>
> -----Original Message-----
> From: Cugier (extern) [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 18, 2001 11:18 AM
> To: Orion-Interest
> Subject: Which JAR do I need to run an external
> client app
>
>
> Hello,
>
> I have the following problem. I created a Java
> Client application that
> accesses an EJB. I start the client with the
> following batch file.
>
> set
>
CLASSPATH=H:\oc4j\j2ee\home\ejb.jar;.;H:\oc4j\j2ee\home\orion.jar;H:\oc4j\j2
> ee\home\jndi.jar
> java HelloClient
>
> where H:\oc4j\j2ee\home ist the directory where I
> installed the OC4J/Orion
> Server on my computer. When I start the client with
> this batch file
> everything works fine.
>
> As I don't want to install OC4J/Orion on each PC
> where the client should run
> I copied the three JAR file that ar listed in the
> CLASSPATH from
> H:\oc4j\j2ee\home to D:\ExtraJARs. I changed the
> batch file to
>
> set
>
CLASSPATH=D:\ExtraJARs\ejb.jar;.;D:\ExtraJARs\orion.jar;D:\ExtraJARs\jndi.ja
> r
> java HelloClient
>
> After the change I get the following error
>
> javax.naming.NamingException: java:comp/env
> namespace is only available from
> within a J2EE component
> at
>
com.sun.enterprise.naming.java.javaURLContext.getComponentContext(../../src/
>
share/com/sun/enterprise/naming/java/javaURLContext.java:392)
> at
>
com.sun.enterprise.naming.java.javaURLContext.lookup(../../src/share/com/sun
> /enterprise/naming/java/javaURLContext.java:51)
> at
> javax.naming.InitialContext.lookup(Unknown Source)
> at HelloClient.main(HelloClient.java:9)
>
> Can anyone explain why it works when I use the three
> JARs from the
> H:\oc4j\j2ee\home directory but doesn't work when I
> try to use the copied
> JAR files.
>
> Thanks
>
> Peter
>
__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/