maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <Joerg.Schai...@scalaris.com>
Subject Re: MEAR: Exception while deploying the app...Invalid ejb jar
Date Thu, 25 Oct 2012 06:32:51 GMT
Hi Derek,

snekse wrote:

> I'm hoping someone can shed some light on this.  When I package my ear
> using maven-ear-plugin 2.7, I'm able to deploy without an issue.  If I
> update my pom to use maven-ear-plugin v2.8, I cannot deploy the ear and I
> receive the error below in my Glassfish 3.1.2.2 server logs:
> 
> remote failure: Error occurred during deployment: Exception while
> deploying the app [mycoservicesear] : Invalid ejb jar
> [mycoservicesejb.jar]: it contains zero ejb.
> Note:
> 1. A valid ejb jar requires at least one session, entity (1.x/2.x style),
> or message-driven bean.
> 2. EJB3+ entity beans (@Entity) are POJOs and please package them as
> library jar.
> 3. If the jar file contains valid EJBs which are annotated with EJB
> component level annotations (@Stateless, @Stateful, @MessageDriven,
> @Singleton), please check server.log to see whether the annotations were
> processed properly.. Please see server.log for more details.
> Command deploy failed.
> 
> 
> This error is preceded by warnings such as this.
> 
> [#|2012-10-23T17:33:01.374-0500|WARNING|glassfish3.1.2|global|
_ThreadID=86;_ThreadName=Thread-7;|Error
> in annotation processing: java.lang.NoClassDefFoundError:
> com/myco/services/business/PersonService|#] (NOTE: Defined in
> mycoservicesclient)
> 
> 
> Our mycoservices project looks like this:
> 
> mycoservices
> |-mycoservicesclient
> |-mycoservicescore
> |-mycoservicesear
> |-mycoservicesejb
> |-mycoserviceswar
> 
> When I explode the resulting ears, the biggest difference I notice is in
> the MANIFEST.MF of the mycoservicesejb.jar.  The 2.7 version has
> mycoservicesclient.jar and all of the other Maven dependencies listed for
> Class-Path.  The 2.8 version has nothing listed.

What about you're talking now? The mycoservicesejb.jar has been generated by 
the maven-ejb-plugin and not by the maven-ear-plugin. I am not aware that 
the maven-ear-plugin replaces anything in the jars of the dependent EJB 
components.

> From what I've read in
> the release notes for
> 
2.8<http://jira.codehaus.org/secure/ReleaseNote.jspa?projectId=11132&version=18269>,
> nothing seems to point towards this kind of change.
> 
> Any clarification of what's going on, and more importantly, what the right
> way to configure things to work on 2.8 (preferably with an explanation of
> why) would be greatly appreciated.

Normally the structure of an EAR contains a "lib" directory where all the 
jars reside that can be used in the EJBs classpath, while the EJBs are in 
the root of the EAR structure. However, Maven has historically put any jar 
into the EARs root and therefore forced the jar with the EJB to contain a 
manifest that listed all dependencies in its Class-Path entry. Note, that 
this entry is not actually a name only, it is the complete path in the EAR 
structure.

It seems that for the new version something has been changed for the 
generated default "application.xml". That triggers your app server to look 
now for the EJB's dependencies in the wrong place.

Try to define the "defaultJavaBundleDir" to "lib". After we did that we 
could create our EJB jars without the nasty "Class-Path" entry in the 
manifest. If you still want this entry in the manifest of your EJBs, you 
must configure a "classpathPrefix" of "lib/" in the ejb-plugin's 
archive/manifest configuration. Your ear should end up with a structure 
like:

mycoservices.ear
+ mycoservices.ejb
+ lib/
  + mycoservicescore.jar
+ META-INF/
  + application.xml

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message