0

When I migrated java 7 to java 8, I see following exception. It works very well with java 7 but not with java8, could you help me on this.

Environment: java 8 and wildfly 8.2

> Caused by: org.jboss.classfilewriter.InvalidBytecodeException: Cannot
> load variable at 0. Local Variables: Local Variables: []  at
> org.jboss.classfilewriter.code.CodeAttribute.aload(CodeAttribute.java:185)
>   at
> org.jboss.invocation.proxy.ProxyFactory$ProxyMethodBodyCreator.overrideMethod(ProxyFactory.java:86)
>   at
> org.jboss.invocation.proxy.AbstractSubclassFactory.overrideMethod(AbstractSubclassFactory.java:106)
>   at
> org.jboss.invocation.proxy.AbstractSubclassFactory.addInterface(AbstractSubclassFactory.java:363)
>   at
> org.jboss.invocation.proxy.ProxyFactory.generateClass(ProxyFactory.java:286)
>   at
> org.jboss.invocation.proxy.AbstractClassFactory.buildClassDefinition(AbstractClassFactory.java:207)
>   at
> org.jboss.invocation.proxy.AbstractClassFactory.defineClass(AbstractClassFactory.java:160)
>   at
> org.jboss.invocation.proxy.AbstractProxyFactory.getCachedMethods(AbstractProxyFactory.java:150)
>   at
> org.jboss.as.ejb3.component.stateless.StatelessComponentDescription$3.configure(StatelessComponentDescription.java:150)
>   at
> org.jboss.as.ee.component.DefaultComponentViewConfigurator.configure(DefaultComponentViewConfigurator.java:68)
>   at
> org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81)
>   ... 6 more
Sam
  • 131
  • 1
  • 5

1 Answers1

0

It looks like it might be similar to WFLY-4316, which has a resolution of 9.0.0.Beta1.

Also, InvalidBytecodeException in WildFly 8 may be relevant:

This exception had nothing to do with the class WildFly complained about ... For some reason, lambdas don't work ...

Community
  • 1
  • 1
ipsi
  • 2,049
  • 18
  • 23
  • I never used lambdas any more in code but still see this error when I switch java 7 to java8. It looks to me wildfly 8.2 wrongly validating byte code version during ear deployment. – Sam Jul 27 '16 at 17:04
  • is there a better way to find why wildfly treats so and so class contains InvalidByte Code...(again no lambdas and no java8 features added in code) – Sam Jul 27 '16 at 17:06
  • Might be worth at least trying Wildfly 9.0.0.Beta1 and seeing if that solves your problem - I don't know much about Wildfly, but given these errors are all in the same area of code, fixing one could have fixed yours as well. – ipsi Jul 27 '16 at 17:06
  • Compare the bytecode that Java 7 produced (you can use `javap` for that) against that which Java 8 produced - any differences would suggest that WF can't handle certain opcodes or something introduced in Java 8. – ipsi Jul 27 '16 at 17:08
  • Thank you. is there any way to tell java8 compiler not to generate lambdas version of byte code for non lambdas source code if at all it tries to generate that way?. Also, is wildfly 8.2 support java8 at all? – Sam Jul 27 '16 at 18:08
  • I just de-compiled the class file and saw source code doesn't contain any lambdas(simple pojo ejb3 bean). – Sam Jul 27 '16 at 18:38