tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From freeway <...@qad.com>
Subject Problems deploying EJBs in embedded Tomcat OpenEJB
Date Fri, 13 Nov 2009 17:37:30 GMT

I am new to OpenEJB and to EJBs in general, attempting to set up a Tomcat
6.0.16 environment to use embedded OpenEJB 3.1.2.  My objective is port an
existing JEE application to run as a single webapp inside Tomcat, with
OpenEJB loading and managing access to its EJBs.  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.

The problem is that after Tomcat startup, which does not show any errors in
the Tomcat logs, the application is unable to access any EJBs from JNDI.  I
expect I have configuration problems, and have searched the forums as well
as the OpenEJB documentation extensively for related posts and examples, but
the mixture of fragmentary current and stale information that available has
been difficult for an EJB newbie like myself to use.

Here is the JNDI error from the webapp at run-time.  The application is
looking up the name 'lsbpm/LsBpmEjbFrontDesk', so I presume that the full
name is being constructed by OpenEJB.

javax.naming.NameNotFoundException: Name
"Deployment/lsbpm/LsBpmEjbFrontDesk/com.oakgrovesystems.reactor.frontDesk.EJBFrontDesk!Remote"
not found.


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"/>


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>


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.

  <servlet>
    <servlet-name>LoaderServlet</servlet-name>
   
<servlet-class>org.apache.openejb.tomcat.loader.LoaderServlet</servlet-class>
    <init-param>
      <param-name>openejb.home</param-name>
      <param-value>${catalina.base}/lsbpm/openejb</param-value>
    </init-param>
    <init-param>
      <param-name>openejb.loader</param-name>
      <param-value>LsBpmServer-webapp</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>

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.


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/" />


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
http://openejb.apache.org/
context path = /LsBpmServer
context path = /openejb
...

After startup, the JNDI viewer in the openejb webapp does not show any of my
EJBs.  To compound the problem, I have been unable to increase the OpenEJB
log level by overriding the embedded.logging.properties file with my own
jndi.properties file as described in the OpenEJB documentation.  Whether I
place the override file in the openejb lib/, openejb WEB-INF/classes, or
$CATALINA_HOME/lib directories, it does not affect the log output.  Is this
a known OpenEJB issue?

Please provide any hints you can.  I can obviously provide much more detail,
but did not want to overload this post until I knew what was most relevant. 
I expect that I have simply misunderstood the configuration that is
necessary to use embedded OpenEJB.

Thx in advance.
-- 
View this message in context: http://old.nabble.com/Problems-deploying-EJBs-in-embedded-Tomcat-OpenEJB-tp26340393p26340393.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message