spring-loaded icon indicating copy to clipboard operation
spring-loaded copied to clipboard

Spring boot JDK Problem ? - Problems copying method. Incompatible JVM?

Open slavus opened this issue 10 years ago • 25 comments

I am havening trouble using spring loaded with whatever. I am getting org.springsource.loaded.jvm.JVM : Problems copying method. Incompatible JVM?

Maybe this is JDK issue

the same thing happens if I swap JVM

openjdk version "1.8.0_40" OpenJDK Runtime Environment (build 1.8.0_40-b20) OpenJDK 64-Bit Server VM (build 25.40-b23, mixed mode)

java version "1.7.0_55" OpenJDK Runtime Environment (IcedTea 2.4.8) (suse-24.17.1-x86_64) OpenJDK 64-Bit Server VM (build 24.55-b03, mixed mode)

java version "1.6.0_33" OpenJDK Runtime Environment (IcedTea6 1.13.5) (suse-37.1-x86_64) OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode

Any ideas ?

Here ist stack

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring Boot Web UI Sample 1.2.2.BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:1.2.2.BUILD-SNAPSHOT:run (default-cli) > test-compile @ spring-boot-sample-web-ui >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-boot-sample-web-ui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ spring-boot-sample-web-ui ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ spring-boot-sample-web-ui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/user/github/spring-boot/spring-boot-samples/spring-boot-sample-web-ui/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ spring-boot-sample-web-ui ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< spring-boot-maven-plugin:1.2.2.BUILD-SNAPSHOT:run (default-cli) < test-compile @ spring-boot-sample-web-ui <<<
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.2.2.BUILD-SNAPSHOT:run (default-cli) @ spring-boot-sample-web-ui ---
[INFO] Attaching agents: [/home/user/.m2/repository/org/springframework/springloaded/1.2.0.RELEASE/springloaded-1.2.0.RELEASE.jar]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::  (v1.2.2.BUILD-SNAPSHOT)

2015-01-10 19:28:22.833  INFO 29434 --- [           main] sample.ui.SampleWebUiApplication         : Starting SampleWebUiApplication on XXXXXXXXX with PID 29434 (/home/user/github/spring-boot/spring-boot-samples/spring-boot-sample-web-ui/target/classes started by user in /home/user/github/spring-boot/spring-boot-samples/spring-boot-sample-web-ui)
2015-01-10 19:28:22.946  INFO 29434 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@37574691: startup date [Sat Jan 10 19:28:22 CET 2015]; root of context hierarchy
2015-01-10 19:28:23.146 ERROR 29434 --- [           main] org.springsource.loaded.jvm.JVM          : Problems copying method. Incompatible JVM?

java.lang.reflect.InvocationTargetException: null
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springsource.loaded.jvm.JVM.copyMethod(JVM.java:134)
        at org.springsource.loaded.ri.OriginalClassInvoker.createJavaMethod(OriginalClassInvoker.java:68)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:151)
        at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:140)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:286)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at sample.ui.SampleWebUiApplication.main(SampleWebUiApplication.java:43)
Caused by: java.lang.IllegalArgumentException: Can not copy a non-root Method
        at java.lang.reflect.Method.copy(Method.java:151)
        ... 24 common frames omitted

2015-01-10 19:28:23.149 ERROR 29434 --- [           main] org.springsource.loaded.jvm.JVM          : Problems copying method. Incompatible JVM?

java.lang.reflect.InvocationTargetException: null
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springsource.loaded.jvm.JVM.copyMethod(JVM.java:134)
        at org.springsource.loaded.ri.OriginalClassInvoker.createJavaMethod(OriginalClassInvoker.java:68)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:151)
        at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:140)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:286)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:163)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at sample.ui.SampleWebUiApplication.main(SampleWebUiApplication.java:43)
Caused by: java.lang.IllegalArgumentException: Can not copy a non-root Method
        at java.lang.reflect.Method.copy(Method.java:151)
        ... 24 common frames omitted

2015-01-10 19:28:23.151 ERROR 29434 --- [           main] org.springsource.loaded.jvm.JVM          : Problems copying method. Incompatible JVM?

slavus avatar Jan 10 '15 18:01 slavus

I put in a potential fix, try the 1.2.2 snapshot build that should come out of this build: https://build.spring.io/browse/SL-MAS-113

aclement avatar Mar 05 '15 19:03 aclement

Here is the build: http://repo.spring.io/libs-snapshot-local/org/springframework/springloaded/1.2.2.BUILD-SNAPSHOT/springloaded-1.2.2.BUILD-SNAPSHOT.jar

To test it under grails, what I do is go into the grails folder: grails-2.4.1/lib/org.springframework/springloaded/jars

I then rename the spring loaded jar that is there and put in a symlink to the jar above. It used to be that you could just modify the startGrails script to point to the new version, but now due to the forking I find you need to do the symlink thing. Or drop that jar into this folder and rename it to match the expectations of grails (rename it from springloaded-1.2.2.BUILD-SNAPSHOT.jar to springloaded-1.2.0.RELEASE.jar)

aclement avatar Mar 05 '15 19:03 aclement

ok, thanks. Will give it a try...

Dierk avatar Mar 05 '15 19:03 Dierk

It worked for me! Thanks

volnei avatar Mar 05 '15 19:03 volnei

It appears that with Grails 3.0.0 such a file is no longer in the distribution. Maybe packaged differently?

Dierk avatar Mar 05 '15 20:03 Dierk

Look up at %USER_HOME%.gradle\caches\modules-2\files-2.1\org.springframework\springloaded\1.2.1.RELEASE...

volnei avatar Mar 05 '15 20:03 volnei

Ah - that does it! (How could I possibly overlook that? :-) )

Thanks a lot! Dierk

P.S. I assume, you'll notify Graeme such that he can upgrade before Grails 3.0.0 final goes out...

Am 05.03.2015 um 21:31 schrieb Volnei [email protected]:

Look up at %USER_HOME%.gradle\caches\modules-2\files-2.1\org.springframework\springloaded\1.2.1.RELEASE...

— Reply to this email directly or view it on GitHub.

Dierk avatar Mar 05 '15 20:03 Dierk

I will raise a jira issue... ;-)

volnei avatar Mar 05 '15 20:03 volnei

Done https://jira.grails.org/browse/GRAILS-12042

volnei avatar Mar 05 '15 20:03 volnei

@aclement Any chance of a 1.2.2 release soon?

graemerocher avatar Mar 05 '15 22:03 graemerocher

I knew you'd ask that Graeme, I'll get to it over the next few days :)

aclement avatar Mar 05 '15 23:03 aclement

Thanks!!

graemerocher avatar Mar 06 '15 07:03 graemerocher

@aclement

With 1.2.2 release I get other error: IllegalArgumentException: Can not copy a non-root Field

| Error 2015-03-13 01:50:09,901 [localhost-startStop-1] ERROR jvm.JVM  - Problems copying field. Incompatible JVM?
Message: null
    Line | Method
->>  266 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread

Caused by IllegalArgumentException: Can not copy a non-root Field
->>  266 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread

igor-poteryaev avatar Mar 12 '15 21:03 igor-poteryaev

Copying fields is something different (I addressed copying methods). Do you have a simple app that exhibits the problem?

aclement avatar Mar 12 '15 21:03 aclement

Simplest app to reproduce the copy field problem can be created as:

  1. grails create-app copy-field
  2. replace hibernate4 plugin with hibernate3 (in BuildConfig.groovy and DataSource.groovy) N.B. It is required to use Hibernate3 to reproduce copy field problem

igor-poteryaev avatar Mar 12 '15 21:03 igor-poteryaev

committed a fix for copy field too.

aclement avatar Mar 13 '15 04:03 aclement

@aclement Could we have 1.2.3? ;-)

graemerocher avatar Mar 13 '15 07:03 graemerocher

1.2.3.RELEASE is cut and in repo.spring.io - at the moment I have no idea why the repo.spring.io contents aren't making it to central, I'm doing exactly the same thing as I've always done in the past but it doesn't seem enough now. Can you consume it from repo.spring.io?

aclement avatar Mar 13 '15 15:03 aclement

yeah should be fine.. thanks

graemerocher avatar Mar 13 '15 15:03 graemerocher

hi, I am having the same issue, but not openjdk, I have oracle 1.8.0_40. I tried the solution above, with these differences: -using grails 2.4.4. The existing jar was named springloaded-1.2.1.RELEASE.jar rather than 1.2.0 -instead of symlink I used the rename method, renaming the jar from the 1.2.2.BUILD-SNAPSHOT link above to springloaded-1.2.1.RELEASE.jar

did grails clean & clean-all (don't know if that is necessary, I'm learning grails for the first time), and run-app and still getting the exact same error/stack trace as the original issue.

I'm also a little confused, because I was reading that this was an incompatibility with jdk 1.8.0_40, but it sounds like @slavus tried other java versions and had the same issue? Sorry if I'm misunderstanding here.

rumog avatar Mar 20 '15 06:03 rumog

So one liner to fix Grails installed with GVM in Linux (worked for me with OpenJDK 1.8.0_40-internal-b27): wget repo.spring.io/libs-snapshot-local/org/springframework/springloaded/1.2.3.BUILD-SNAPSHOT/springloaded-1.2.3.BUILD-SNAPSHOT.jar -O ~/.gvm/grails/2.4.4/lib/org.springframework/springloaded/jars/springloaded-1.2.1.RELEASE.jar

Will we get a new Grails 2.4 release?

tommileino avatar Mar 22 '15 09:03 tommileino

Works :) Thanks!

marin-h avatar Sep 16 '15 00:09 marin-h

thanks! worked for me too, copying the newer 1.2.1 springloaded jar and renaming to springloaded-1.2.1.RELEASE.

songlineboy avatar Nov 14 '15 15:11 songlineboy

Thanks,It works

lvicent avatar Dec 11 '16 06:12 lvicent

Oops nevermind. I was using grails-maven-plugin 2.4.3 which was bringing in springloaded 1.2.0. I upgraded to grails-maven-plugin 2.4.6 which uses springloaded-1.2.4 and the issue was resolved.

~~I'm experiencing this issue, but with Grails 2.5.1 (which uses springloaded-1.2.4.RELEASE), and the latest version of Java 8 (build 1.8.0_112). It's all very confusing as most of the comments here seem to indicate that I shouldn't experience this issue in 1.2.4.~~

davidklebanoff avatar Dec 11 '16 21:12 davidklebanoff