Solved

How to best deploy Enterprise Java Beans in JBoss AS 5.1

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GUI builder for Eclipse? 8 36
Running JavaFX on JDeveloper 12C 1 32
Desingning Refactoring existing code 2 24
ejb on wildfly 5 20
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
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 …
The viewer will learn how to implement Singleton Design Pattern in Java.

810 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