【问题标题】:STS v3.5.0.RELEASE x64 won't hot swap VM classesSTS v3.5.0.RELEASE x64 不会热交换 VM 类
【发布时间】:2014-05-01 18:45:01
【问题描述】:

我使用的是 Windows 8.1 x64 瑞典语。我尝试按照https://www.youtube.com/watch?v=GTrNkhVnJBU 指南了解如何让 STS 进行热插拔。我将 Eclipse 设置为自动构建,并且检查了类文件实际上是否已在目标目录中替换。我添加了 javaagent 参数。我还测试过使用我的 VM 参数从命令行(一个简单的 hello world)启动它,尽管我的用户名包含空格,但它会启动。我试图将 springloaded.jar 移动到不包含空格的文件夹中。仍然没有热插拔。为了测试它,我重建了我的命令行 hello world 或在 STS 中我更改了一个字符串并保存了文件。该类自动构建,但网页仍打印旧消息。 STS 安装目录为 C:\dev\Apps\STS。 .m2 存储库的路径中有空格。我试过 jdk 1.7.0_25、jdk 1.7.0_55 和 springloaded-1.1.5.RELEASE.jar、springloaded-1.2.0.RELEASE.jar

【问题讨论】:

    标签: java spring spring-tool-suite spring-loaded


    【解决方案1】:

    当您启动附加了弹簧加载代理的应用程序时,您在 STS 的控制台视图中看到了什么?您是否注意到有关 springloaded-1.2.0.RELEASE.jar 未找到或无法打开的任何消息? 您可以在此处粘贴您的启动配置 VM 参数吗?

    一旦您修改代码并保存,成功的热插拔应该会在控制台视图中产生如下所示的消息: [Loader@5cfab5b1] s.w.s.m.m.a.RequestMappingHandlerMapping :将“{[/greeting],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}”映射到公共问候.Greeting hello.GreetingController.greeting(java.lang.String)

    【讨论】:

    • 如果我使用“Debug As”选项启动 Tomcat,类文件的热交换工作并且我的 hello world 消息会发生变化。我想让它为我的生产开发设置工作。它使用 Java 1.6.0_27,我使用 $mvn jetty:run -o 从命令行启动 Jetty(2009 年的旧版本)。然后我构建我的 .war 并将其上传到生产服务器。我认为您可以使用最原始的 hello world 程序使用 spring-loaded 来热交换 hello world 消息,而根本不需要 Web 服务器。没有 Tomcat 或 Jetty。我的称为 ReadString.java 并停止从用户那里获取输入。然后我重新编译
    • 根据请求启动配置 VM 参数 -Dspring.liveBeansView.mbeanDomain -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=38900 -Dcom.sun.management.jmxremote.authenticate =false -Dcom.sun.management.jmxremote.ssl=false -javaagent:C:/Users/Anna\ Ohlsson/.m2/repository/org/springframework/springloaded/1.2.0.RELEASE/springloaded-1.2.0.RELEASE .jar -noverify
    【解决方案2】:
    Lauch configuration arguments as requested:
    -Dspring.liveBeansView.mbeanDomain
    -Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.port=38900
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false
    
    Program arguments:
    -javaagent:C:/Users/Anna\ Ohlsson/.m2/repository/org/springframework/springloaded/1.2.0.RELEASE/springloaded-1.2.0.RELEASE.jar -noverify
    
    This is what the boot up messages look like. Someone requested to see them.
      .   ____          _            __ _ _                                                                         
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \                                                                           
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \                                                                          
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )                                                                        
      '  |____| .__|_| |_|_| |_\__, | / / / /                                                                         
     =========|_|==============|___/=/_/_/_/                                                                          
     :: Spring Boot ::        (v1.0.2.RELEASE)                                                                          
    
    2014-05-03 16:11:42.407  INFO 7620 --- [           main] demo.Application                         : Starting Application on WindowsBurken with PID 7620 (C:\dev\STS_Workspace\demo\target\classes started by Anna Ohlsson in C:\dev\STS_Workspace\demo)
    2014-05-03 16:11:42.447  INFO 7620 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@495d950b: startup date [Sat May 03 16:11:42 CEST 2014]; root of context hierarchy
    2014-05-03 16:11:42.774  INFO 7620 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'org.springframework.boot.autoconfigure.AutoConfigurationPackages': replacing [Generic bean: class [org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
    2014-05-03 16:11:43.530  INFO 7620 --- [           main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8080
    2014-05-03 16:11:43.741  INFO 7620 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
    2014-05-03 16:11:43.742  INFO 7620 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/7.0.52
    2014-05-03 16:11:43.851  INFO 7620 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    2014-05-03 16:11:43.851  INFO 7620 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1407 ms
    2014-05-03 16:11:44.290  INFO 7620 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
    2014-05-03 16:11:44.293  INFO 7620 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
    2014-05-03 16:11:44.607  INFO 7620 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
    2014-05-03 16:11:44.680  INFO 7620 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto java.lang.String demo.SampleController.home()
    2014-05-03 16:11:44.680  INFO 7620 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/greeting],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto java.lang.String demo.SampleController.greeting(java.lang.String)
    2014-05-03 16:11:44.700  INFO 7620 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
    2014-05-03 16:11:44.701  INFO 7620 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
    2014-05-03 16:11:44.818  INFO 7620 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
    2014-05-03 16:11:44.841  INFO 7620 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
    2014-05-03 16:11:44.843  INFO 7620 --- [           main] demo.Application                         : Started Application in 2.745 seconds (JVM running for 3.163)
    

    【讨论】:

      猜你喜欢
      • 2015-06-20
      • 2016-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-14
      • 1970-01-01
      • 2014-07-27
      相关资源
      最近更新 更多