File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes NameNotFoundException in EJB? could anyone tell me? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "NameNotFoundException in EJB? could anyone tell me?" Watch "NameNotFoundException in EJB? could anyone tell me?" New topic
Author

NameNotFoundException in EJB? could anyone tell me?

frankie huang
Greenhorn

Joined: Dec 17, 2002
Posts: 18
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!
[ December 30, 2002: Message edited by: frankie huang ]
meka toka
Ranch Hand

Joined: Dec 11, 2002
Posts: 75
Hi,
You are getting the NameNotFoundException because you are trying to lookup an object(Hello) in the location (comp/env/ejb/myestest) and your ejb object is not present over there.
Where to look for ::
1. Check and make sure that you are using the same JNDI name that you binded your object with.
go through the following links
a. http://www.jboss.org/online-manual/HTML/ch01s15.html
b. http://www.jboss.org/online-manual/HTML/ch05.html
let me know if you have any more questions
Regards
Meka Toka


Thanks<br />MekaToka<br />SCJP 1.4
frankie huang
Greenhorn

Joined: Dec 17, 2002
Posts: 18
Thank you very much! I got it.
and I found the template project in the jboss is a very good start point for beginer.
Originally posted by meka toka:
Hi,
You are getting the NameNotFoundException because you are trying to lookup an object(Hello) in the location (comp/env/ejb/myestest) and your ejb object is not present over there.
Where to look for ::
1. Check and make sure that you are using the same JNDI name that you binded your object with.
go through the following links
a. http://www.jboss.org/online-manual/HTML/ch01s15.html
b. http://www.jboss.org/online-manual/HTML/ch05.html
let me know if you have any more questions
Regards
Meka Toka
 
Don't get me started about those stupid light bulbs.
 
subject: NameNotFoundException in EJB? could anyone tell me?
 
Similar Threads
javax.naming. NameNotFoundException
NameNotfoundexception
NameNotFoundException in EJB? could anyone tell me?
NameNotFoundException - but the jndi bound
NameNotFoundException and jndi