• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

NameNotFoundException in EJB? could anyone tell me?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got a NameNotFoundException in my EJB's client. "javax.naming.NameNotFoundException: myes not bound" ( "myes" is the name of my war).
I depoly a .jar file(EJBs) and a .war file.
The .war contains:
[index.jsp]
-------------------------------------------------
try {
//Properties props = System.getProperties();
//Context ctx = new InitialContext(props);
Context ctx = new InitialContext();
HelloHome lHome = (HelloHome) ctx.lookup("java:comp/env/ejb/myestest/Hello");
Hello hello = lHome.create();
out.println("return:"+hello.hello());
}catch( Exception e ) {
out.println( "Caugth exception: " + e.getMessage() );
e.printStackTrace();
}
-------------------------------------------------
[WEB-INF/web.xml]
-------------------------------------------------
<ejb-ref>
<ejb-ref-name>ejb/myestest/Hello</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.funyear.myes.test.HelloHome</home>
<remote>com.funyear.myes.test.Hello</remote>
</ejb-ref>
-------------------------------------------------
[WEB-INF/jboss-web.xml]
-------------------------------------------------
<ejb-ref>
<ejb-ref-name>ejb/myestest/Hello</ejb-ref-name>
<jndi-name>ejb/myes/Hello</jndi-name>
</ejb-ref>
-------------------------------------------------
The .jar file contains:
[ejb-jar.xml]
-------------------------------------------------
<session >
<description><![CDATA[stateless session bean]]></description>
<ejb-name>com.funyear.myes.test.Hello</ejb-name>
<home>com.funyear.myes.test.HelloHome</home>
<remote>com.funyear.myes.test.Hello</remote>
<ejb-class>com.funyear.myes.test.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
-------------------------------------------------
[jboss.xml]
-------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">;
<jboss>
<enterprise-beans>
<session>
<ejb-name>com.funyear.myes.test.Hello</ejb-name>
<jndi-name>com/funyear/myes/test/Hello</jndi-name>
</session>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>
-----------------------------------------------
and beans.
Is there anyone know why? could you tell me? thank you very much!
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic