tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samuel Ravikumar Thangamuthu, Chennai" <samuel...@hcl.in>
Subject Help needed...
Date Wed, 29 Apr 2009 12:25:29 GMT

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.

-----------------------------------------------------------------------------------------------------------------------
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message