Embedded JBoss / Embedded EJB3

From Shrubbery

(Redirected from Embedded EJB3)
Jump to: navigation, search


JBoss can be used inside Tomcat, or inside a plain Java Standard Edition JVM.


Contents

[edit] Overview

Note that there is a new "embedded" product from JBoss called "Embedded JBoss".

This new version is used in Seam 2.0, and the codebase is the JBoss AS 5.x tree.

[edit] Starting Embedded JBoss

See the Embedded JBoss (wiki)

[edit] Jars

When using the Seam 2.x distribution, the following jars should be in the classpath:

  • lib/jboss-embedded-api.jar
  • lib/test/hibernate-all.jar
  • lib/test/jboss-embedded-all.jar
  • lib/test/thirdparty-all.jar

When using the Embedded JBoss distribution, the following jars should be in the classpath (basically all the jars in the 'lib' directory of the Embedded JBoss distribution):

  • lib/hibernate-all.jar
  • lib/jboss-embedded-all.jar
  • lib/jboss-embedded-tomcat-bootstrap.jar
  • lib/jboss-embedded.jar
  • lib/thirdparty-all.jar

[edit] Classpath

The classpath should be in the following order:

  1. Application code - EJB jars, etc.
  2. The bootstrap directory
  3. The Embedded JBoss jars

[edit] JMS Configuration

The new embedded JBoss uses the same configuration files as JBoss 5.x. JMS is configured in hsqldb-persistence-service.xml, and this can be adjusted to work with other databases using the examples shown here.

[edit] Troubleshooting

Warnings you may see, and what to do about them...

[edit] Log4j not initialized properly

Put log4j.xml in the source tree, or otherwise in your classpath.

[edit] WARN - You should use the 2.0 version of the Microcontainer xml

Change the namespace and schema location of the <deployment> element so it looks like this:

<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
            xmlns="urn:jboss:bean-deployer:2.0">

[edit] FATAL - {persistence unit name} JTA

This can be ignored. It's a bad log message in the Hibernate EJB module. Maybe it can be eliminated by upgrading the Hibernate3 jars?

[edit] NPEs and "No such method" errors in Bootstrap.bootstrap()

If Bootstrap.bootstrap() fails with an NPE or a "No such method" error, it is probably due to a classpath problem.

  • Make sure there are no jars from older versions of JBoss in the classpath, such as jboss-system.jar, javassist.jar, jboss-jmx.jar, etc.
  • Make sure the bootstrap directory is present in the classpath.

[edit] JBoss Messaging warnings about transaction isolation level

Solution - Edit the data source definition and add:

<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

[edit] Josh's Notes on using Embedded JBoss

I was using the Embedded EJB3 that came with Seam 1.2.x for the main project at work for some time, and I thought that maybe it would be good to upgrade to the new Embedded JBoss while upgrading to Seam 2.0. After getting most of that working I found that the Embedded JBoss has a bootstrap/deployment issue that prevents it from working properly 100% of the time. When the container bootstraps and deploys it sometimes throws a ConcurrentModificationException. This was very surprising to me, as I has just assumed that the deployment process is essentially single threaded.

Here is a link to the forum topic.

In any case, I reverted back to Embedded EJB3 and live with that until the issue is resolved. Other than that I found that having the same deployment descriptors and application packaging for both embedded and standalone JBoss was very convenient.

[edit] Links

[edit] Embedded JBoss

[edit] Embedded EJB3

Personal tools