aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Deploying Session Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Deploying Session Bean" Watch "Deploying Session Bean" New topic
Author

Deploying Session Bean

Sanjay U Bahrani
Greenhorn

Joined: Mar 16, 2005
Posts: 2
Hi All,

I am deploying a simple Hello Session Bean. I created an jar archive that contains the ejb-jar.xml in metainf folder. The below shows the ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>
<enterprise-beans>
<session>
<display-name>HelloWorld</display-name>
<ejb-name>HelloWorld</ejb-name>
<ejb-class>exapmple.HelloBean</ejb-class>
<remote>example.Hello</remote>
<home>example.HelloHome</home>
<local>example.HelloLocal</local>
<local-home>example.HelloLocalHome</local-home>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>

When i am deploying the jar archive i am getting the following error:

[Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application HelloWorld on b2bsys1.: Exception:weblogic.management.ApplicationException: Prepare failed. Task Id = 3 Module: HelloWorld Error: [EJB:011024]The XML parser encountered an error in your deployment descriptor. Please ensure that your deployment descriptor corresponds to the format in the DTD. The error was: Error parsing file 'META-INF/ejb-jar.xml' at line: 32 column: 13. The content of element type "session" must match "(description?,display-name?,small-icon?,large-icon?,ejb-name,home?,remote?,local-home?,local?,ejb-class,session-type,transaction-type,env-entry*,ejb-ref*,ejb-local-ref*,security-role-ref*,security-identity?,resource-ref*,resource-env-ref*)".. .


It seems there is a problem in ejb-jar.xml. Can you tell IS there anything that i am doing wrong.

Thanks in advance.

Sanjay.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

Sanjay,
Welcome to JavaRanch!

The XML tags need to be in the same order as those specified in the DTD. So remote, local-home and local need to be before ejb-class. (There may be others at of order, but you get the idea.)


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Christian Jacob Mencias
Greenhorn

Joined: Feb 11, 2011
Posts: 2

Good day,

I'm also encountering problem with my Stateless Session Bean (EJB 2.0) I developed using Eclipse.
From Eclipse IDE, I've used Web Logic 10.3.5 as my target runtime.

It seems there's no problem with the class files, but there is below error which is related to the ejb-jar.xml deployment descriptor.

Is there something missing in the DD?

Thanks in advance.

The ejb-jar.xml:


The error reported by IDE when I publish:




===================
Christian Jacob Mencias
OCPJP6, OCPWCD5
Christian Jacob Mencias
Greenhorn

Joined: Feb 11, 2011
Posts: 2

Hi,

I was able to correct the problem with below fix.

Basically, I made sure the DD is following below ordering of elements:
(description?,display-name?,small-icon?,large-icon?,enterprise-beans,relationships?,assembly-descriptor?,ejb-client-jar?)

New ejb-jar.xml
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deploying Session Bean
 
Similar Threads
Error while deploying ear in WEBLOGIC 8.1.3
Problem deploying ejbs in weblogic
deployment problem
Error deploying ejb in JBoss 5
ejb-jar.xml