You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "Samuel Ravikumar Thangamuthu, Chennai" <sa...@hcl.in> on 2009/04/29 14:25:29 UTC

Help needed...

Hi,

 

  I am using Eclipse and Weblogic App Server to run "HelloWorld"
Application. I have written everything correctly but when I run the
application it shows the error "Error
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial". 

 

But when I include the code "
System.setproperty("java.naming.factory.initial","weblogic.jndi.TengahIn
itialContextFactory");

It says that "weblogic.jndi.TengahInitialContextFactory" could not be
instantiated. The below is the Client program. I am struck and not able
to proceed. Please help me to overcome this.

 

package com.mypack;

 

import java.util.*;

import java.util.Properties;

import javax.naming.InitialContext;

import javax.naming.Context;

import javax.naming.*;

import java.rmi.*;

import javax.rmi.PortableRemoteObject;

 

public class HelloClient {

      public static void main(String a[]){

            try{

            

 
System.setProperty("java.naming.factory.initial","weblogic.jndi.TengahIn
itialContextFactory");

 
System.setProperty("java.namimg.provider.url","http://10.104.26.37:7001"
);

                  

            InitialContext initialContext = new InitialContext();

            System.out.println(" CONTEXT GOT");

            

            Object ref =  initialContext.lookup("HelloWorldHome");

            System.out.println(" REFERENCE GOT");

            

            HelloWorldHome home =
(HelloWorldHome)PortableRemoteObject.narrow(ref, HelloWorldHome.class);

 

            HelloWorld myHelloWorld = home.create();

            System.out.println(" Calling EJB ...");

            

            String message = "";

            message = myHelloWorld.sayHello();

            

            System.out.println("The message is "+message);

      

      }catch(Exception e){

            System.err.println(" Error "+e);

            System.exit(2);

      }

}

      

}

 

 

Thanks in advance, <https://km.hcl.in/goodpractices> 

Samuel.T <https://km.hcl.in/goodpractices> 

<http://km.hcl.in/goodpractices> 

 



DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

Re: Help needed...

Posted by Mohammad Nour El-Din <no...@gmail.com>.
Hi Samuel...

  We are so glad to send this question to us, but this list is for
OpenEJB users and general EJB questions. I think it is better to read
the WebLogic reference documents.

On Wed, Apr 29, 2009 at 3:25 PM, Samuel Ravikumar Thangamuthu,
Chennai <sa...@hcl.in> wrote:
>
> Hi,
>
>
>
>  I am using Eclipse and Weblogic App Server to run "HelloWorld"
> Application. I have written everything correctly but when I run the
> application it shows the error "Error
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial".
>
>
>
> But when I include the code "
> System.setproperty("java.naming.factory.initial","weblogic.jndi.TengahIn
> itialContextFactory");
>
> It says that "weblogic.jndi.TengahInitialContextFactory" could not be
> instantiated. The below is the Client program. I am struck and not able
> to proceed. Please help me to overcome this.
>
>
>
> package com.mypack;
>
>
>
> import java.util.*;
>
> import java.util.Properties;
>
> import javax.naming.InitialContext;
>
> import javax.naming.Context;
>
> import javax.naming.*;
>
> import java.rmi.*;
>
> import javax.rmi.PortableRemoteObject;
>
>
>
> public class HelloClient {
>
>      public static void main(String a[]){
>
>            try{
>
>
>
>
> System.setProperty("java.naming.factory.initial","weblogic.jndi.TengahIn
> itialContextFactory");
>
>
> System.setProperty("java.namimg.provider.url","http://10.104.26.37:7001"
> );
>
>
>
>            InitialContext initialContext = new InitialContext();
>
>            System.out.println(" CONTEXT GOT");
>
>
>
>            Object ref =  initialContext.lookup("HelloWorldHome");
>
>            System.out.println(" REFERENCE GOT");
>
>
>
>            HelloWorldHome home =
> (HelloWorldHome)PortableRemoteObject.narrow(ref, HelloWorldHome.class);
>
>
>
>            HelloWorld myHelloWorld = home.create();
>
>            System.out.println(" Calling EJB ...");
>
>
>
>            String message = "";
>
>            message = myHelloWorld.sayHello();
>
>
>
>            System.out.println("The message is "+message);
>
>
>
>      }catch(Exception e){
>
>            System.err.println(" Error "+e);
>
>            System.exit(2);
>
>      }
>
> }
>
>
>
> }
>
>
>
>
>
> Thanks in advance, <https://km.hcl.in/goodpractices>
>
> Samuel.T <https://km.hcl.in/goodpractices>
>
> <http://km.hcl.in/goodpractices>
>
>
>
>
>
> DISCLAIMER:
> -----------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
> this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
> this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
> received this email in error please delete it and notify the sender immediately. Before opening any mail and
> attachments please check them for viruses and defect.
>
> -----------------------------------------------------------------------------------------------------------------------



-- 
----
Thanks
- Mohammad Nour
- LinkedIn: http://www.linkedin.com/in/mnour
----
"Life is like riding a bicycle. To keep your balance you must keep moving"
- Albert Einstein