Solved

How to best deploy Enterprise Java Beans in JBoss AS 5.1

Posted on 2011-09-29
4
446 Views
Last Modified: 2012-05-12
Hello,

We are trying to migrate a web application from an earlier version of JBoss AS to JBoss AS 5.1GA. A .war, a .sar and a .jar have been migrated smoothly. However there is an .ejb3 archive we are trying to migrate and deploy is giving us a problem. The .ejb3 archive contains the following:

[1] persistence.xml in META-INF
[2] the entity beans using EJB3 annotations
[3] the session beans using EJB3 annotations

We realize that JBoss AS 5.1 did not deploy the FooBarbeans.ejb3 archive. When we tried the FooBarbeans.jar, which contains the same files as the .ejb3 archive, JBoss did recognize the archive. However, when we try to start, JBoss gives the following error message:


DEPLOYMENTS MISSING DEPENDENCIES:
  Deployment "jboss.j2ee:jar=FooBarbeans.jar,name=ExampleBean,service=EJB3" is missing the following dependencies:
    Dependency "<UNKNOWN jboss.j2ee:jar=FooBarbeans.jar,name=ExampleBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#FooFolder' **")
  Deployment "jboss.j2ee:jar=FooBarbeans.jar,name=ExampleBean,service=EJB3_endpoint" is missing the following dependencies:
    Dependency "jboss.j2ee:jar=FooBarbeans.jar,name=ExampleBean,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")
   ...

Open in new window



      All beans are not deployed.

Note that FooFolder is a folder inside FooBarbeans.jar containing the entity and session beans.

The error message refers to a dependency problem in persistence.xml.

The following is the likely portion of the persistence.xml that is causing the problem.


<persistence
	xmlns="http://java.sun.com/xml/ns/persistence"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
	version="1.0">

<persistence-unit name="FooFolder">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/@datasource_jndi_name@</jta-data-source>
 
	<class>FooFolder.entity.ExampleBean</class>
			... 
			all other entity beans

 <properties>
	 	<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
	 	<property name="hibernate.hbm2ddl.auto" value="update"/>
  </properties>
</persistence-unit>
</persistence>

Open in new window



We tried searching goolge, reading through various books (JBOSS, EJB3, etc...), yet have not determined a clear path to migrate this archive. We will be grateful for any detailed suggestions or links to any examples.

Currently clear answers to the following questions would help us make some progress:
1) Shall we migrate to a .jar archive instead of .ejb3?
2) When we migrate to .ejb3, .jar or a .ear file, what xml files do we need to add or modify?

0
Comment
Question by:gwheato200
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 20

Expert Comment

by:a_b
ID: 36890986
The issue is that the ejb3 jar files probably does not have the correct folder structure for deployment. Can you post the folder structure and the manifest file?
0
 

Author Comment

by:gwheato200
ID: 36892277
Thanks for your quick response!  Here is the folder structure and the manifest file that you requested.

FooBarBeans.jar

            --> META_INF
                        --> MANIFEST.MF
                  --> persistence.xml
            -->Foo
                  -->Beans
                        -->Bar
                              -->entity which holds all the entity beans
                              --> session which holds all the session beans.

This is the information found in the MANIFEST.MF document:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_20-b20 (Sun Microsystems Inc.)

Open in new window

0
 

Author Comment

by:gwheato200
ID: 36893300
The last paragraph of the initial post/question should have been written as follows:

Currently clear answers to the following questions would help us make some progress:
1. Shall we migrate the .ejb3 archive to a .jar, .ear or some other type of archive file?
2. When we migrate the .ejb3 archive file to a .jar, .ear or some other type of archive file, what xml files or other types of files should we need to add or modify?
0
 
LVL 20

Accepted Solution

by:
a_b earned 500 total points
ID: 36907849
The packaging looks okay. The other issues could be that you manifest and xml files donot follow the right format.
JBoss AS 5 has a strict check. Look into that.

Also as per the error - Dependency "<UNKNOWN jboss.j2ee:jar=FooBarbeans.jar,name=ExampleBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#FooFolder' **")
  Deployment "jboss.j2ee:jar=FooBarbeans.jar,name=ExampleBean,service=EJB3_endpoint" is missing the following dependencies:

Your persistence.xml might be incorrectly setup. Can you post the code for that?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question