在eclipse ide中运行maven项目第二次时出错 [英] Getting error when running maven project second time in eclipse ide

查看:356
本文介绍了在eclipse ide中运行maven项目第二次时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的maven。当我第一次运行项目时,我在控制台中得到这个输出

  SLF4J:无法加载类org.slf4j。 impl.StaticLoggerBinder。 
SLF4J:默认为无操作(NOP)记录器实现
SLF4J:有关详细信息,请参阅http://www.slf4j.org/codes.html#StaticLoggerBinder。
[INFO]扫描项目...
[INFO]
[INFO] ----------------------- -------------------------------------------------
[INFO]构建HelloWorld Maven Webapp 0.0.1-SNAPSHOT
[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
[警告]使用平台编码(实际上是UTF-8)来复制过滤的资源,即构建是平台依赖的!
[INFO]复制0资源
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile(default-compile)@ HelloWorld ---
[INFO]没有来源编译
[INFO]
[INFO]<<< tomcat-maven-plugin:1.1:run(default-cli)@ HelloWorld<<<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:run(default-cli)@ HelloWorld ---
[INFO]在http:// localhost:8080 / HelloWorld
[INFO]在/home/yahooda/Documents/workspace-sts-3.4.0.RELEASE/HelloWorld/target/tomcat使用现有的Tomcat服务器配置
2013年10月16日10: 46:37 AM org.apache.catalina.startup.Embedded start
INFO:启动tomcat服务器
2013年10月16日10:46:37 AM org.apache.catalina.core.StandardEngine start
信息:启动Servlet引擎:Apache Tomcat / 6.0.29
2013年10月16日10:46:38 org.apache.coyote.http11.Http11协议init
INFO:初始化http:http: -8080
2013年10月16日10:46:38 org.apache.coyote.http11.Http11Protocol start
INFO:在http-8080上启动Coyote HTTP / 1.1

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

  SLF4J:无法加载类org.slf4j.impl.StaticLoggerBinder。 
SLF4J:默认为无操作(NOP)记录器实现
SLF4J:有关详细信息,请参阅http://www.slf4j.org/codes.html#StaticLoggerBinder。
[INFO]扫描项目...
[INFO]
[INFO] ----------------------- -------------------------------------------------
[INFO]构建HelloWorld Maven Webapp 0.0.1-SNAPSHOT
[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
[警告]使用平台编码(实际上是UTF-8)来复制过滤的资源,即构建是平台依赖的!
[INFO]复制0资源
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile(default-compile)@ HelloWorld ---
[INFO]没有来源编译
[INFO]
[INFO]<<< tomcat-maven-plugin:1.1:run(default-cli)@ HelloWorld<<<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:run(default-cli)@ HelloWorld ---
[INFO]在http:// localhost:8080 / HelloWorld
[INFO]在/home/yahooda/Documents/workspace-sts-3.4.0.RELEASE/HelloWorld/target/tomcat使用现有的Tomcat服务器配置
2013年10月16日10: 47:39 AM org.apache.catalina.startup.Embedded start
INFO:启动tomcat服务器
2013年10月16日10:47:39 org.apache.catalina.core.StandardEngine start
INFO:启动Servlet引擎:Apache Tomcat / 6.0.29
2013年10月16日10:47:39 org.apache.coyote.http11.Http11Protocol init
SEVERE:初始化端点错误
java.net.BindException:已使用的地址< null>:8080
在org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:549)
在org.apache。 coyote.http11.Http11Protocol.init(Http11Protocol.java:176)
在org.apache.catalina.connector.Connector.initialize(Connector.java:1014)
在org.apache.catalina.startup。 Embedde d.start(Embedded.java:830)
在org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
在org.codehaus.mojo.tomcat.AbstractRunMojo.execute( AbstractRunMojo.java:255)
在org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor。 java:209)
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor。 java:145)
在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder。 java:59)
在org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
在org.apache.maven.lifecycle.internal.LifecycleStart er.execute(LifecycleStarter.java:161)
在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
在org.apache.maven.DefaultMaven.execute(DefaultMaven.java: 156)
在org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
在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)
在java.lang.reflect.Method.invoke(Method.java:606)
(org.codehaus.plexus.classworlds.launcher.Launcher.launch在org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
在org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
引起的:java.net.BindException:地址已在使用
在java.net.PlainSocketImpl.socketBind (Native Method)
在java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
在java.net.ServerSocket.bind(ServerSocket.java:376)
在java.net .ServerSocket。< init>(ServerSocket.java:237)
在java.net.ServerSocket。< init>(ServerSocket.java:181)
在org.apache.tomcat.util.net .DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)
在org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538)
... 26更多

[INFO] -------------------------------------------- ----------------------------
[INFO] BUILD FAILURE
[INFO] ------ -------------------------------------------------- ----------------
[INFO]总时间:2.490s
[INFO]完成日期:Wed Oct 16 10:47:39 IST 2013
[INF O]最终内存:14M / 84M
[INFO] ----------------------------------- -------------------------------------
[ERROR]无法执行目标组织。 codehaus.mojo:tomcat-maven-plugin:1.1:在项目HelloWorld上运行(default-cli):无法启动Tomcat:协议处理程序初始化失败:java.net.BindException:已使用的地址< null>:8080 - > ; [帮助1]
[ERROR]
[ERROR]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[ERROR]使用-X开关重新运行Maven以启用完整的调试日志记录。
[ERROR]
[ERROR]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误] [帮助1] http://cwiki.apache.org / confluence / display / MAVEN / MojoExecutionException

如果我关闭我的eclipse并重新启动,那么项目工作正常首次。



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



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

解决方案

  mvn tomcat:stop 

在tomcat之前使用它:start。



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



请参阅doc here


I am new to maven. When i run the project for the first time i get this output in console

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

When i run the same project again i am getting this error in console

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

If i close my eclipse and start again, then project works fine for the first time.

Answer : I get answers for this is stop tomcat from command line or restart the elipse or change the port no.

I just installed m2e plugin in eclipse, so i cannot stop through command line. I dont want to restart my eclipse everytime and change my port no. Is there any other way to do this. Can't we stop or start tomcat from eclipse ?

解决方案

mvn tomcat:stop

Use this before tomcat:start.

See your console view. It has a red button to stop your application.

See doc here

这篇关于在eclipse ide中运行maven项目第二次时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆