Velocity Reviews

Velocity Reviews (
-   Java (
-   -   javax.naming.NameNotFoundException (

cheepu 10-12-2010 07:23 AM

I am new to ejb. I tried to run the code from the link

I created a jar with greetBean.class greetHome.class and greetRemote.class and put the ejb-jar.xml and jboss.xml in META-INF folded and created a jar and deployed in JBOSS5.

********* code of ejb-jar.xml ********

<?xml version="1.0"?>

Container </transaction-type>

************* code of jboss.xml ********************/

<?xml version='1.0' ?>


Now from Tomcat I am tring to access this bean. For this I created a servlet whose code is given below.
But I am getting the following error in the tomcat server screen
"javax.naming.NameNotFoundException: greetJndi not bound"

I am not getting this is the configuration eror or the directory structure of jar that I deploied in JBoss is wrong.
Any one can help to resolve the problem?

cheepu 10-12-2010 07:24 AM

Code for the Servlet class is as follows:

public class greetServlet extends HttpServlet
public void doPost
HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException
PrintWriter out=res.getWriter();
Properties props=new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
System.out.println("Properties ok");
Context ctx=new InitialContext(props);
System.out.println("context ok");
greetHome home = (greetHome)
System.out.println("home ok");
greetRemote remote=home.create();
System.out.println("remote ok");
String a = req.getParameter("text1");
String s = remote.greetme(a);
catch(Exception e)

All times are GMT. The time now is 12:55 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.