无法调试Spring Boot应用程序jar

时间:2019-07-12 15:57:15

标签: java spring-boot debugging

我想调试我的springboot应用程序并使用以下命令运行它,但它未在调试模式下运行,仅在正常执行模式下运行(我尝试从eclipse连接调试器,但失败了)

java -jar my.jar -Dagentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

我检查了启动日志,那里没有与调试模式有关的任何东西

2019-07-12 17:53:36.627  INFO 34585 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-07-12 17:53:36.714  INFO 34585 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-07-12 17:53:36.715  INFO 34585 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/9.0.13
2019-07-12 17:53:36.770  INFO 34585 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/nadeeshtv/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2019-07-12 17:53:37.179  INFO 34585 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-07-12 17:53:37.179  INFO 34585 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3439 ms
2019-07-12 17:53:37.622  INFO 34585 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-07-12 17:53:37.781  INFO 34585 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page: class path resource [static/index.html]
2019-07-12 17:53:38.014  INFO 34585 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-07-12 17:53:38.018  INFO 34585 --- [           main] c.a.b.t.springboot.Application           : Started Application in 6.361 seconds (JVM running for 8.006)

有人可以告诉我我在做什么错吗?

请找到我的spring boot应用程序类

@SpringBootApplication()
public class MyApplication {
    public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }

    @Bean
    public WebServerFactoryCustomizer<TomcatServletWebServerFactory>
    containerCustomizer(){
        return new EmbeddedTomcatCustomizer();
    }

    private static class EmbeddedTomcatCustomizer implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
        @Override
        public void customize(TomcatServletWebServerFactory factory) {
            factory.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
                connector.setAttribute("relaxedPathChars", "<>[\\]^`{|}");
                connector.setAttribute("relaxedQueryChars", "<>[\\]^`{|}");
            });
        }
    }
}

0 个答案:

没有答案