[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to best deploy Enterprise Java Beans in JBoss AS 5.1

Posted on 2011-09-29
4
Medium Priority
?
450 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
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 …
Suggested Courses

656 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