Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

javax.naming. NameNotFoundException

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
I am new to EJB i am using Weblogic6.1,Windows 2000, j2ee1.3, j2sdk1.4.
When i run my client HelloClient.java
Exception thrown is
javax.naming.NameNotFoundException:

HelloClient.java

package examples;
import javax.ejb.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
// Example of Client Code invokes methods on a simple
// stateless session bean;
public class HelloClient{
public static void main(String[] args)
{
try{
Properties props = System.getProperties();
Context ctx = new InitialContext(props);
System.out.println(" 3 ");
Object obj = ctx.lookup("Hello");
System.out.println(" 4 ");
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);
System.out.println(" 5 ");
Hello hello = home.create();
System.out.println(hello.hello());
hello.remove();
}catch(Exception e){
System.out.println("the error is " + e);
}
}
}

weblogic-ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN'
'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>Hello</ejb-name>
<jndi-name>Hello</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>

ejb-jar
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Hello</ejb-name>
<home>examples.HelloHome</home>
<remote>examples.Hello</remote>
<ejb-class>examples.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
thanks in advance

Elango
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you remember to set the target for your ejb? If so, did you confirm your ejb deployed successfully in weblogic? You can do this by looking in the weblogic.log for your server.
Could a moderator move this to the WebLogic Forum?
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!