Hi,
I am trying to create a simple application using Stateless Session Beans, Struts and Hibernate. I use the JBoss Applications server. Everytime I perform a lookup, the program gives me the following error:
Exception ---> javax.naming.NameNotFoundException: ejb not bound
I tried many different xml configurations, but none of them seem to work. Here are details of various xml files.
web.xml:
------------------------------
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
--------------------
jboss.xml
--------------------
<jboss>
<enterprise-beans>
<session>
<description>Session Bean ( Stateless )</description>
<display-name>SchoolEJB</display-name>
<ejb-name>SchoolEJB</ejb-name>
<home>src.SchoolHome</home>
<remote>src.School</remote>
<ejb-class>src.SchoolEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
<ejb-ref>
<ejb-ref-name>ejb/SchoolEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>src.SchoolHome</home>
<remote>src.School</remote>
<ejb-link>SchoolEJB</ejb-link>
</ejb-ref>
</jboss>
---------------
ejb-jar.xml
---------------
<ejb-jar >
<enterprise-beans>
<session>
<description>Session Bean ( Stateless )</description>
<display-name>SchoolEJB</display-name>
<ejb-name>SchoolEJB</ejb-name>
<home>src.SchoolHome</home>
<remote>src.School</remote>
<ejb-class>src.SchoolEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
-------------------------
The client program uses the following lookup options:
---------------------------
Context ctx = getInitialContext();
Object objref = ctx.lookup("ejb/SchoolEJB");
mySchoolHome = (SchoolHome) PortableRemoteObject.narrow(objref, SchoolHome.class);
private Context getInitialContext() throws NamingException
{
Properties properties = null;
String error = "";
properties = new Properties();
properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.provider.url", "jnp://localhost:1099");
properties.put("java.naming.factory.url.pkgs", "org.jboss.naming rg.jnp.interfaces");
try
{
return new InitialContext(properties);
}
catch (NamingException e)
{
System.out.println("ERROR_DTO " +
e.getMessage());
error = "error.servidor.general";
throw new NamingException(error);
}
}
--------------------------------------
Please help me out if anyone knows the solution.
Thanks.
-
problems with java naming (3 messages)
- Posted by: Pratik Patel
- Posted on: July 19 2005 16:00 EDT
Threaded Messages (3)
- problems with java naming by Viktor Sadovnikov on July 21 2005 02:47 EDT
- problems with java naming by Pratik Patel on July 26 2005 13:35 EDT
- In case of the web client by Vijaypal Singh on September 15 2005 08:18 EDT
- problems with java naming by Pratik Patel on July 26 2005 13:35 EDT
-
problems with java naming[ Go to top ]
- Posted by: Viktor Sadovnikov
- Posted on: July 21 2005 02:47 EDT
- in response to Pratik Patel
Try to use:
Context ctx = getInitialContext();
Object objref = ctx.lookup("java:comp/env/ejb/SchoolEJB"); -
problems with java naming[ Go to top ]
- Posted by: Pratik Patel
- Posted on: July 26 2005 13:35 EDT
- in response to Viktor Sadovnikov
Hi Viktor,
I already tried doing that, but such a configuration gives me errors. -
In case of the web client[ Go to top ]
- Posted by: Vijaypal Singh
- Posted on: September 15 2005 08:18 EDT
- in response to Pratik Patel
Try Placing jbossall-client.jar in the Lib of the web App
you shall find this jar in the client folder of JBoss\<config-name>\