This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EXCEPTION "Name Not Found Exception: ejb not bound "

 
suchi verma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
I have deployed my enterprise application on jboss-3.2.2.
It consists of an session bean which is accessed using a Servlet.
The servlet is in a seperate .war file and the ejb's in a .jar file.
However when I call the servlet which inturn calls the session bean.
I get the following error--
javax.naming.NameNotFoundException: ejb not bound
I have double checked my jboss.xml and the servlet lookup().
They both are the same.
The servlet code is-----
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException{

try {
/*Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL,"localhost:1099");////chetak:8080/
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");
Context ctx = new InitialContext(props);*/
Context ctx = new InitialContext();
Object obj=ctx.lookup("java:comp/env/ejb/beans/SimpleBean");
SimpleHome home = (SimpleHome)PortableRemoteObject.narrow(obj,SimpleHome.class);
} catch (Exception NamingException) {
System.out.println("initexception is"+NamingException);}

try {
res.setContentType("text/html");
PrintWriter out=res.getWriter();
out.println("calling session bean");
Simple test = home.create();
if (test != null)
out.println("<br>Completed creation of remote EJBObject");
else
out.println("<br>Create returned null");
String s = test.getMessage();
out.println("<br>EJB Message: " + s);
out.close();
----------------------------------------------------------------
jboss.xml
<ejb-ref-name>beans/Simple</ejb-ref-name>
<jndi-name>ejb/beans/SimpleBean</jndi-name>
what could be the problem...
I have been trying this since 2 weeks.
please help!
 
Walker Rustin
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I sometimes get this message when I start jboss without any deployment. More often than not the root cause is some kind of network error. Undeploy the application and restart jboss. Make sure that jobss starts properly.
Good luck!
- Walk
 
suchi verma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnx wallker...
will give it a try.
 
suchi verma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi walker
As u said I undeployed my ejb application and restarted jboss.
Then i deployed my ejb application.
BUT when I call the client servlet I get the follwing error on my log
name.notfound.exception:ejb not bound.
It fails to print the bean message.
What could be the problem???
plz reply.
 
romeo juliet
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please print the whole exception along with deployment descriptor, jboss.xml, web.xml and jboss-web.xml .
Let's see what comes up!
 
romeo juliet
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this out. The author didn't post the solution though.
http://jboss.org/index.html?module=bb&op=viewtopic&t=49359
Cheers.
- Roger
 
suchi verma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WEB.XML
=================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp_ID">
<servlet id="Servlet_1082170647969">
<servlet-name>ClientServlet1</servlet-name>
<servlet-class>beans.ClientServlet1</servlet-class>
</servlet>
<servlet-mapping id="ServletMapping_1082170647971">
<servlet-name>ClientServlet1</servlet-name>
<url-pattern>/ClientServlet1</url-pattern>
</servlet-mapping>
<welcome-file-list id="WelcomeFileList_1082170647972">
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
=================================================
JBOSS-WEB.XML
==================================================
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
<jboss-web id="jboss-web">
<ejb-ref>
<ejb-ref-name>beans/SimpleBean</ejb-ref-name>
<jndi-name>ejb/SimpleHome</jndi-name>
</ejb-ref>
</jboss-web-app>
====================================================
JBOSS.XML
=====================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss_2_4.dtd">
<jboss id="jboss">
<enterprise-beans id="ejb_bean">
<session id="my_session_ejb">
<ejb-name>beans/SimpleBean</ejb-name>
<jndi-name>ejb/SimpleHome</jndi-name>
</session>
</enterprise-beans>
</jboss>
===========================================================

HERES THE LOG MESSAGE
=======================
5-09 19:23:21,784 INFO [STDOUT] exception isjavax.naming.NameNotFoundException: ejb not bound
2004-05-09 19:23:21,789 INFO [STDOUT] do post exception isjava.lang.NullPointerException

Hope this suffices
 
roger verma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is very good. I would like to be able to make somthing simmilar. I am just switchig frum windows to linux and freebsd. Do you and am tinking of using java. Do you know of where i can learn how to make tools like this.
thanks
roger verma
 
Sunil Verma
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking for the answer to same question.
Can anybody please update me on this.
 
martin Grofcik
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have similar problem,

When I restart JBoss it works, after some time of inactivity I obtained the error.

when I call EJB from servlet I obtained name not bound,
same result is from EJB application.

Martin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic