简体   繁体   English

拒绝Tomcat连接的Netbeans调试

[英]Netbeans Debugging with Tomcat Connection Refused

I am using Netbeans 8.2 with the Java EE Base 1.31.1 and EJB and EAR 1.27.1 plugins installed. 我正在将Netbeans 8.2与Java EE Base 1.31.1以及EJB和EAR 1.27.1插件一起使用。 I installed Tomcat 9.0.4 and added it as a server to Netbeans. 我安装了Tomcat 9.0.4,并将其作为服务器添加到Netbeans。 Netbeans can successfully start the tomcat server and launch my web app, but it will not debug. Netbeans可以成功启动tomcat服务器并启动我的Web应用程序,但不会调试。 When I attempt to debug my webapp, I get the following error in my webapp log: 尝试调试Webapp时,我的webapp日志中出现以下错误:

ant -f /Users/jryan/JDev/SVN/trunk/Java/CollaborationServer -Dnb.internal.action.name=debug -Ddirectory.deployment.supported=true -DforceRedeploy=false -Dnb.wait.for.caches=true -Dbrowser.context=/Users/jryan/JDev/SVN/trunk/Java/CollaborationServer debug
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
debug:
Stopping Tomcat process...
Waiting for Tomcat...
Tomcat server stopped.
Starting Tomcat process...
Waiting for Tomcat...
Tomcat server started.
connect-debugger:
/Users/jryan/JDev/SVN/trunk/Java/CollaborationServer/nbproject/build-impl.xml:1206: The following error occurred while executing this line:
/Users/jryan/JDev/SVN/trunk/Java/CollaborationServer/nbproject/build-impl.xml:1216: 
org.netbeans.api.debugger.jpda.DebuggerStartException: Connection refused (Connection refused)
    at org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.waitRunning(JPDADebuggerImpl.java:405)
    at org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.waitRunning(JPDADebuggerImpl.java:387)
    at org.netbeans.api.debugger.jpda.JPDADebugger.attach(JPDADebugger.java:324)
    at org.netbeans.modules.debugger.jpda.ant.JPDAConnect$1.run(JPDAConnect.java:235)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:222)
    at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
    at com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:90)
    at org.netbeans.api.debugger.jpda.AttachingDICookie.getVirtualMachine(AttachingDICookie.java:231)
    at org.netbeans.modules.debugger.jpda.actions.StartActionProvider.doStartDebugger(StartActionProvider.java:188)
    at org.netbeans.modules.debugger.jpda.actions.StartActionProvider.access$200(StartActionProvider.java:80)
    at org.netbeans.modules.debugger.jpda.actions.StartActionProvider$1.run(StartActionProvider.java:165)
    ... 4 more
BUILD FAILED (total time: 7 seconds)

The tomcat log says Listening for transport dt_socket at address: 8000 tomcat日志说Listening for transport dt_socket at address: 8000

And the Netbeans Debugger Console says: Netbeans调试器控制台说:

Attaching to localhost:8000
Connection refused.

Does anyone know what is happening here, and what I can do to fix it? 有谁知道这里发生了什么,我怎么做才能解决?

Thanks! 谢谢!

Perhaps try adding the flags detailed in this Answer . 也许尝试添加此答案中详细说明的标志。

This is how we currently do it. 这就是我们目前的做法。

Oops. 哎呀。 It turns out that I had commented out the 127.0.0.1 localhost entry in my /etc/hosts file. 原来,我已经在/ etc / hosts文件中注释掉了127.0.0.1 localhost条目。 When I re-enabled localhost, it worked fine! 当我重新启用localhost时,它工作正常! And as an aside, I thought I had to comment out the default localhost line because I had another line in there for a locally hosted site I was testing, but according to this answer, there's no need to do that! 顺便说一句,我以为我必须注释掉默认的localhost行,因为我在那里正在测试我正在测试的本地托管站点的另一行,但是根据答案,没有必要这样做!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM