我使用maven原型HelloWorld 2.0 OpenWebBeans
并使用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
答案 0 :(得分:2)
尝试使用jstack
来转储所有线程正在执行的操作。它将显示每个线程及其当前正在执行的方法以及有关它是否正在运行,等待或阻止的信息。
如果您可以使用该信息更新您的问题,那将会有所帮助。
旁注,您可以将MyFaces,OpenWebBeans和Tomcat全部集成在一起,并在TomEE
中认证Java EE 6答案 1 :(得分:1)
使用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>
当我把这个块拿出来时,问题就消失了。