You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by snekse <sn...@gmail.com> on 2012/10/24 16:45:30 UTC

MEAR: Exception while deploying the app...Invalid ejb jar

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.  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.

Thanks,
-Derek

Re: MEAR: Exception while deploying the app...Invalid ejb jar

Posted by snekse <sn...@gmail.com>.
Done done.  A rebuild, re-deploy and some magic pixie dust and I now have a
working app.  Thanks to all for the help.

On Thu, Oct 25, 2012 at 11:42 AM, snekse <sn...@gmail.com> wrote:

> Issue resolved (well, kind of).
>
> Following Jörg's advice, I added
>  <defaultLibBundleDir>lib</defaultLibBundleDir> to the maven-ear-plugin
> config.  I also removed <addClasspath>true</addClasspath> from the
> maven-ejb-plugin since the files are now in /lib.  After doing a mvn *
> clean* install, my ear only contained my ejb jar and war.  It had a /lib
> dir with the jars I would expect to see in there.
>
> ...however...
>
> The application no longer works.  When I submit a request to the REST
> service in my war, I'm getting an exception.  Digging into that.  Might not
> have anything to do with how my ear is packaged.
>
>
> On Thu, Oct 25, 2012 at 10:48 AM, Wayne Fay <wa...@gmail.com> wrote:
>
>> >> Can you run the Glassfish Verifier tool
>> > My GF 3.1.2 doesn't seem to contain this tool.  When I try to deploy
>> with
>> > the "verify" option checked, the process and logs don't tell me any
>> > additional information.
>>
>> The GF Verifier is (was?) really a nice tool to help solve these types
>> of problems. I would see if perhaps Netbeans has it integrated now or
>> if it is a separate download for GF v3. I assume the GF Users list
>> could help you here.
>>
>> Wayne
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

Re: MEAR: Exception while deploying the app...Invalid ejb jar

Posted by snekse <sn...@gmail.com>.
Issue resolved (well, kind of).

Following Jörg's advice, I added
 <defaultLibBundleDir>lib</defaultLibBundleDir> to the maven-ear-plugin
config.  I also removed <addClasspath>true</addClasspath> from the
maven-ejb-plugin since the files are now in /lib.  After doing a mvn
*clean*install, my ear only contained my ejb jar and war.  It had a
/lib dir with
the jars I would expect to see in there.

...however...

The application no longer works.  When I submit a request to the REST
service in my war, I'm getting an exception.  Digging into that.  Might not
have anything to do with how my ear is packaged.

On Thu, Oct 25, 2012 at 10:48 AM, Wayne Fay <wa...@gmail.com> wrote:

> >> Can you run the Glassfish Verifier tool
> > My GF 3.1.2 doesn't seem to contain this tool.  When I try to deploy with
> > the "verify" option checked, the process and logs don't tell me any
> > additional information.
>
> The GF Verifier is (was?) really a nice tool to help solve these types
> of problems. I would see if perhaps Netbeans has it integrated now or
> if it is a separate download for GF v3. I assume the GF Users list
> could help you here.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: MEAR: Exception while deploying the app...Invalid ejb jar

Posted by Wayne Fay <wa...@gmail.com>.
>> Can you run the Glassfish Verifier tool
> My GF 3.1.2 doesn't seem to contain this tool.  When I try to deploy with
> the "verify" option checked, the process and logs don't tell me any
> additional information.

The GF Verifier is (was?) really a nice tool to help solve these types
of problems. I would see if perhaps Netbeans has it integrated now or
if it is a separate download for GF v3. I assume the GF Users list
could help you here.

Wayne

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


Re: MEAR: Exception while deploying the app...Invalid ejb jar

Posted by snekse <sn...@gmail.com>.
> Can you run the Glassfish Verifier tool
My GF 3.1.2 doesn't seem to contain this tool.  When I try to deploy with
the "verify" option checked, the process and logs don't tell me any
additional information.


> What other differences (other than timestamps) are you finding?
* 1.8 ear file size is smaller.
* There was an auto-generated empty persistance.xml in mycoservicesclient
module.  That file is included in the jar when packaging with MEAR 2.7, but
not 2.8.
* The manifest for the ear has different ordering of items and the
created-by now includes the maven version number in 2.8.
* The manifest for the ejb jar has different ordering, and as mentioned, no
values for the class-path in 2.8.

Why the jars for mycoservicesclient and mycoservicesejb change when I just
change the version of MEAR is what seems strangest to me.

> Dumb question: why is there anything at all in the Manifest?
I'm not sure that's a dumb question.  To be honest, I've never bothered
much to look at the manifests before, so I'm not entirely sure what should
and shouldn't be in each one.  I'm new to the ear thing (coming from
Spring/Tomcat).  Right now all of our dependant jars are at the root of the
ear (This is touched on by Jörg in his response).  That seemed
unconventional, but I don't have a good arguement to convince others that
it should be structured any differently.  As for how the dependencies made
it into the manifest, my guess is something about our pom config (again,
Jörg seems to point to that as the reason).

If you're interested, here is what's in the manifest for the classpath.
Class-Path: mycoservicesclient.jar ehcache-core.jar slf4j-api.jar
commons-io.jar commons-lang3.jar hamcrest-all.jar mycoservicescore.jar
json-simple.jar mycocommon.jar mycodatasourceclient.jar commons-dbutils.jar
commons-configuration.jar commons-lang.jar commons-logging.jar
commons-beanutils.jar commons-codec.jar mvel2.jar guava.jar


> It seems that for the new version something has been changed for the
generated default "application.xml".
The application.xml didn't change between the 2 ears.
  <?xml version="1.0" encoding="UTF-8"?>
  <application ... version="6">
    <display-name>mycoservicesear</display-name>
    <module><ejb>mycoservicesejb.jar</ejb></module>
    <module><web>
      <web-uri>mycoserviceswar.war</web-uri>
      <context-root>mycoservices</context-root>
     </web></module>
  </application>

Since the pom configurations come into play, I've pasted the relevant
sections of several of the poms here: http://pastebin.com/FiPFGxmb

> Your ear should end up with a structure like...
Am I correct in assuming the mycoservicesclient.jar should also go in lib?
It just contains @Local interfaces and @Entity POJOs.

> Try to define the "defaultJavaBundleDir" to "lib".
Thanks, I'll give that a shot.

Re: MEAR: Exception while deploying the app...Invalid ejb jar

Posted by Jörg Schaible <Jo...@scalaris.com>.
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


Re: MEAR: Exception while deploying the app...Invalid ejb jar

Posted by Wayne Fay <wa...@gmail.com>.
> 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:

It is always possible that this is simply a bug and you're the first
to notice it.

> remote failure: Error occurred during deployment: Exception while deploying
> the app [mycoservicesear] : Invalid ejb jar [mycoservicesejb.jar]: it
> contains zero ejb.

I've seen this before myself. I had problems in my ejb jar. Can you
run the Glassfish Verifier tool against the various jar, war, ear
files and see what it complains about?

> 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

Biggest or only difference? What other differences (other than
timestamps) are you finding?

Wayne

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