File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Starting with Maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Starting with Maven" Watch "Starting with Maven" New topic
Author

Starting with Maven

Witold Marshal
Ranch Hand

Joined: Feb 05, 2012
Posts: 48
I have created Maven project of EJB under Eclipse Environment. Basicly it works fine. Phases "package" and "install" give appropriate result in target directory. But there (in the project) is a file ejb-jar.xml which wasn't created by me but orginally delivered with the build up of archetype. Eclipse indicates an error there (small red square with white cross). It doesn't infleunce compiling of the project but it annoys me a lot. The content of that file (ejb-jar.xml) is like that:



When I open that file (in Eclipse) The Error tip generated by Eclipse says " An EJB module must contain one or more enterprise beans". How can I get rid of it?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

This is more of an Eclipse problem, so I'm moving the question to the Eclipse forum.

Offhand, though, I'd say that the prototype ejb-jar is not conforming to the schema defined at http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd


Customer surveys are for companies who didn't pay proper attention to begin with.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

On second thought, I moved this thread to the EJBs forum, since it's not really likely to be an Eclipse problem, either.
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

Have you created any EJB or the project is empty?


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9915
    
158

Actually, Tim already answered the question:
Tim Holloway wrote:

Offhand, though, I'd say that the prototype ejb-jar is not conforming to the schema defined at http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd


The xsd states that the ejb-jar element is of type ejb-jarType which is a complex type comprised of xs:sequence:



and a xs:sequence by default has a minOccurs of 1 (and maxOccurs = 1). So the enterprise-beans element is expected to be present within the ejb-jar element. The xsd says it all. The ejb-jar.xml is expected to follow that schema.


[My Blog] [JavaRanch Journal]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5811
    
    7

And if you don't want to deal with the ejb-jar.xml file, just delete it! That is, if you are working with EJB3 or later.


JBoss In Action
Witold Marshal
Ranch Hand

Joined: Feb 05, 2012
Posts: 48
to @Palak Mathur
Yes I have created EJB classes in "src/main/resources" but it was not in the way as it works for standard Eclipse EJB project where you can define beans (Session Bean, Message-Driven Bean). Here for Maven EJB project in Eclipse I have no option to add a standard bean in the menu (clicking right button of the mouse). I added my bean class and interface manually by creating them in appropriate folder. Is there a way to do it in more sophistic (better) way?

Perhaps that is why there weren't added appropriate entries in ejb-jar.xml

So, according to your replies I should write appropriate element in <ejb-jar> section. As I see in documentation it should be: <xsd:element name="ejb-jar" type="j2ee:ejb-jarType"> and it will be rather hard for me to add it manually because it comprises so many elements.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Starting with Maven
 
Similar Threads
Steps to convert application from ejb 2.0 to ejb 2.1
eclipse ejb ?
Eclipse,EJb3 and Glassfish V3
What does this error mean?
Help executing an EJB persistence application