Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deploying Session Bean

 
Sanjay U Bahrani
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
Christian Jacob Mencias
Greenhorn
Posts: 2
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 2
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic