java - Intellij - 调试器在 Maven 项目中不起作用

标签 java maven spring-boot intellij-idea

我遇到了一个问题,无法在 IntelliJ 中调试 Maven sprint 启动 REST API 应用程序。应用程序启动但不会在任何断点处停止。

此外,当我停止调试器时,我在日志中看到以下几行,但我可以看到 java 进程永远不会终止,当我第二次启动应用程序时,它会失败,因为服务器端口 8080 仍在使用中。

Disconnected from the target VM, address: '127.0.0.1:53020', transport: 'socket'
Process finished with exit code -1

在位于 C:\Users\Bernhard.IdeaIC2017.3\system\log 的 IntelliJ 日志中,我看到以下错误。

2017-12-15 07:22:30,761 [  11899]   INFO - .server.BuildMessageDispatcher - An existing connection was forcibly closed by the remote host 
java.io.IOException: An existing connection was forcibly closed by the remote host
    at sun.nio.ch.SocketDispatcher.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
    at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1100)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:372)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
    at java.lang.Thread.run(Thread.java:745)

最佳答案

您可以将该参数的值括在引号中。读取整个命令行字符串的解析器可能会因为 -D arg 中的 -D arg 而阻塞。

清理包 -Drun.profiles=dev-us-east-1 -Drun.jvmArguments="-Denvironment=dev" -DskipTests spring-boot:run

关于java - Intellij - 调试器在 Maven 项目中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47868117/

相关文章:

java - isPalindrome() 的时间复杂度 O()

java - @Data 没有为静态嵌套类创建构造函数

java - 名为 my-app : Provider named org. hibernate.ejb.HibernatePersistence 的 EntityManager 没有持久性提供程序

Maven 插件前缀解析似乎没有按预期工作

postgresql - Spring JPA Hibernate 在 postgres 中更新时间戳 wo 时区时出错

Spring 启动 : How to specify the PasswordEncoder?

tomcat - 带端点的 Spring Boot 创建两个 Tomcat 容器

java - Android中从URL读取XML文件

java - Twitter Android SDK 不执行回调

java - 在 ImageView 上添加多个效果