tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Tomcat+OpenEJB deploying ear files
Date Tue, 12 May 2009 07:26:00 GMT

On May 9, 2009, at 2:02 PM, Marcelo de Oliveira Dias wrote:

> Thank you David, your answer really helped me.
> Now, I have another doubt. I'm trying to use annotation just as in
> "AnnotatedServlet" example, that comes with the
> The names of my EJB and interface is: Catalogo, CatalogoRemote,
> CatalogoLocal in package org.maruero.ejbs
> The name of my Servlet is: Client in package org.maruero.client.
> Both, the ejb and the servlet are in the same .war.
> Here is my web.xml:
> *<web-app xsi:schemaLocation="
>" metadata- 
> complete="false"
> version="2.4">
>    <display-name>LivrariaClient</display-name>
>    <servlet>
>        <servlet-class>org.maruero.client.Client</servlet-class>
>        <servlet-name>Client</servlet-name>
>    </servlet>
>    <servlet-mapping>
>        <servlet-name>Client</servlet-name>
>        <url-pattern>/Client</url-pattern>
>    </servlet-mapping>
>    <welcome-file-list>
>        <welcome-file>index.html</welcome-file>
>        <welcome-file>index.htm</welcome-file>
>        <welcome-file>index.jsp</welcome-file>
>        <welcome-file>default.html</welcome-file>
>        <welcome-file>default.htm</welcome-file>
>        <welcome-file>default.jsp</welcome-file>
>    </welcome-file-list>
> </web-app>*
> And here is my ejb-jar.xml:
> *<?xml version="1.0"?>
> <!DOCTYPE ejb-jar PUBLIC
>   '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN'
>   ''>
> <ejb-jar>
>    <enterprise-beans>
>        <session>
>            <ejb-name>CatalogoRemote</ejb-name>
>            <remote>org.maruero.ejbs.CatalogoRemote</remote>
>            <home>org.maruero.ejbs.CatalogoLocal</home>
>            <ejb-class>org.maruero.ejbs.Catalogo</ejb-class>
>            <session-type>Stateless</session-type>
>            <transaction-type>Container</transaction-type>
>        </session>
>    </enterprise-beans>
> </ejb-jar>
> *
> When I try to run I receive this exception:
> *javax.servlet.ServletException: Error instantiating servlet class
> org.maruero.client.Client
> cause:
>      javax.naming.NameNotFoundException: Name
> org.maruero.client.Client is not bound in this Context
> *

Hi Marcelo,

I might not understand the issue. Seems like the error that says the  
servlet class cannot be found in JNDI -- no idea what would cause  
Tomcat to look in JNDI for the servlet class.  If none of the  
suggestions below work, a stack trace might help.

It looks like you have some errors in your ejb-jar.xml.  I suspect  
that your app is not an EJB 1.1 app and very likely CatalogoRemote and  
CatalogoLocal are EJB 3.0 business interfaces that do not extend  
javax.ejb.EJBObject and javax.ejb.EJBHome.  If that's the case, here's  
the way you would declare that in xml.

<ejb-jar xmlns=""

          version="3.0" metadata-complete="false">


If I'm right, you should receive some pretty specific validation  
failures from this.  Definitely check the logs.

If you're attempting to lookup the ejb from the servlet, you just need  
an ejb ref in your web.xml to lookup the EJB.  Something like this one  
will work:


Then from the servlet you can lookup the EJB like so:

    InitialContext initialContext = new InitialContext();
    CatalogoLocal catalogoLocal = (CatalogoLocal)  

Hope this is the right information for you.  Let me know if I  
misunderstood your intentions.


View raw message