本文介绍了Maven的码头插件 - 延迟在后台模式下启动时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上使用启动码头服务器

nohup的命令mvn码头:运行和放大器;

在后台运行,并留下当我从控制台退出。一般(MVN码头:运行)它开始以秒,但在这种情况下,它需要大约分钟开始。什么都可以这种延迟的原因是什么?

堆栈跟踪

 全部线程转储的HotSpot的Java(TM)64位服务器VM(11.0-B16混合模式):附加监听器守护PRIO = 10 = TID NID 0x000000004bba8c00 = 0x560a等待条件[0x0000000000000000..0x0000000000000000]
   java.lang.Thread.State中:RUNNABLE定时器1守护PRIO = 10 = TID NID 0x00002aaac053d800 = 0x55fb中的Object.wait()[0x0000000042392000..0x0000000042392b90]
   java.lang.Thread.State中:TIMED_WAITING(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaaae554f40 GT; (一java.util.TaskQueue)
        在java.util.TimerThread.mainLoop(Timer.java:509)
         - 锁定< 0x00002aaaae554f40> (一java.util.TaskQueue)
        在java.util.TimerThread.run(Timer.java:462)StopJettyPluginMonitor守护PRIO = 10 = TID NID 0x00002aaac04b4c00 = 0x55fa可运行[0x0000000042291000..0x0000000042291b10]
   java.lang.Thread.State中:RUNNABLE
        在java.net.PlainSocketImpl.socketAccept(本机方法)
        在java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
         - 锁定< 0x00002aaaae453860> (一java.net.SocksSocketImpl)
        在java.net.ServerSocket.implAccept(ServerSocket.java:453)
        在java.net.ServerSocket.accept(ServerSocket.java:421)
        在org.mortbay.jetty.plugin.util.Monitor.run(Monitor.java:74)定时器0守护PRIO = 10 = TID NID 0x000000004b5cf800 = 0x55f9中的Object.wait()[0x0000000040c78000..0x0000000040c78a90]
   java.lang.Thread.State中:TIMED_WAITING(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaaaeea00b8 GT; (一java.util.TaskQueue)
        在java.util.TimerThread.mainLoop(Timer.java:509)
         - 锁定< 0x00002aaaaeea00b8> (一java.util.TaskQueue)
        在java.util.TimerThread.run(Timer.java:462)1455093129 @ QTP-422797318-1 - Acceptor0 [email protected]:8080PRIO = 10 = TID NID 0x000000004b6d9800 = 0x55f7可运行[0x000000004130c000..0x000000004130ca10]
   java.lang.Thread.State中:RUNNABLE
        在sun.nio.ch.EPollArrayWrapper.epollWait(本机方法)
        在sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:215)
        在sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:65)
        在sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
         - 锁定< 0x00002aaaae44ac10> (一sun.nio.ch.Util $ 1)
         - 锁定< 0x00002aaaae44abf8> (一java.util.Collections中的$ UnmodifiableSet)
         - 锁定< 0x00002aaaae44a588> (一sun.nio.ch.EPollSelectorImpl)
        在sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
        在org.mortbay.io.nio.SelectorManager $ SelectSet.doSelect(SelectorManager.java:459)
        在org.mortbay.io.nio.SelectorManager.doSelect(SelectorManager.java:192)
        在org.mortbay.jetty.nio.SelectChannelConnector.accept(SelectChannelConnector.java:124)
        在org.mortbay.jetty.AbstractConnector $ Acceptor.run(AbstractConnector.java:706)
        在org.mortbay.thread.QueuedThreadPool $ PoolThread.run(QueuedThreadPool.java:520)91446054 @ QTP-422797318-0PRIO = 10 = TID NID 0x000000004b621400 = 0x55f6中的Object.wait()[0x000000004120b000..0x000000004120bd90]
   java.lang.Thread.State中:TIMED_WAITING(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaab1171890 GT; (一org.mortbay.thread.QueuedThreadPool $ PoolThread)
        在org.mortbay.thread.QueuedThreadPool $ PoolThread.run(QueuedThreadPool.java:563)
         - 锁定< 0x00002aaab1171890> (一org.mortbay.thread.QueuedThreadPool $ PoolThread)池1线程5PRIO = 10 = TID NID 0x00002aaac15d4c00 = 0x55f5中的Object.wait()[0x0000000041a4f000..0x0000000041a4fd10]
   java.lang.Thread.State中:等待(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaaafff4580 GT; (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在java.lang.Object.wait(Object.java:485)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
         - 锁定< 0x00002aaaafff4580> (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        在java.lang.Thread.run(Thread.java:619)池1线程4PRIO = 10 = TID NID 0x00002aaac0134000 = 0x55f4中的Object.wait()[0x000000004194e000..0x000000004194ec90]
   java.lang.Thread.State中:等待(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaaafff4580 GT; (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在java.lang.Object.wait(Object.java:485)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
         - 锁定< 0x00002aaaafff4580> (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        在java.lang.Thread.run(Thread.java:619)池1线程3PRIO = 10 = TID NID 0x000000004ba72800 = 0x55f3中的Object.wait()[0x0000000042190000..0x0000000042190c10]
   java.lang.Thread.State中:等待(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaaafff4580 GT; (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在java.lang.Object.wait(Object.java:485)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
         - 锁定< 0x00002aaaafff4580> (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        在java.lang.Thread.run(Thread.java:619)池1线程2PRIO = 10 = TID NID 0x000000004b8b6c00 = 0x55f2中的Object.wait()[0x000000004208f000..0x000000004208fb90]
   java.lang.Thread.State中:等待(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaaafff4580 GT; (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在java.lang.Object.wait(Object.java:485)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
         - 锁定< 0x00002aaaafff4580> (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        在java.lang.Thread.run(Thread.java:619)池1线程1PRIO = 10 = TID NID 0x000000004b8b6400 = 0x55f1中的Object.wait()[0x0000000040415000..0x0000000040415b10]
   java.lang.Thread.State中:等待(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaaafff4580 GT; (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在java.lang.Object.wait(Object.java:485)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
         - 锁定< 0x00002aaaafff4580> (一hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue $ SerializableLock)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        在hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        在java.lang.Thread.run(Thread.java:619)低内存探测器守护PRIO = 10 = TID NID 0x000000004affd800 = 0x55eb可运行[0x0000000000000000..0x0000000000000000]
   java.lang.Thread.State中:RUNNABLECompilerThread1守护PRIO = 10 = TID NID 0x000000004affb800 = 0x55ea等待条件[0x0000000000000000..0x0000000041d8b4d0]
   java.lang.Thread.State中:RUNNABLECompilerThread0守护PRIO = 10 = TID NID 0x000000004aff7800 = 0x55e9等待条件[0x0000000000000000..0x0000000041c8a450]
   java.lang.Thread.State中:RUNNABLE信号调度守护PRIO = 10 = TID NID 0x000000004aff5c00 = 0x55e8可运行[0x0000000000000000..0x0000000041b8a820]
   java.lang.Thread.State中:RUNNABLE终结守护PRIO = 10 = TID NID 0x000000004afd2400 = 0x55e7中的Object.wait()[0x000000004184d000..0x000000004184db10]
   java.lang.Thread.State中:等待(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaaafdf0450 GT; (一java.lang.ref.ReferenceQueue $锁)
        在java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
         - 锁定< 0x00002aaaafdf0450> (一java.lang.ref.ReferenceQueue $锁)
        在java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
        在java.lang.ref.Finalizer $ FinalizerThread.run(Finalizer.java:159)参考处理程序守护PRIO = 10 = TID NID 0x000000004afd0800 = 0x55e6中的Object.wait()[0x000000004174c000..0x000000004174ca90]
   java.lang.Thread.State中:等待(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaaafdf0530 GT; (一java.lang.ref.Reference中$锁)
        在java.lang.Object.wait(Object.java:485)
        在java.lang.ref.Reference中$ ReferenceHandler.run(Reference.java:116)
         - 锁定< 0x00002aaaafdf0530> (一java.lang.ref.Reference中$锁)主PRIO = 10 = TID NID 0x000000004af6e000 = 0x55e4中的Object.wait()[0x000000004072f000..0x0000000040730ed0]
   java.lang.Thread.State中:等待(目标监视器上)
        在java.lang.Object.wait(本机方法)
         - 等待针对<&0x00002aaab1196b60 GT; (一org.mortbay.thread.QueuedThreadPool $锁)
        在java.lang.Object.wait(Object.java:485)
        在org.mortbay.thread.QueuedThreadPool.join(QueuedThreadPool.java:298)
         - 锁定< 0x00002aaab1196b60> (一org.mortbay.thread.QueuedThreadPool $锁)
        在org.mortbay.jetty.plugin.Jetty6PluginServer.join(Jetty6PluginServer.java:206)
        在org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:461)
        在org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
        在org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
        在org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
        在org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
        在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
        在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553)
        在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523)
        在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
        在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
        在org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
        在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
        在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
        在org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        在org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41)
        在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
        在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        在java.lang.reflect.Method.invoke(Method.java:597)
        在组织。codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        在组织。codehaus.classworlds.Launcher.launch(Launcher.java:255)
        在组织。codehaus.classworlds.Launcher.mainWithExit code(Launcher.java:430)
        在组织。codehaus.classworlds.Launcher.main(Launcher.java:375)VM线程PRIO = 10 = TID NID 0x000000004afcb000 = 0x55e5可运行VM周期性任务线程PRIO = 10 = TID NID 0x000000004b000000 = 0x55ec等待条件JNI全局引用:861


解决方案

我得到这么累了看的人滥用的nohup 的。这里是如何的真正的系统守护进程程序工作:


  1. 创建一个子进程。

  2. 启动守护进程作为子进程的子项。

  3. 退出的第一道工序。

有一个简单的方法来模拟这种使用 SH 如下:


SH -c命令mvn码头:运行和放大器;

观察...


斯科特@擎天柱:〜/ code /越级/套索>上海-c命令mvn码头:运行&
斯科特@擎天柱:〜/ code /越级/套索>的ps aux | grep的码头:运行
斯科特26165 45.5 5.8 813556 235764点/ 9 SL 15:23 0:06 / usr / lib目录/ JVM / JAVA-6-太阳//斌/ java的-Xmx512M -classpath /home/scott/opt/apache-maven-2.2。 1 //启动/ classworlds-1.1.jar -Dclassworlds.conf = /家庭/斯科特的/ opt / Apache的行家-2.2.1 //斌/ m2.conf -Dmaven.home = /家庭/斯科特的/ opt / apache- 。Maven的2.2.1 /组织codehaus.classworlds.Launcher码头:运行
斯科特@擎天柱:〜/ code /越级/套索>退出

如果我从一个单独的终端,还是后来检查我的进程列表,程序仍在运行。

不过,我要问,为什么这不是只安装在本地的应用程序服务器的Web应用程序,并开始了吗?但愿你是不是管理你的真正的使用Apache Maven的环境。

I start a jetty server on linux using

nohup mvn jetty:run &

to run it in background and to stay when I quit from the console. Usually (mvn jetty:run) it starts in seconds, but in this case it takes about minute to start. What can be the cause of such a delay?

Stack trace

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

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

"Timer-1" daemon prio=10 tid=0x00002aaac053d800 nid=0x55fb in Object.wait() [0x0000000042392000..0x0000000042392b90]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaaae554f40> (a java.util.TaskQueue)
        at java.util.TimerThread.mainLoop(Timer.java:509)
        - locked <0x00002aaaae554f40> (a java.util.TaskQueue)
        at java.util.TimerThread.run(Timer.java:462)

"StopJettyPluginMonitor" daemon prio=10 tid=0x00002aaac04b4c00 nid=0x55fa runnable [0x0000000042291000..0x0000000042291b10]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
        - locked <0x00002aaaae453860> (a java.net.SocksSocketImpl)
        at java.net.ServerSocket.implAccept(ServerSocket.java:453)
        at java.net.ServerSocket.accept(ServerSocket.java:421)
        at org.mortbay.jetty.plugin.util.Monitor.run(Monitor.java:74)

"Timer-0" daemon prio=10 tid=0x000000004b5cf800 nid=0x55f9 in Object.wait() [0x0000000040c78000..0x0000000040c78a90]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaaaeea00b8> (a java.util.TaskQueue)
        at java.util.TimerThread.mainLoop(Timer.java:509)
        - locked <0x00002aaaaeea00b8> (a java.util.TaskQueue)
        at java.util.TimerThread.run(Timer.java:462)

"1455093129@qtp-422797318-1 - Acceptor0 [email protected]:8080" prio=10 tid=0x000000004b6d9800 nid=0x55f7 runnable [0x000000004130c000..0x000000004130ca10]
   java.lang.Thread.State: RUNNABLE
        at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
        at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:215)
        at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:65)
        at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
        - locked <0x00002aaaae44ac10> (a sun.nio.ch.Util$1)
        - locked <0x00002aaaae44abf8> (a java.util.Collections$UnmodifiableSet)
        - locked <0x00002aaaae44a588> (a sun.nio.ch.EPollSelectorImpl)
        at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
        at org.mortbay.io.nio.SelectorManager$SelectSet.doSelect(SelectorManager.java:459)
        at org.mortbay.io.nio.SelectorManager.doSelect(SelectorManager.java:192)
        at org.mortbay.jetty.nio.SelectChannelConnector.accept(SelectChannelConnector.java:124)
        at org.mortbay.jetty.AbstractConnector$Acceptor.run(AbstractConnector.java:706)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)

"91446054@qtp-422797318-0" prio=10 tid=0x000000004b621400 nid=0x55f6 in Object.wait() [0x000000004120b000..0x000000004120bd90]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaab1171890> (a org.mortbay.thread.QueuedThreadPool$PoolThread)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:563)
        - locked <0x00002aaab1171890> (a org.mortbay.thread.QueuedThreadPool$PoolThread)

"pool-1-thread-5" prio=10 tid=0x00002aaac15d4c00 nid=0x55f5 in Object.wait() [0x0000000041a4f000..0x0000000041a4fd10]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at java.lang.Object.wait(Object.java:485)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
        - locked <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        at java.lang.Thread.run(Thread.java:619)

"pool-1-thread-4" prio=10 tid=0x00002aaac0134000 nid=0x55f4 in Object.wait() [0x000000004194e000..0x000000004194ec90]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at java.lang.Object.wait(Object.java:485)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
        - locked <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        at java.lang.Thread.run(Thread.java:619)

"pool-1-thread-3" prio=10 tid=0x000000004ba72800 nid=0x55f3 in Object.wait() [0x0000000042190000..0x0000000042190c10]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at java.lang.Object.wait(Object.java:485)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
        - locked <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        at java.lang.Thread.run(Thread.java:619)

"pool-1-thread-2" prio=10 tid=0x000000004b8b6c00 nid=0x55f2 in Object.wait() [0x000000004208f000..0x000000004208fb90]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at java.lang.Object.wait(Object.java:485)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
        - locked <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        at java.lang.Thread.run(Thread.java:619)

"pool-1-thread-1" prio=10 tid=0x000000004b8b6400 nid=0x55f1 in Object.wait() [0x0000000040415000..0x0000000040415b10]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at java.lang.Object.wait(Object.java:485)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:316)
        - locked <0x00002aaaafff4580> (a hidden.edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:994)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1054)
        at hidden.edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        at java.lang.Thread.run(Thread.java:619)

"Low Memory Detector" daemon prio=10 tid=0x000000004affd800 nid=0x55eb runnable [0x0000000000000000..0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"CompilerThread1" daemon prio=10 tid=0x000000004affb800 nid=0x55ea waiting on condition [0x0000000000000000..0x0000000041d8b4d0]
   java.lang.Thread.State: RUNNABLE

"CompilerThread0" daemon prio=10 tid=0x000000004aff7800 nid=0x55e9 waiting on condition [0x0000000000000000..0x0000000041c8a450]
   java.lang.Thread.State: RUNNABLE

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

"Finalizer" daemon prio=10 tid=0x000000004afd2400 nid=0x55e7 in Object.wait() [0x000000004184d000..0x000000004184db10]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaaafdf0450> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
        - locked <0x00002aaaafdf0450> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x000000004afd0800 nid=0x55e6 in Object.wait() [0x000000004174c000..0x000000004174ca90]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaaafdf0530> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:485)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
        - locked <0x00002aaaafdf0530> (a java.lang.ref.Reference$Lock)

"main" prio=10 tid=0x000000004af6e000 nid=0x55e4 in Object.wait() [0x000000004072f000..0x0000000040730ed0]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00002aaab1196b60> (a org.mortbay.thread.QueuedThreadPool$Lock)
        at java.lang.Object.wait(Object.java:485)
        at org.mortbay.thread.QueuedThreadPool.join(QueuedThreadPool.java:298)
        - locked <0x00002aaab1196b60> (a org.mortbay.thread.QueuedThreadPool$Lock)
        at org.mortbay.jetty.plugin.Jetty6PluginServer.join(Jetty6PluginServer.java:206)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:461)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
        at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
        at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

"VM Thread" prio=10 tid=0x000000004afcb000 nid=0x55e5 runnable

"VM Periodic Task Thread" prio=10 tid=0x000000004b000000 nid=0x55ec waiting on condition

JNI global references: 861
解决方案

I get so tired of watching people abuse nohup. Here's how real daemonization routines work:

  1. Create a child process.
  2. Launch daemon as a child of that child process.
  3. Exit the first process.

A simple way to emulate this using sh is as follows.

sh -c "mvn jetty:run &"

Observe...

scott@optimusprime:~/code/leapfrog/lasso> sh -c "mvn jetty:run &"
scott@optimusprime:~/code/leapfrog/lasso> ps aux | grep jetty:run
scott    26165 45.5  5.8 813556 235764 pts/9   Sl   15:23   0:06 /usr/lib/jvm/java-6-sun//bin/java -Xmx512M -classpath /home/scott/opt/apache-maven-2.2.1//boot/classworlds-1.1.jar -Dclassworlds.conf=/home/scott/opt/apache-maven-2.2.1//bin/m2.conf -Dmaven.home=/home/scott/opt/apache-maven-2.2.1/ org.codehaus.classworlds.Launcher "jetty:run"
scott@optimusprime:~/code/leapfrog/lasso> exit

If I check my process list from a separate terminal, or later, the program is still running.

However I have to ask, why do this instead of just install your web application in a local application server, and start it? Hopefully you aren't managing your real environments using apache maven.

这篇关于Maven的码头插件 - 延迟在后台模式下启动时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 22:29