MyFaces tomcat7:运行目标无法启动 ProtocolHandler “http-bio-8080”

Posted

技术标签:

【中文标题】MyFaces tomcat7:运行目标无法启动 ProtocolHandler “http-bio-8080”【英文标题】:MyFaces tomcat7:run goal cannot start ProtocolHandler "http-bio-8080" 【发布时间】:2012-09-29 20:45:02 【问题描述】:

我使用 maven 原型 HelloWorld 2.0 OpenWebBeans 创建了一个新的 MyFaces 项目

并立即使用mvn clean -Dcontainer="tomcat7" tomcat7:run 对其进行测试。 一切顺利,直到启动tomcat。 该过程卡在以下位置:

INFO: Starting ProtocolHandler ["http-bio-8080"]

我等了超过 20 分钟。这不可能。

信息:8080端口上没有运行其他服务,也没有运行其他tomcat。

为什么 ProtocolHandler 没有启动?! 我只想用 CDI 开发一个 JSF 应用程序,并使用 Maven 将它部署在 Tomcat7 上。 如果有人对我有更好的解决方案,我 - 吐出来! ;)

谢谢!

更新: 感谢 jstack 技巧,非常酷的功能! 这是来自 jstack 的完整 StackTrace: 正如我所见,http-bio 有一个 AsyncTimeout 并且处于 TIMED_WAITING 状态......接下来我该怎么办?谢谢大家!

Full thread dump Java HotSpot(TM) 64-Bit Server VM (23.3-b01 mixed mode):

"http-bio-8080-AsyncTimeout" daemon prio=6 tid=0x000000000c697000 nid=0xf3c waiting on condition [0x000000000d54f000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(Native Method)
        at org.apache.tomcat.util.net.JIoEndpoint$AsyncTimeout.run(JIoEndpoint.java:148)
        at java.lang.Thread.run(Thread.java:722)

"http-bio-8080-Acceptor-0" daemon prio=6 tid=0x000000000ae7a000 nid=0x97c runnable [0x000000000d25e000]
   java.lang.Thread.State: RUNNABLE
        at java.net.DualStackPlainSocketImpl.accept0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketAccept(DualStackPlainSocketImpl.java:121)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:183)
        - locked <0x00000000f3670350> (a java.net.SocksSocketImpl)
        at java.net.ServerSocket.implAccept(ServerSocket.java:522)
        at java.net.ServerSocket.accept(ServerSocket.java:490)
        at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60)
        at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:216)
        at java.lang.Thread.run(Thread.java:722)

"ContainerBackgroundProcessor[StandardEngine[Tomcat]]" daemon prio=6 tid=0x000000000be73800 nid=0x9c8 waiting on condition [0x000000000d36f000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(Native Method)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1517)
        at java.lang.Thread.run(Thread.java:722)

"OwbConversationCleaner-/webapp" daemon prio=6 tid=0x000000000ab58800 nid=0x7f4 waiting on condition [0x000000000cb1e000]
   java.lang.Thread.State: TIMED_WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x00000000f3487a10> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
        at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2082)
        at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
        at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:807)
        at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

"Service Thread" daemon prio=6 tid=0x0000000008ea1800 nid=0xfcc runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" daemon prio=10 tid=0x0000000008e9f800 nid=0xb70 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" daemon prio=10 tid=0x0000000008e9a800 nid=0x6ec waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Attach Listener" daemon prio=10 tid=0x0000000008e9a000 nid=0xa98 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=10 tid=0x0000000008e92800 nid=0x85c runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=8 tid=0x0000000002499000 nid=0x918 in Object.wait() [0x000000000a17f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000c0918c00> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
        - locked <0x00000000c0918c00> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177)

"Reference Handler" daemon prio=10 tid=0x0000000002492800 nid=0x994 in Object.wait() [0x000000000a05f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000c0918910> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:503)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
        - locked <0x00000000c0918910> (a java.lang.ref.Reference$Lock)

"main" prio=6 tid=0x000000000239d800 nid=0xf20 in Object.wait() [0x000000000264e000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000ebe51d28> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:503)
        at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.waitIndefinitely(AbstractRunMojo.java:835)
        - locked <0x00000000ebe51d28> (a java.lang.Object)
        at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:356)
        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:601)
        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)

"VM Thread" prio=10 tid=0x0000000008e12000 nid=0xf30 runnable

"GC task thread#0 (ParallelGC)" prio=6 tid=0x00000000023e4800 nid=0xeec runnable

"GC task thread#1 (ParallelGC)" prio=6 tid=0x00000000023e6000 nid=0xfe0 runnable

"GC task thread#2 (ParallelGC)" prio=6 tid=0x00000000023e7800 nid=0xd54 runnable

"GC task thread#3 (ParallelGC)" prio=6 tid=0x00000000023e9800 nid=0x8cc runnable

"VM Periodic Task Thread" prio=10 tid=0x0000000008eba000 nid=0xc40 waiting on condition

JNI global references: 272

【问题讨论】:

对了,http-bio是什么意思? bio 意思是“Basic IO”——区分 Java NIO 和原始 IO impl 【参考方案1】:

尝试使用jstack 获取所有线程正在执行的操作的转储。它将显示每个线程及其当前正在执行的方法以及有关它是否正在运行、等待或阻塞的信息。

如果您可以使用该信息更新您的问题,那将很有帮助。

附注,您可以将 MyFaces、OpenWebBeans 和 Tomcat 全部集成到一起开箱即用,并在 TomEE 中获得 Java EE 6 认证

【讨论】:

感谢 jstack 提示!很棒的功能。我更新了我的问题。【参考方案2】:

我在使用 tomcat7-maven-plugin 时遇到了类似的问题。我试图通过将以下内容添加到我的 pom.xml 来让 tomcat 绑定到不同的端口:

<execution>
 <id>tomcat-run</id>
 <goals>
 <goal>run</goal>
 </goals>
 <phase>pre-integration-test</phase>
 <configuration>
 <port>19090</port>
</configuration>
</execution>

当我把这个块拿出来时,问题就消失了。

【讨论】:

谢谢,但问题已经存在半年多了,我想我不确定我做了什么来解决这个问题.. 我想我使用了 mojarra 解决方案而不是 myfaces.. 但是谢谢,我选择了您的答案作为解决方案。 ;)

以上是关于MyFaces tomcat7:运行目标无法启动 ProtocolHandler “http-bio-8080”的主要内容,如果未能解决你的问题,请参考以下文章

Tomcat 7 无法启动

Mojarra 和 MyFaces 之间的区别

Tomcat 7 崩溃后无法启动

Cargo maven 插件 - 启动目标忽略配置,“运行”工作正常

使用捆绑在 webapp 中并在 Wildfly 上运行的 myfaces 时未调用 CDI Bean 方法

eclipse3.7里面突然启动不了Tomcat7了,请大神支招!