You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Derry Cannon <d3...@gmail.com> on 2008/01/24 00:27:11 UTC

JUnit tests requiring j2ee.jar fail when running mvn surefire:test

Hey, there!

I've got a JUnit 4.2 test that tests a simple little email address
validator.  The validator uses javax.mail.internet.InternetAddress.
Everything works fine in Eclipse when I run it as a JUnit Test.  However,
when I try to install the project containing the JUnit test, it fails on the
surefire:test with the following:

java.lang.ClassFormatError: Absent Code attribute in method that is not
native or abstract in class file javax/mail/internet/AddressException.

Can anyone suggest what to do differently to make the JUnit test run
properly during the surefire:test?

Thanks much!
Derry

Re: JUnit tests requiring j2ee.jar fail when running mvn surefire:test

Posted by Stephen Connolly <st...@gmail.com>.
By the way, the individual component jars that go to make up j2ee.jar are
fine, so all you need to do is figure out which parts of the j2ee spec you
need and include the relevant artifact, i.e. mail, servlet, ejb, etc

On Jan 24, 2008 8:59 AM, Stephen Connolly <st...@gmail.com>
wrote:

> Don't use the borked j2ee.jar from the java.net or java.net2 maven
> repositories.
>
> I had the same problem.  Basically, the j2ee.jar on the java.net repos is
> not a real jar, just stripped classes that have no method bodies, but just
> the method definitions.
>
> The borked jar is only good for compiling. I had an argument with the guy
> who posted it where I pointed out
> "why-the-f*ck-would-you-want-a-jar-that-you-cannot-run-unit-tests-against-in-a-maven-repository"
> and he seemed to think that not running unit tests was a perfectly valid use
> case and sure nobody using maven runs unit tests all the time, and sure
> could they not just compile and package the jar...
>
> He did not seem to get the whole lifecycle thing about maven2 at all
>
>
> On Jan 23, 2008 11:27 PM, Derry Cannon <d3...@gmail.com> wrote:
>
> > Hey, there!
> >
> > I've got a JUnit 4.2 test that tests a simple little email address
> > validator.  The validator uses javax.mail.internet.InternetAddress.
> > Everything works fine in Eclipse when I run it as a JUnit Test.
> >  However,
> > when I try to install the project containing the JUnit test, it fails on
> > the
> > surefire:test with the following:
> >
> > java.lang.ClassFormatError: Absent Code attribute in method that is not
> > native or abstract in class file javax/mail/internet/AddressException.
> >
> > Can anyone suggest what to do differently to make the JUnit test run
> > properly during the surefire:test?
> >
> > Thanks much!
> > Derry
> >
>
>

Re: JUnit tests requiring j2ee.jar fail when running mvn surefire:test

Posted by Stephen Connolly <st...@gmail.com>.
Don't use the borked j2ee.jar from the java.net or java.net2 maven
repositories.

I had the same problem.  Basically, the j2ee.jar on the java.net repos is
not a real jar, just stripped classes that have no method bodies, but just
the method definitions.

The borked jar is only good for compiling. I had an argument with the guy
who posted it where I pointed out
"why-the-f*ck-would-you-want-a-jar-that-you-cannot-run-unit-tests-against-in-a-maven-repository"
and he seemed to think that not running unit tests was a perfectly valid use
case and sure nobody using maven runs unit tests all the time, and sure
could they not just compile and package the jar...

He did not seem to get the whole lifecycle thing about maven2 at all

On Jan 23, 2008 11:27 PM, Derry Cannon <d3...@gmail.com> wrote:

> Hey, there!
>
> I've got a JUnit 4.2 test that tests a simple little email address
> validator.  The validator uses javax.mail.internet.InternetAddress.
> Everything works fine in Eclipse when I run it as a JUnit Test.  However,
> when I try to install the project containing the JUnit test, it fails on
> the
> surefire:test with the following:
>
> java.lang.ClassFormatError: Absent Code attribute in method that is not
> native or abstract in class file javax/mail/internet/AddressException.
>
> Can anyone suggest what to do differently to make the JUnit test run
> properly during the surefire:test?
>
> Thanks much!
> Derry
>

RE: JUnit tests requiring j2ee.jar fail when running mvn surefire:test

Posted by "Beelen, M. - SPLXL" <Ma...@klm.com>.
Hello,

For my j2ee-components I use the jars provided by geronimo for building 
To solve you problem you could switch to the following:

  <dependency>
      <groupId>org.apache.geronimo.javamail</groupId>
      <artifactId>geronimo-javamail_1.4_mail</artifactId>
      <version>1.3</version>
  </dependency>  
 
This will add a jar containing the
javax.mail.internet.AddressException.class.

With kind regards,
  Marco Beelen


-----Original Message-----
From: Derry Cannon [mailto:d3rryc@gmail.com] 
Sent: Thursday, January 24, 2008 12:27 AM
To: users@maven.apache.org
Subject: JUnit tests requiring j2ee.jar fail when running mvn
surefire:test

Hey, there!

I've got a JUnit 4.2 test that tests a simple little email address
validator.  The validator uses javax.mail.internet.InternetAddress.
Everything works fine in Eclipse when I run it as a JUnit Test.
However, when I try to install the project containing the JUnit test, it
fails on the surefire:test with the following:

java.lang.ClassFormatError: Absent Code attribute in method that is not
native or abstract in class file javax/mail/internet/AddressException.

Can anyone suggest what to do differently to make the JUnit test run
properly during the surefire:test?

Thanks much!
Derry
**********************************************************************
For information, services and offers, please visit our web site:
http://www.klm.com. This e-mail and any attachment may contain
confidential and privileged material intended for the addressee
only. If you are not the addressee, you are notified that no part
of the e-mail or any attachment may be disclosed, copied or
distributed, and that any other action related to this e-mail or
attachment is strictly prohibited, and may be unlawful. If you have
received this e-mail by error, please notify the sender immediately
by return e-mail, and delete this message. 

Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries
and/or its employees shall not be liable for the incorrect or
incomplete transmission of this e-mail or any attachments, nor
responsible for any delay in receipt.
Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal
Dutch Airlines) is registered in Amstelveen, The Netherlands, with
registered number 33014286 
**********************************************************************

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