EJBs 2.0 on OpenEJB - Where do I put the required jars?

We used WAS 6.1 to deploy our web applications. Now we need to switch to the cost-effective Tomcat + OpenEJB solution. The OpenEJB 3.1.2 container is connected to Tomcat 6.18, without a separate OpenEJB server.

So, here I am trying to deploy my EJB 2.1 objects to OpenEJB ...

My problem is that external .jar libraries are required for EJB code, and I don’t know where to put them so that they are actually taken into account in the container class path. It works great in catalina.home / lib, so it works in openejb.home / lib. But still, I would rather find a way to pack EJBs so that they are easily deployed with .jar bindings that are inserted into place that will be used by the OpenEJB container.

It may include creating .ear or .jar with the correct descriptor files ... Any solution that works is enough for me.

Can anyone help?

+3
source share
2 answers

Ear approach

You can simply paste it into the Tomcat Webapps / directory and it will be raised.

Ear example (valid):

myapplication.ear
  lib/
  lib/libraryOne.jar
  lib/libraryTwo.jar
  redEjbs.jar
  blueEjbs.jar

General error (invalid):

myapplication.ear
  libraryOne.jar  (err. not a javaee module)
  libraryTwo.jar  (err. not a javaee module)
  redEjbs.jar
  blueEjbs.jar

Only Java EE modules are allowed in the root directory. These are EJB banks, .war files, Connector.rar files, and Application Client banners. Prior to Java EE 5, libraries must be explicitly specified in the application.xml file. Java EE 5 and forward, they can be added to the lib / directory, and they can be understood as simple banks, and not for the Java EE module.

Collapsed EAR Approach

OpenEJB/Tomcat . Java EE 6.

mywebapp.war
  WEB-INF/lib/libraryOne.jar
  WEB-INF/lib/libraryTwo.jar
  WEB-INF/lib/redEjbs.jar
  WEB-INF/lib/blueEjbs.jar

, :

mywebapp.war
  WEB-INF/lib/javax.ejb.jar   (err. clashes with the related system library)
  WEB-INF/lib/libraryOne.jar
  WEB-INF/lib/libraryTwo.jar
  WEB-INF/lib/redEjbs.jar
  WEB-INF/lib/blueEjbs.jar

, , .

, :

tomcat/lib/libraryTwo.jar

mywebapp.war
  WEB-INF/lib/libraryOne.jar
  WEB-INF/lib/redEjbs.jar
  WEB-INF/lib/blueEjbs.jar

, . libraryTwo.jar libraryOne.jar, , Tomcat "lib" "webapp", Two.jar . , vm , , , . bean .

+4

. , . EAR , , , , Tomcat 6.0.18 J2EE 6. , , , . EAR.

EAR , . Ejb, /lib . Tomcat EJB, EJB Jar Two.

application.xml, EJB:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ...>
<application>
  <display-name>ProxyaEAR</display-name>
  <module id="EjbModule">
     <ejb>ProxyaEJB.jar</ejb>
  </module>
</application>

?

0

Source: https://habr.com/ru/post/1769494/


All Articles