This is very likely to create a memory leak. Stack trace of thread 错误分析

报错内容

2020-01-08 15:08:49-[ERROR ContextLoader.java:355]  Context initialization failed
java.lang.NoClassDefFoundError: Could not initialize class org.springframework.beans.factory.BeanCreationException
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5278)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1140)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
08-Jan-2020 15:08:49.924 涓ラ噸 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
08-Jan-2020 15:08:49.928 涓ラ噸 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/im-res-product] startup failed due to previous errors
08-Jan-2020 15:08:49.977 璀﹀憡 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [im-res-product] appears to have started a thread named [FileWatchdog] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Thread.sleep(Native Method)
 org.apache.log4j.helpers.FileWatchdog.run(FileWatchdog.java:104)
08-Jan-2020 15:08:49.988 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [F:\tomcat-8.5.37-jdk1.8-8002-im-res-product_bak\webapps\im-res-product] has finished in [20,855] ms

今天启动项目出现这个,又不报具体的哪个类,都是tomcat和spring的类提示。几经周折,终于搞定。

原因如下:
-Xss128k:设置每个线程的栈大小。JDK5.0以后每个线程栈大小为1M,之前每个线程栈大小为256K。应当根据应用的线程所需内存大小进行调整。在相同物理内存下,减小这个值能生成更多的线程。但是操作系统对一个进程内的线程数还是有限制的,不能无限生成,经验值在3000~5000左右。需要注意的是:当这个值被设置的较大(例如>2MB)时将会在很大程度上降低系统的性能。

我们把-Xss调整为2M即可使用;
通常我们都是调整: -Xms1024m -Xmx2048m -XX:PermSize=128m -XX:MaxPermSize=256m
很少会去动Xss这个内容;
今天我的调整如下:-server -Xss2M -Xms1800m -Xmx1800m -XX:PermSize=164M -XX:MaxNewSize=1256m -XX:MaxPermSize=1128m

分享一下,到此为止!

另附一个JVM设置地址:https://blog.csdn.net/lou_lan/article/details/79794721

你可能感兴趣的:(JAVA,Spring,TOMCAT)