>From my limited experience with the J2EE RI server, you don't need to
pass a Properties object to the InitialContext constructor, just:
Context initial = new InitialContext();
If your J2EE RI server is on a different machine than your client, you
have to set an environment property before running your client. I think
this is a strange way of doing it instead of the documented way you were
describing.
Roslan
Brian Williams wrote:
>
> I have a couple of EJBs. I used the Sun J2EE 1.2.1 deploytool to create a
> .jar file. They run fine using Sun's j2ee...
> Now I'm writing a Servlet in ATG Dynamo. I want these droplets/servlets to
> call, via JNDI, remote methods in our EJBs. Ran into some problems using
> ATG Dynamo's "runDarina" tool trying to install my j2ee ejb's within their
> application server.... I know that in the Java code of my servlet I have to
> have something like:
>
> java.util.Properties env = new java.util.Properties ();
> env.setProperty (Context.INITIAL_CONTEXT_FACTORY,
> "<...my ejb's context...>");
> env.setProperty (Context.PROVIDER_URL,
> "<my j2ee provider url");
>
> Context initial = new InitialContext(env);
>
> But how do I determine "<...my ejb's context...>" and "<my j2ee provider
> url"?? I think I can determine the latter from the output that I see when I
> run "j2ee -verbose" :
>
> J2EE server Listen Port: = 1049
> Naming service started: :1050
> Published the configuration object ...
> ....
> Web service started: 9191
> Web service started: 8000
> Web service started: 7000
> Loading
> jar:/D:/j2sdkee1.2.1/repository/lu/applications/av983554636728Server.jar
> /D:/j2sdkee1.2.1/repository/lu/applications/av983554636728Server.jar
> Looking up authenticator...
> Created Context:/SearchContextRoot
> Binding name:`java:comp/env/ejb/Search`
> J2EE server startup complete.
>
> But how do I determine my EJB's INITIAL_CONTEXT_FACTORY?? Now in my EJB I
> have this:
>
> public void ejbCreate() {
> }
>
> Do I need to, in order for the Servlet to get my EJB's
> INITIAL_CONTEXT_FACTORY, change it to something like:
>
> public void ejbCreate()
> throws CreateException, RemoteException {
> Hashtable env = new Hashtable();
> env.put(Context.INITIAL_CONTEXT_FACTORY,
> "com.blah.jndi.BlahContextFactory");
> try{
> ctx = new InitialContext(env);
> }catch(Exception e) {
> System.out.println("create exception: "+e);
> }
> }
>
> and then in my servlet code put:
>
> env.setProperty (Context.INITIAL_CONTEXT_FACTORY,
> "com.blah.jndi.BlahContextFactory");
>
> ???
>
> Or can I set the INITIAL_CONTEXT_FACTORY name using the Sun J2EE deploytool?
>
> Thanks,
> / Brian
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".