I have fixed this in the trunk. Messages are logged at the CONFIG level.
Paul.
Craig McClanahan wrote:
> Paul Sandoz wrote:
>> Hi Craig,
>>
>> That is indeed odd. I did a quick search for
>> "java.lang.ClassFormatError: Absent Code attribute" and found this:
>>
>> http://forums.java.net/jive/message.jspa?messageID=226931
>>
>> "I was using the maven artifacts which are seriously stubbed jars.
>> They only let you compile, not link runtime."
>>
>> I wonder if it is the same issue?
>>
>> Note that the client side does not perform any class scanning.
>> However, it does attempt to load components declared in
>> META-INF/services and i am guessing it is hitting a problem loading
>> the message body readers/writers for the MimeMultipart type.
>>
>> What dependency on JavaMail have you declared?
>>
> Well, that's part of the mystery ... I have no direct dependencies on
> any JavaMail stuff in this particular application. I do have a
> declaration for the EE 5 APIs jar (as referenced in the email thread you
> found):
>
> <dependency>
> <groupId>javaee</groupId>
> <artifactId>javaee-api</artifactId>
> <version>5</version>
> <scope>provided</scope>
> </dependency>
>
> When I comment that out and run just my test case class (which doesn't
> yet need any of those APIs), the client create does work ... so this is
> definitely the culprit. Now to figure out how I can avoid that problem,
> because the server part of the app (that I want to test) *does* need
> those APIs at compile time.
>
> Craig
>
>> Paul.
>>
>> On Aug 27, 2008, at 12:46 AM, Craig McClanahan wrote:
>>
>>> I'm trying to set up my first unit test using jersey-client
>>> (0.10-SNAPSHOT, today's code). The Client.create() call throws a
>>> really strange exception, presumably from some problem with a
>>> classpath scan. This is on a Mac (with JDK 1.5), so that might well
>>> be related. Any ideas?
>>>
>>> Craig
>>>
>>> -------------------------------------------------------------------------------
>>>
>>> Test set: com.example.ItemsTestCase
>>> -------------------------------------------------------------------------------
>>>
>>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.107
>>> sec <<< FAILURE!
>>> testTruth(com.example.ItemsTestCase) Time elapsed: 0.072 sec <<<
>>> ERROR!
>>> java.lang.ClassFormatError: Absent Code attribute in method that is
>>> not native or abstract in class file javax/mail/MessagingException
>>> at java.lang.ClassLoader.defineClass1(Native Method)
>>> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>>> at
>>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>>> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>>> at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Class.java:242)
>>> at
>>> com.sun.jersey.spi.service.ServiceFinder$AbstractLazyIterator.hasNext(ServiceFinder.java:544)
>>>
>>> at
>>> com.sun.jersey.spi.service.ServiceFinder.toClassArray(ServiceFinder.java:400)
>>>
>>> at
>>> com.sun.jersey.impl.application.ComponentProviderCache.getServiceClasses(ComponentProviderCache.java:246)
>>>
>>> at
>>> com.sun.jersey.impl.application.ComponentProviderCache.getProviderAndServiceClasses(ComponentProviderCache.java:233)
>>>
>>> at
>>> com.sun.jersey.impl.application.ComponentProviderCache.getProvidersAndServices(ComponentProviderCache.java:121)
>>>
>>> at
>>> com.sun.jersey.impl.application.MessageBodyFactory.getProviderMap(MessageBodyFactory.java:133)
>>>
>>> at
>>> com.sun.jersey.impl.application.MessageBodyFactory.initReaders(MessageBodyFactory.java:107)
>>>
>>> at
>>> com.sun.jersey.impl.application.MessageBodyFactory.init(MessageBodyFactory.java:102)
>>>
>>> at com.sun.jersey.api.client.Client.<init>(Client.java:279)
>>> at com.sun.jersey.api.client.Client.<init>(Client.java:203)
>>> at com.sun.jersey.api.client.Client.create(Client.java:424)
>>> at com.example.ItemsTestCase.setUp(ItemsTestCase.java:23)
>>> at junit.framework.TestCase.runBare(TestCase.java:128)
>>> at junit.framework.TestResult$1.protect(TestResult.java:106)
>>> at junit.framework.TestResult.runProtected(TestResult.java:124)
>>> at junit.framework.TestResult.run(TestResult.java:109)
>>> at junit.framework.TestCase.run(TestCase.java:120)
>>> at junit.framework.TestSuite.runTest(TestSuite.java:230)
>>> at junit.framework.TestSuite.run(TestSuite.java:225)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>> at
>>> org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
>>>
>>> at
>>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>>>
>>> at
>>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>>>
>>> at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>> at
>>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
>>>
>>> at
>>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> <mailto:users-unsubscribe_at_jersey.dev.java.net>
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>> <mailto:users-help_at_jersey.dev.java.net>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109