Pregunta

My main aim is to migrate an EJB 2.x application written for WebSphere to a web application deployable for Tomcat server. But I want to this as nearly one-to-one migration.

So I set up a TomEE (apache-tomee-plus-1.0.0) and keep the configuration of the sub-directory '/apps' as deployment directory.

When I put a '*.war' file to the '/apps' directory OpenEJB successfull unpack the archive and load it. But I see no EJB loading in the logs. I think OpenEJB ignores the 'ejb-jar.xml' in '/apps/BdbWeb/META-INF'.

Log-Snip:

INFO main OpenEJB.startup.config - Extracting jar: C:\Entwicklung\apache-tomee-plus-1.0.0\apps\BdbWeb.war
INFO main OpenEJB.startup.config - Extracted path: C:\Entwicklung\apache-tomee-plus-1.0.0\apps\BdbWeb
DEBUG main OpenEJB.options - Using default 'openejb.tempclassloader.skip=none'  Possible values are: none, annotations, enums, all or NONE or ALL
DEBUG main OpenEJB.options - Using default 'openejb.webservices.enabled=true'
DEBUG main OpenEJB.options - Using default 'tomee.jaxrs.deploy.undeclared=false'
DEBUG main OpenEJB.options - Using default 'openejb.webservices.enabled=true'
DEBUG main OpenEJB.options - Using default 'openejb.check.classloader=false'
INFO main OpenEJB.options - Using 'openejb.descriptors.output=false'
INFO main OpenEJB.options - Using 'openejb.descriptors.output=false'
INFO main OpenEJB.options - Using 'openejb.validation.output.level=VERBOSE'
INFO main OpenEJB.startup.config - Enterprise application "C:\Entwicklung\apache-tomee-plus-1.0.0\apps\BdbWeb.war" loaded.

When I add at least one Annotation (e.g. @Remote or @Stateful) to a Java class I see corresponding log entries. So OpenEJB found Annotations.

But there are many classes and a big ejb-jar.xml file! I want to avoid to manually put the correct Annotation to each class ... ! So I hope you can help me to find the error.

Maybe it is a structure issue? I have the following structure in the war file:

  • BdbWeb.war
    • pages
      • *.jsp
    • images
      • *.jpg
    • META-INF
      • ejb-jar.xml
      • MANIFEST.MF
      • openejb-jar.xml (created by hand; hoped this would help - but that's not the case)
    • stylesheet
      • *.css
    • WEB-INF
      • classes
        • de
          • directories with the classes
        • log4j.xml
        • hibernate.cfg.xml
      • lib
        • *.jar
      • web.xml
    • index.jsp

I already set the openejb.servicemanager.enabled property in 'system.properties' file to true but this generated just an xml file with no entity or bean entries.

What have I to do to get the given ejb-jar.xml used by OpenEJB?

BTW: Is the self-created 'openejb-jar.xml' really necessary ...?

¿Fue útil?

Solución

Only a small tweak required: Java EE 7 required location for the "EJBs in .WARs" feature is WEB-INF/ejb-jar.xml

Would be a good idea for us to check for this and issue a warning. I created a ticket for it here

Side notes:

  • No, the openejb-jar.xml is not necessary
  • Setting openejb.servicemanager.enabled is also not necessary

Did you see something in the documentation that indicated openejb.servicemanager.enabled was required in TomEE? If so, a pointer to the doc would be great -- I'll make sure it's removed.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top