m1 mac tomcat启动项目会卡5分钟

问题描述

tomcat启动到部署成功需要5分钟

最新情况,经过反复测试实验, 连sqlserver的速度就快的多。不到1分钟
为什么连oracle这么慢。连线池都是druid

问题出现的平台版本及自己尝试过哪些方法

环境:m1 macbookpro 32g
软件:idea2021.3
java版本:zulu java8
tomcat:8
db:oracle
近期刚更换了mac本,布置好环境后开始跑项目,但是却发现会卡住近4-5分钟才会部署完成
上网搜 最多的说法就是说linux和unix下 需要设置
通过修改Tomcat启动文件-Djava.security.egd=file:/dev/urandom

通过修改JRE中的java.security文件securerandom.source=file:/dev/urandom

可是依然没有效果
因为项目比较老旧,也没用上spingmvc之类的
实际是java6的项目
同样的环境我在win环境下是35秒启动完成
但mac下就是稳定的5分钟左右
数据库的话是win里的虚拟机装的oracle

然后也没有报错
快疯了 ,不知道可有大佬知道 问题出在哪里.不胜感激

可以看图中最后10行左右的内容

Last login: Fri Dec 24 09:18:39 on ttys000

leehe@shuangxi ~ % jstack 1705

2021-12-24 09:21:05

Full thread dump OpenJDK 64-Bit Server VM (25.312-b07 mixed mode):

"http-nio-8080-exec-10" #95 daemon prio=5 os_prio=31 tid=0x000000012f037000 nid=0xcb03 waiting on condition [0x0000000297236000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"http-nio-8080-exec-9" #94 daemon prio=5 os_prio=31 tid=0x000000012f151000 nid=0x13503 waiting on condition [0x000000029702a000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"http-nio-8080-exec-7" #93 daemon prio=5 os_prio=31 tid=0x000000012f900800 nid=0x13703 waiting on condition [0x0000000296e1e000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"http-nio-8080-exec-8" #92 daemon prio=5 os_prio=31 tid=0x000000012f0d3000 nid=0x13803 waiting on condition [0x0000000296c12000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"http-nio-8080-exec-6" #91 daemon prio=5 os_prio=31 tid=0x000000012be9d800 nid=0x13903 waiting on condition [0x0000000296a06000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"http-nio-8080-exec-5" #90 daemon prio=5 os_prio=31 tid=0x000000012f154000 nid=0xc603 waiting on condition [0x0000000295e1e000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"Thread-51" #89 daemon prio=5 os_prio=31 tid=0x0000000128a8c000 nid=0xc503 in Object.wait() [0x0000000295c12000]

java.lang.Thread.State: TIMED_WAITING (on object monitor)

at java.lang.Object.wait(Native Method)

- waiting on <0x00000007434c2ce8> (a com.fto.m2.session.service.SessionControlService)

at com.fto.m2.session.service.SessionControlService.run(SessionControlService.java:361)

- locked <0x00000007434c2ce8> (a com.fto.m2.session.service.SessionControlService)

at java.lang.Thread.run(Thread.java:748)

"http-nio-8080-exec-4" #88 daemon prio=5 os_prio=31 tid=0x0000000128141000 nid=0x13c03 waiting on condition [0x0000000295a06000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"http-nio-8080-exec-3" #87 daemon prio=5 os_prio=31 tid=0x000000012f81d000 nid=0x13d03 waiting on condition [0x0000000293ede000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"http-nio-8080-exec-2" #86 daemon prio=5 os_prio=31 tid=0x00000001281ed800 nid=0x13f03 waiting on condition [0x0000000293cd2000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"http-nio-8080-exec-1" #85 daemon prio=5 os_prio=31 tid=0x000000012dfff000 nid=0xc207 waiting on condition [0x0000000293ac6000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007401748b8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:146)

at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:33)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1112)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

"RMI TCP Connection(idle)" #83 daemon prio=5 os_prio=31 tid=0x0000000128318000 nid=0x9a0f waiting on condition [0x000000017446e000]

java.lang.Thread.State: TIMED_WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x0000000740054af8> (a java.util.concurrent.SynchronousQueue$TransferStack)

at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)

at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)

at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)

at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:941)

at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1073)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

"Thread-49" #82 daemon prio=5 os_prio=31 tid=0x000000016a5ce000 nid=0xc103 in Object.wait() [0x00000002936ba000]

java.lang.Thread.State: TIMED_WAITING (on object monitor)

at java.lang.Object.wait(Native Method)

- waiting on <0x00000007bcacd1f0> (a java.util.ArrayList)

at com.fto.schedule.MultiSchedule.run(MultiSchedule.java:150)

- locked <0x00000007bcacd1f0> (a java.util.ArrayList)

at java.lang.Thread.run(Thread.java:748)

"Thread-48" #81 daemon prio=5 os_prio=31 tid=0x000000012f9c2000 nid=0x7d07 in Object.wait() [0x000000017610a000]

java.lang.Thread.State: TIMED_WAITING (on object monitor)

at java.lang.Object.wait(Native Method)

- waiting on <0x00000007bcacdc40> (a com.fto.schedule.EveryDate)

at com.fto.schedule.Schedule.run(Schedule.java:90)

- locked <0x00000007bcacdc40> (a com.fto.schedule.EveryDate)

at java.lang.Thread.run(Thread.java:748)

--控制台出现

24-Dec-2021 09:18:23.641 信息 [deviceRecThread] com.alibaba.druid.pool.DruidDataSource.info {dataSource-2} inited

时 停在这里 然后又过了两分钟才启动完毕

也就是 卡3分钟到这里 又卡2分钟启动完毕

"Druid-ConnectionPool-Destroy-278310497" #80 daemon prio=5 os_prio=31 tid=0x000000012f012800 nid=0xc003 waiting on condition [0x00000002934ae000]

java.lang.Thread.State: TIMED_WAITING (sleeping)

at java.lang.Thread.sleep(Native Method)

at com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:2848)

"Druid-ConnectionPool-Create-278310497" #79 daemon prio=5 os_prio=31 tid=0x000000012f87f800 nid=0x6107 waiting on condition [0x0000000172bde000]

java.lang.Thread.State: WAITING (parking)

at sun.misc.Unsafe.park(Native Method)

- parking to wait for <0x00000007414d9f78> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)

at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2752)

--- 刚卡住时 jstack监控停在这里-------

"Attach Listener" #78 daemon prio=9 os_prio=31 tid=0x000000012fb28000 nid=0xbe03 waiting on condition [0x0000000000000000]

java.lang.Thread.State: RUNNABLE

"Thread-47" #77 daemon prio=5 os_prio=31 tid=0x000000012b97f000 nid=0xbd03 in Object.wait() [0x0000000293096000]

java.lang.Thread.State: WAITING (on object monitor)

at java.lang.Object.wait(Native Method)

- waiting on <0x00000007435faf18> (a com.fto.m2.service.cache.RamCacheService)

at com.fto.m2.service.cache.RamCacheService.run(RamCacheService.java:149)

- locked <0x00000007435faf18> (a com.fto.m2.service.cache.RamCacheService)

at java.lang.Thread.run(Thread.java:748)

"Thread-46" #76 daemon prio=5 os_prio=31 tid=0x000000012b977000 nid=0xbb03 in Object.wait() [0x0000000292e8a000]

java.lang.Thread.State: WAITING (on object monitor)

at java.lang.Object.wait(Native Method)

- waiting on <0x0000000743615c00> (a com.fto.m2.service.cache.RamCacheService)

at com.fto.m2.service.cache.RamCacheService.run(RamCacheService.java:149)

- locked <0x0000000743615c00> (a com.fto.m2.service.cache.RamCacheService)

at java.lang.Thread.run(Thread.java:748)


回答:

设置 共享 重新设置一下本机名称
疑似是dns的问题


用jstack或者用别的工具,看看卡住的时候tomcat在等什么


回答:

  1. 是在IDE里启动吗?用Run别用Debug试试
  2. 如果是直接用命令启动,开下远程调试用IDE跟一下,看到底卡在哪

以上是 m1 mac tomcat启动项目会卡5分钟 的全部内容, 来源链接: utcz.com/p/944129.html

回到顶部