• Post Reply Bookmark Topic Watch Topic
  • New Topic

problems with naming  RSS feed

 
patrick patel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your jboss.xml doesnt look right. There is NO jndi-name specified for your ejb in the jboss.xml file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!