Java 无法从 IntelliJ IDEA 12.1.4 Ultimate (Windows 7) 启动 Apache Tomcat 6

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18740654/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 10:38:14  来源:igfitidea点击:

Cannot start Apache Tomcat 6 from IntelliJ IDEA 12.1.4 Ultimate (Windows 7)

javatomcatintellij-ideatomcat6

提问by Dmitrii Pisarenko

I need to debug a web application for Tomcat6 in IntelliJ IDEA.

我需要在 IntelliJ IDEA 中调试 Tomcat6 的 Web 应用程序。

When I try to run my web application, I get two errors:

当我尝试运行我的 Web 应用程序时,出现两个错误:

  1. Address localhost:1099 is already in use
  2. Unable to open debugger port: java.net.SocketException
  1. 地址 localhost:1099 已被使用
  2. 无法打开调试器端口:java.net.SocketException

Launching the Apache Tomcat 6 service manually works fine.

手动启动 Apache Tomcat 6 服务工作正常。

What should I do in order to be able to debug web applications in Apache Tomcat 6 from Intellij IDEA?

为了能够从 Intellij IDEA 调试 Apache Tomcat 6 中的 Web 应用程序,我应该怎么做?

回答by Srihari

Change your http port to 8080(default for tomcat) and debug port to something that is not being used currently by any processes. You can use anything that is upwards of 1024, but since you are getting an error on 1099, try something that is greater that 6000.

将您的 http 端口更改为 8080(tomcat 的默认端口)并将调试端口更改为当前未被任何进程使用的端口。您可以使用大于 1024 的任何值,但由于在 1099 上出现错误,请尝试使用大于 6000 的值。

Debugger setting can be found here

调试器设置可以在这里找到

回答by Andreas Lundgren

If you had the web application up and running before, there may be an old debug server that did not close down properly running in the background. See this post about how to find what process that uses port 1099. If it proves to be a java process, kill it.

如果您之前启动并运行了 Web 应用程序,则可能有一台旧的调试服务器没有在后台正常运行。请参阅这篇关于如何查找使用端口 1099 的进程的帖子。如果它被证明是一个 java 进程,则将其杀死。

How can you find out which process is listening on a port on Windows?

如何找出哪个进程正在侦听 Windows 上的端口?

(If you use the GUI sw suggested in the link above, you may kill the process(es) by marking all java processes that uses port 1099, right click and press "End Process...")

(如果您使用上面链接中建议的 GUI sw,您可以通过标记所有使用端口 1099 的 java 进程来终止进程,右键单击并按“结束进程...”)

回答by julg

You can change the JMX port (1099 per default) in the Run/Debug Configurationdialog. Just try a different port number (i.e. 9099).

您可以在“运行/调试配置”对话框中更改 JMX 端口(默认为 1099)。只需尝试不同的端口号(即 9099)。

回答by uris

As said before, there's an old debug server running in the background.

如前所述,有一个旧的调试服务器在后台运行。

My solution was to close the Java process that was left open from the Windows Task Manager.

我的解决方案是关闭在 Windows 任务管理器中保持打开状态的 Java 进程。

Please verify that you can close this process before doing so!

请在执行此操作之前确认您可以关闭此进程!

回答by user3642940

There might be other program or server running at the background. First close other server running in the background and then restart your server.

可能有其他程序或服务器在后台运行。首先关闭后台运行的其他服务器,然后重新启动您的服务器。

回答by lk1234

I found this answer helpful:

我发现这个答案很有帮助:

How can you find out which process is listening on a port on Windows?

如何找出哪个进程正在侦听 Windows 上的端口?

I opened the resource monitor and looked for what was using the ports. Then opened task manager and ended those processes

我打开资源监视器并查找正在使用端口的内容。然后打开任务管理器并结束这些进程

回答by varna

Following the below steps work:-

按照以下步骤工作:-

  1. Open command prompt and type the command netstat -ano
  2. You will see a list of active TCP connections with PIDas the last column
  3. See the second column listing the local addresses and find the one using port 1099 from it and you'll get its PID
  4. Now open your Task Manager, click the Process tab and get the PID column to display [either by right clicking on the heading row and selecting PID OR click View, and then click Select Columns and select PID.]
  5. Now find the PID we got from Step3 and end the process.
  1. 打开命令提示符并键入命令netstat -ano
  2. 您将看到一个活动 TCP 连接列表,其中PID作为最后一列
  3. 请参阅列出本地地址的第二列,并从中找到使用端口 1099 的地址,您将获得其 PID
  4. 现在打开您的任务管理器,单击进程选项卡并显示 PID 列[通过右键单击标题行并选择 PID 或单击查看,然后单击选择列并选择 PID。]
  5. 现在找到我们从 Step3 得到的 PID 并结束这个过程。

Now you are good to go :)

现在你可以走了:)

回答by Swanidhi

I face this issue all the time. Here's how to fix it

我一直面临这个问题。这是修复它的方法

LINUX

LINUX

Open a terminal instance.

打开一个终端实例。

fuser 1099/tcp

This should return you a process ID.

这应该会返回一个进程 ID。

1099/tcp:            31596

where 31596 is the process ID. Now you can either use the process ID to kill it or just bash the following -

其中 31596 是进程 ID。现在,您可以使用进程 ID 来终止它,也可以只执行以下操作 -

fuser -k 1099/tcp

WINDOWS

视窗

Open a command prompt instance.

打开命令提示符实例。

netstat -aon | find "1099"

This will return you an instance of the process.

这将返回一个流程实例。

output:

输出:

TCP    0.0.0.0:1099       0.0.0.0:0       LISTENING       15776

Here 15776 is the process ID. To kill this, enter -

这里 15776 是进程 ID。要杀死它,请输入 -

taskkill /F /PID 15776

Cheers!

干杯!

回答by Arpit Pandya

Just close all other unnecessary servers while using InteliJ.

使用 InteliJ 时只需关闭所有其他不必要的服务器。

I stopped my WAMP in order to remove this error "Port is already in use".

我停止了 WAMP 以消除此错误“端口已在使用中”。

回答by hal9000

What worked for me was. I assumed I would need to have the "Apache Tomcat" service running under "Services" [Windows + R >> services.msc]

对我有用的是。我假设我需要在“服务”下运行“Apache Tomcat”服务[Windows + R >> services.msc]

I went and stopped the Tomcat service here. Then I came to my Java application and ran it in Intellij, which allowed me to run it.

我去这里停止了Tomcat服务。然后我来到我的 Java 应用程序并在 Intellij 中运行它,这允许我运行它。

Hope this helps!

希望这可以帮助!