Solved

How to best deploy Enterprise Java Beans in JBoss AS 5.1

Posted on 2011-09-29
4
442 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SHA2 certs for IIS AND Java? 2 113
String array comparison 4 38
servlet and mdb, jms error 1 39
Regarding swagger API 1 17
This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

820 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