tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Problems deploying EJBs in embedded Tomcat OpenEJB
Date Fri, 13 Nov 2009 23:16:37 GMT
I think this might be a case of doing too much.  If we can retrace  
your steps and find the sources of information you used, we should be  
able remove or update them.

The only steps required are the four steps listed here:

On Nov 13, 2009, at 9:37 AM, freeway wrote:

> All the EJB classes are
> packaged in a single JAR file that is part of the webapp.  The code  
> is not
> written with injection or any annotations, and I am defining the EJB  
> objects
> to the webapp entirely using the XML files WEB-INF/web.xml,
> META-INF/context.xml, META-INF/ejb-jar.xml, and
> $CATALINA-HOME/conf/openejb.xml.

Put the ejb-jar.xml in the jar where your ejbs live just like you  
would if the war was an ear file.

In the future this won't be required, but it is currently.

> Here is the relevant EJB reference from the webapp's web.xml.
>      <ejb-ref>
>        <ejb-ref-name>lsbpm/LsBpmEjbFrontDesk</ejb-ref-name>
>        <ejb-ref-type>Session</ejb-ref-type>
>        <home>com.oakgrovesystems.reactor.frontDesk.EJBFrontDeskHome</ 
> home>
>        <remote>com.oakgrovesystems.reactor.frontDesk.EJBFrontDesk</ 
> remote>
>      </ejb-ref>


> Here is the relevant EJB configuration element from context.xml.
>   <Ejb name="lsbpm/LsBpmEjbFrontDesk" auth="Container" type="Session"
>     home="com.oakgrovesystems.reactor.frontDesk.EJBFrontDeskHome"
>     remote="com.oakgrovesystems.reactor.frontDesk.EJBFrontDesk"
>     factory="org.openejb.client.TomcatEjbFactory"
> openejb 
> .naming 
> .factory 
> .initial="org.apache.openejb.client.LocalInitialContextFactory"
>     openejb.ejb-link="lsbpm/LsBpmEjbFrontDesk"/>

This will cause problems and should be removed.  We will actually do  
all this kind of work for you automatically.

We've tried to prevent people from doing this by wiping it from out  
documentation leaving only a "do not use this" page:

If you can let us know where you saw this, we can try and get it  

> Here is (I think) the relevant configuration from a much longer ejb- 
> jar.xml.
> <ejb-jar id="LsBpmEjb_jar">
>  ...
>  <enterprise-beans>
>    <session id="LsBpmEjbFrontDesk">
>      <ejb-name>lsbpm/LsBpmEjbFrontDesk</ejb-name>
>      <home>com.oakgrovesystems.reactor.frontDesk.EJBFrontDeskHome</ 
> home>
>      <remote>com.oakgrovesystems.reactor.frontDesk.EJBFrontDesk</ 
> remote>
> <ejb-class>com.oakgrovesystems.reactor.frontDesk.EJBFrontDeskBean</ 
> ejb-class>
>      <session-type>Stateless</session-type>
>      <transaction-type>Container</transaction-type>
>      ...
>    </session>
>  ...
>  </enterprise-beans>
>  ...
> <ejb-jar>

Looks good.

> Here is the loader servlet definition from the openejb webapp, which  
> I did
> not think was necessary but added nonetheless for testing purposes  
> based on
> some documentation that I found.

Adding that will cause problems and it should be removed from your  
webapp.  If you can point us at the documentation you found that  
recommended, we can definitely update it.

> The EJB JAR file, which contains a META-INF/ejb-jar.xml file, is  
> saved in
> the directory ${catalina.base}/lsbpm/openejb/apps/.  I also left a  
> copy in
> the WEB-INF/lib/ directory of my webapp.

Having the jar file in the WEB-INF/lib/ should be all you need.

> Finally, the $CATALINA_HOME/conf/openejb.xml file has not been  
> modified, and
> contains a Deployments element at the bottom referencing the EJB  
> directory
> location.
> <Deployments dir="apps/" />

All relative directories in the openejb.xml are resolved relative to  
openejb.base, which in Tomcat will be the same as catalina.base.  So  
you could put apps in ${catalina.base}/apps/.  Though really it's far  
more convenient to just include everything needed in the webapp.

> The Tomcat stdout log entries on startup are as follows.
> OpenEJB init-params:
> 	param-name: openejb.home, param-value: C:\Program Files\Apache  
> Software
> Foundation\Tomcat 6.0/lsbpm/openejb
> 	param-name: openejb.loader, param-value: LsBpmServer-webapp
> log4j:WARN No appenders could be found for logger (OpenEJB.options).
> log4j:WARN Please initialize the log4j system properly.
> Apache OpenEJB 3.1.2    build: 20091010-03:11
> context path = /LsBpmServer
> context path = /openejb
> ...

The output above will go away once you remove the LoaderServlet and  
let the openejb.war do all the loading.  As well any issues with beans  
not loading *should* go away.

> I have been unable to increase the OpenEJB
> log level by overriding the file with my  
> own
> file as described in the OpenEJB documentation.

Looks like we need to be more explicit and I can see where this  
confusion could come from.  Using OpenEJB in another server like  
Tomcat or Geronimo or as a standalone server is very different than  
embedding OpenEJB in a plain Java SE environment using the JNDI  

For Tomcat, the logging configuration should be automatically added to  

I hope this helps.  Thank you for providing such a complete email.  It  
definitely gives us some better on what issues we need to steer people  
away from and how to better define the Tomcat/OpenEJB path.


View raw message