Michael Nascimento Santos opened SPR-10292 and commented
When trying to initialize Tomcat with JDK 8 lambda b76:
Caused by: java.lang.IllegalArgumentException
at org.springframework.asm.ClassReader.<init>(Unknown Source)
at org.springframework.asm.ClassReader.<init>(Unknown Source)
at org.springframework.asm.ClassReader.<init>(Unknown Source)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:52)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:257)
... 47 more
Affects: 3.2 GA
Referenced from: commits https://github.com/spring-projects/spring-framework/commit/d3a406876834b91a4cf3b1e840855caeb0446d28, https://github.com/spring-projects/spring-framework/commit/5e64723e0291e216b403d234a0677837bf69ffb1, https://github.com/spring-projects/spring-framework/commit/265c0c1505dafdbbd7391367081f1d6eddd5c47e
1 votes, 10 watchers
Comment From: spring-projects-issues
Juergen Hoeller commented
Ouch, looks like ASM runs into some unexpected Java 8 byte code there. That ClassReader class is just a repackaged version of ASM 4.0, so I guess we'll have to wait for an ASM version that's compatible with Java 8.
As you probably know, we have a strong Java 8 focus for Spring Framework 4.0 anyway. We'll try to sort this one out for 4.0 M1 (scheduled for release at the end of April; nightly snapshots to be available earlier).
For the time being, if you avoid component scanning and explicitly register your component classes instead, you still have a chance of getting quite far with Spring Framework 3.2.x on the current JDK 8 milestones.
Juergen
Comment From: spring-projects-issues
Michael Nascimento Santos commented
Well, I am migrating a project that has around 100 components, so this isn't practical at the moment, unless there is some automated way of doing that.
I guess if this is not available by the time 4.0M1 is out, basically no one will be able to give it a try for JDK 8 features.
Comment From: spring-projects-issues
Juergen Hoeller commented
Looks like ASM simply stumbles across class file version 52 (-target 1.8), throwing the IllegalArgumentException for that reason. Unfortunately the ASM guys don't care too much about that, fixing it in the non-released ASM 5.0 branch only - and who knows when that one will see the light of day - probably not in time for our 4.0 M1.
See http://forge.ow2.org/tracker/index.php?func=detail&aid=316375&group_id=23&atid=350023 for the discussion over there at the ASM project.
We might patch ASM ourselves then, at least making it accept the JDK 8 class file format. Not sure whether we can roll this into 3.2.2 though. In any case, we'll catch that IllegalArgumentException and will wrap it in a more meaningful exception. After all, we'll have the same problem again once the JDK 9 byte code format appears...
As a general note: JDK 8 isn't even in developer preview yet. I would argue that our 4.0 M1 is quite ambitious in having JDK 8 support. I'm not aware of any other framework that is even trying at this time, which raises concerns about quite a few that we're integrating with (in particular, persistence providers such as Hibernate).
Juergen
Comment From: spring-projects-issues
Juergen Hoeller commented
Fixed for 4.0 M1 through a locally embedded version of ASM 4.1 which has been patched accordingly (simply through removing the bytecode check assertion).
Juergen
Comment From: spring-projects-issues
David Harrigan commented
Fantastic!! Thank you Juergen - can't wait to start using our new projects with Spring 4.0 and Java 8! :-)
-=david=-
Comment From: spring-projects-issues
Ben Romberg commented
Is this available in any SNAPSHOT build yet? I tried yesterday's 4.0.0.WEBSOCKET-SNAPSHOT build, but it still uses the IllegalArgumentException in the Bytecode.
Comment From: spring-projects-issues
Juergen Hoeller commented
Unfortunately, the master snapshots keep failing due to JDK setup issues. The CI server's JDK 8 setup works now, but we keep getting javadoc errors using JDK 8's javadoc task.
Note that the websocket branch hasn't got any JDK 8 support in it yet. You'll need to use a regular 4.0.0-SNAPSHOT once it is published; that might not happen before tomorrow :-(
Juergen
Comment From: spring-projects-issues
Juergen Hoeller commented
After a few days of fighting with it, the build seems to work fine now, and the first JDK 8 based Spring Framework 4.0.0 snapshot has just been published!
Juergen
Comment From: spring-projects-issues
Ben Romberg commented
Cool, thanks for the info! I'll give it a shot tomorrow!
Comment From: spring-projects-issues
Yossi Shaul commented
Thanks for the fix. Do you plan to backport it to version 3.2.x?
Comment From: spring-projects-issues
Craig Cattell commented
Any update on spring 3 backport. Because has deprecated stuff in 4.0 it would be a major project for us to go to spring 4.0, but we would like to use java 1.8