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

idea14+spring-boot(maven)+spring-loaded+java8 no effect

Open mysoko opened this issue 10 years ago • 2 comments

env:

  • jdk1.8.0.45
  • idea14.1.3
  • spring-boot-1.2.3-RELEASE
  • spring-loaded-1.2.3-RELEASE

vm options: -javaagent:/Users/li/Downloads/springloaded-1.2.3.RELEASE.jar -noverify image

After the configuration, the console first line has a hint: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java -..../Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.

But changing the code has no effect, why?

mysoko avatar May 29 '15 07:05 mysoko

This is not an error with spring-loaded, but is actually a JDK issue:

There are many reports out there, for example:

http://stackoverflow.com/questions/18794573/objc10012-class-javalaunchhelper-is-implemented-in-both-libinstrument-dyl/18958973#18958973

It’s harmless but annoying.

BOB

On 29 May 2015, at 5:23 pm, mysoko [email protected] wrote:

env:

• jdk1.8.0.45 • idea14.1.3 • spring-boot-1.2.3-RELEASE • spring-loaded-1.2.3-RELEASE vm options: -javaagent:/Users/li/Downloads/springloaded-1.2.3.RELEASE.jar -noverify

After the configuration, the console first line has a hint: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java -..../Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.

But changing the code has no effect, why?

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

transentia avatar May 29 '15 09:05 transentia

As transentia says, the message about lib instrument is a JDK issue but it does indicate the agent setting is being applied. I just ran a boot 1.2.3 app with spring loaded 1.2.3 using the javaagent and no verify options you specified. It works for me. As I change my controller code I can see the request mappings refreshing in the console. Here I added a couple of extra greeting endpoints and saved:

2015-06-26 13:05:57.650  INFO 62526 --- [Loader@58644d46] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/greeting],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String hello.GreetingController.greeting(java.lang.String,org.springframework.ui.Model)
2015-06-26 13:05:57.651  INFO 62526 --- [Loader@58644d46] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/greeting2],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String hello.GreetingController.greeting2(java.lang.String,org.springframework.ui.Model)
2015-06-26 13:05:57.651  INFO 62526 --- [Loader@58644d46] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/greeting3],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String hello.GreetingController.greeting3(java.lang.String,org.springframework.ui.Model)
2015-06-26 13:05:57.651  INFO 62526 --- [Loader@58644d46] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2015-06-26 13:05:57.651  INFO 62526 --- [Loader@58644d46] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)

you can add -Dspringloaded=verbose ahead of the -javaagent and then you will see this kind of method when it is reloading something:

Reloading: Loading new version of hello.GreetingController [PGkNG9Q]

Together with trace statements like this:

2015-06-26 13:07:45.108  INFO 62645 --- [           main] org.springsource.loaded.agent.Watcher    : Now watching /Users/aclement/gits/gs-serving-web-content/complete/target/classes/hello/GreetingController.class
2015-06-26 13:07:45.109  INFO 62645 --- [           main] o.s.l.agent.SpringLoadedPreProcessor     : SpringLoaded preprocessing: classname=org/springframework/boot/context/embedded/ServletRegistrationBean classloader=Launcher$AppClassLoader typeRegistry=TypeRegistry(id=358699161,loader=sun.misc.Launcher$AppClassLoader)

aclement avatar Jun 26 '15 20:06 aclement