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

View: New views
6 Messages — Rating Filter:   Alert me  

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

by Derry Cannon-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

by Stephen Connolly-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

by Stephen Connolly-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <stephen.alan.connolly@...>
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 <d3rryc@...> 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

by Beelen, M. - SPLXL :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...]
Sent: Thursday, January 24, 2008 12:27 AM
To: users@...
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@...
For additional commands, e-mail: users-help@...


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

by simon.kitching@chello.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

---- Stephen Connolly <stephen.alan.connolly@...> schrieb:

> 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

Sigh. Thanks for trying Stephen..

Wouldn't this be a good case for a classifier? eg
  <classifier>apionly</classifier>

Then people who want this strange compile-but-not-run dependency can have it...

Regards, Simon


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


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

by Wayne Fay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, its a perfect use case for classifier. I just wish they'd use it...

As Marco already pointed out, the Geronimo dependencies are much more
useful than the API-only j2ee.jar file. I use them in all my J2EE
projects.

Wayne

On 1/24/08, Simon Kitching <simon.kitching@...> wrote:

> ---- Stephen Connolly <stephen.alan.connolly@...> schrieb:
> > 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
>
> Sigh. Thanks for trying Stephen..
>
> Wouldn't this be a good case for a classifier? eg
>   <classifier>apionly</classifier>
>
> Then people who want this strange compile-but-not-run dependency can have
> it...
>
> Regards, Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

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