繁体   English   中英

在Eclipse IDE中第二次运行Maven项目时出现错误

[英]Getting error when running maven project second time in eclipse ide

我是新手。 当我第一次运行项目时,我会在控制台中获得此输出

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building HelloWorld Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat-maven-plugin:1.1:run (default-cli) @ HelloWorld >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ HelloWorld ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ HelloWorld ---
[INFO] No sources to compile
[INFO] 
[INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) @ HelloWorld <<<
[INFO] 
[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) @ HelloWorld ---
[INFO] Running war on http://localhost:8080/HelloWorld
[INFO] Using existing Tomcat server configuration at /home/yahooda/Documents/workspace-sts-3.4.0.RELEASE/HelloWorld/target/tomcat
Oct 16, 2013 10:46:37 AM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Oct 16, 2013 10:46:37 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Oct 16, 2013 10:46:38 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Oct 16, 2013 10:46:38 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080

当我再次运行同一项目时,我在控制台中收到此错误

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building HelloWorld Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat-maven-plugin:1.1:run (default-cli) @ HelloWorld >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ HelloWorld ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ HelloWorld ---
[INFO] No sources to compile
[INFO] 
[INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) @ HelloWorld <<<
[INFO] 
[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) @ HelloWorld ---
[INFO] Running war on http://localhost:8080/HelloWorld
[INFO] Using existing Tomcat server configuration at /home/yahooda/Documents/workspace-sts-3.4.0.RELEASE/HelloWorld/target/tomcat
Oct 16, 2013 10:47:39 AM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Oct 16, 2013 10:47:39 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Oct 16, 2013 10:47:39 AM org.apache.coyote.http11.Http11Protocol init
SEVERE: Error initializing endpoint
java.net.BindException: Address already in use <null>:8080
    at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:549)
    at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176)
    at org.apache.catalina.connector.Connector.initialize(Connector.java:1014)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:830)
    at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
    at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
    at java.net.ServerSocket.bind(ServerSocket.java:376)
    at java.net.ServerSocket.<init>(ServerSocket.java:237)
    at java.net.ServerSocket.<init>(ServerSocket.java:181)
    at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)
    at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538)
    ... 26 more

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.490s
[INFO] Finished at: Wed Oct 16 10:47:39 IST 2013
[INFO] Final Memory: 14M/84M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run (default-cli) on project HelloWorld: Could not start Tomcat: Protocol handler initialization failed: java.net.BindException: Address already in use <null>:8080 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

如果我关闭日食并重新开始,则项目第一次正常运行。

答案:我得到的答案是从命令行停止tomcat或重新启动Elipse或更改端口号。

我只是在eclipse中安装了m2e插件,所以我无法通过命令行停止。 我不想每次都重新启动Eclipse并更改端口号。 还有其他方法可以做到这一点。 我们不能从eclipse停止或启动tomcat吗?

java.net.BindException: Address already in us

Tomcat已经处于启动模式。

要重新启动,您需要先将其停止然后再启动。或者您可以重新启动TOMCAT。 它将注意停止和启动服务器。

您正在尝试重新运行应用程序而不会杀死第一个tomcat服务器

java.net.BindException: Address already in use <null>:8080

首先杀死该实例。 然后重新运行。

java.net.BindException:地址已在使用中

您正在遇到此问题,因为您没有关闭已在运行的tomcat实例,并试图再次运行它

因此,您可以执行以下两项操作:关闭第一个实例并重新运行,如果问题仍然存在,请通过以下方法更改端口。

打开server.xml搜索8080并将其更改为8081

检查此答案以关闭tomcat

mvn tomcat:stop

在tomcat:start之前使用它。

查看您的控制台视图。 它有一个红色按钮来停止您的应用程序。

在这里查看文档

暂无
暂无

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

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