[Resin-interest] java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/ServletException

2012-12-14 Thread Rick Mann
I've been working on this Spring-based webapp. It was originally a servlet-2.5, 
XML-configured webapp that ran great under Resin and I had a nice 
spring-test-mvc-based test class for it, and it all worked well.

After upgrading it to servlet-3.0, and using only annotations to configure (no 
XML!), the webapp works, but I can't get my test class to work. I'm fairly sure 
I still haven't configured it correctly, but in the Spring forums I'm being 
told that I'm linking against the javaee-web-api 6.0 jar, which contains no 
implementation.

While this is true, it was also true before the configuration changes. So the 
guy (a fair expert on Spring) tells me it must be due to some JAR load order 
difference that's causing the error to appear now. Thing is, in the test 
environment, I don't have any part of resin involved. I don't know where else I 
might be getting an implementation.

The exception is

[junit] java.lang.ClassFormatError: Absent Code attribute in method that is 
not native or abstract in class file javax/servlet/ServletException
[junit] at java.lang.ClassLoader.defineClass1(Native Method)
...
[junit] at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:230)
...
[junit] at 
org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
[junit] at 
org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:105)
...

So, I'm just curious if anyone here can shed some light on how this can come to 
be.

Thanks!


-- 
Rick




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/ServletException

2012-12-14 Thread Scott Ferguson
On 12/14/12 1:41 AM, Rick Mann wrote:
 I've been working on this Spring-based webapp. It was originally a 
 servlet-2.5, XML-configured webapp that ran great under Resin and I had a 
 nice spring-test-mvc-based test class for it, and it all worked well.

 After upgrading it to servlet-3.0, and using only annotations to configure 
 (no XML!), the webapp works, but I can't get my test class to work. I'm 
 fairly sure I still haven't configured it correctly, but in the Spring forums 
 I'm being told that I'm linking against the javaee-web-api 6.0 jar, which 
 contains no implementation.

 While this is true, it was also true before the configuration changes. So the 
 guy (a fair expert on Spring) tells me it must be due to some JAR load order 
 difference that's causing the error to appear now. Thing is, in the test 
 environment, I don't have any part of resin involved. I don't know where else 
 I might be getting an implementation.

Try looking at System.getProperty(java.class.path). That might help 
track down the jar order.

jar order can sometimes be random, depending on how the classpath is built.

 The exception is

  [junit] java.lang.ClassFormatError: Absent Code attribute in method that 
 is not native or abstract in class file javax/servlet/ServletException
  [junit]  at java.lang.ClassLoader.defineClass1(Native Method)

That's a very strange error message.

It shouldn't even be possible with normal complication.

It seems to be saying that someone took a post-processor to a compiled 
class that stripped out parts of the .class file, specifically the 
Code attribute, which is the part of the .class file that contains the 
actual code for a method.

So whatever jar is containing that class is a weird/broken jar.

-- Scott
  ...
  [junit]  at 
 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:230)
  ...
  [junit]  at 
 org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
  [junit]  at 
 org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:105)
  ...

 So, I'm just curious if anyone here can shed some light on how this can come 
 to be.

 Thanks!




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest