Solved

How to best deploy Enterprise Java Beans in JBoss AS 5.1

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now