Error creating bean with name 'memcachedClient'...java.lang.OutOfMemoryError
1,Tomcat啟動報錯如下:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'memcachedClient' defined in file [/usr/local/apache-tomcat-6.0.37_6500/webapps/trade_service/WEB-INF/classes/META-INF/spring/springContext_memcached.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public net.rubyeye.xmemcached.MemcachedClient net.rubyeye.xmemcached.XMemcachedClientBuilder.build() throws java.io.IOException] threw exception; nested exception is java.lang.OutOfMemoryError at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod (ConstructorResolver.java:581) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod (AbstractAutowireCapableBeanFactory.java:1015) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance (AbstractAutowireCapableBeanFactory.java:911) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference (BeanDefinitionValueResolver.java:322) ... 44 more Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public net.rubyeye.xmemcached.MemcachedClient net.rubyeye.xmemcached.XMemcachedClientBuilder.build() throws java.io.IOException] threw exception; nested exception is java.lang.OutOfMemoryError at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate (SimpleInstantiationStrategy.java:169) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod (ConstructorResolver.java:570) ... 53 more Caused by: java.lang.OutOfMemoryError
,
2,看到建立memcache clent報錯,馬上去memcache伺服器檢視一下,memcache正常執行,記憶體也足夠剩餘。
[root@localhost ~]# tail -f /tmp/memcache_error.log <287 0x00 0x00 0x00 0x00 <287 0x00 0x00 0x00 0x00 <287 0x00 0x00 0x00 0x00 >287 Writing bin response: >287 0x81 0x0b 0x00 0x00 >287 0x00 0x00 0x00 0x00 >287 0x00 0x00 0x00 0x06 >287 0x00 0x00 0x00 0x00 >287 0x00 0x00 0x00 0x00 >287 0x00 0x00 0x00 0x00 ... [root@localhost ~]# free -m total used free shared buffers cached Mem: 5938 3368 2570 0 195 296 -/+ buffers/cache: 2876 3061 Swap: 7935 0 7935 [root@localhost ~]#問題在哪裡?再看看日誌裡面有誤error或者warning資訊:
[root@localhost ~]# cat /tmp/memcache_error.log |grep warning [root@localhost ~]# cat /tmp/memcache_error.log |grep error [root@localhost ~]#一點錯誤資訊也沒有,判斷問題不是出在memcache這一塊。
3,去check tomcat伺服器
[root@localhost logs]# free -m total used free shared buffers cached Mem: 18022 16943 1078 0 104 675 -/+ buffers/cache: 16162 1859 Swap: 20031 8012 12019 [root@localhost logs]#只剩餘1個G的記憶體,去修改一下tomcat的記憶體配置:
[root@localhost bin]# vim catalina.sh
#JAVA_OPTS="-Xms2048m -Xmx2048m -Xss1024K -XX:PermSize=256m -XX:MaxPermSize=768m" # add by wangqi on 20140614 JAVA_OPTS="-Xms512m -Xmx512m -Xss128K -XX:PermSize=64m -XX:MaxPermSize=256m"再重啟tomcat,看到還是報一樣的錯誤。
4,回到應用本身去查問題
跟開發人員一起排查,看到是trade_service啟動了過多的多餘的事務,把tomcat的記憶體耗光了,所以關閉掉多餘的事務,再啟動tomcat,就不會再報錯。
感慨:就跟大部分web應用卡,頁面登入不上去,相應過慢很多是出在效率低下的sql上面,tomcat啟動不起來,記憶體溢位大部分也是在java程式碼上面,大家需要寫程式碼或者sql需要謹慎,且寫且謹慎。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26230597/viewspace-1183119/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Error creating bean with name ‘dataSource‘ErrorBean
- Error creating bean with name 解決ErrorBean
- Error creating bean with name 'tomcatEmbeddedServletContainerFactory'ErrorBeanTomcatServletAI
- Error creating bean with name ‘dataSource‘: Unsatisfied dependency expressed through fieldErrorBeanExpress
- Spring注入bean報錯 Error creating bean with name的網上找不到的解決方案SpringBeanError
- 關於報錯Error creating bean with name 'xxxxx': Invocation of init method....ErrorBean
- 異常解決——Spring Cloud FeignClient: BeanCreationException: Error creating bean with name XXXServiceSpringCloudclientBeanExceptionError
- 解決程式中Error creating bean with name 'XXXXX‘ defined in class path resource [application的異常ErrorBeanAPP
- error: '[class name]' does not name a typeError
- error :does not name a typeError
- error: 'cout' does not name a type|Error
- An error has occurred when creating this preference page.Error
- Caused by: Error: ' ' is not a valid resource name characterError
- error: ‘xxx’ does not name a typeError
- error: ‘變數名‘ does not name a type|Error變數
- emulator: ERROR: unknown virtual device nameErrordev
- ORA-27504: IPC error creating OSD contextErrorContext
- error creating overlay mount to invalid argument unbuntu系統Error
- Import Error: cannot import name ‘export_saved_modelImportErrorExport
- FeignClientSpecification‘ could not be registered. A bean with that name has already been definedclientBean
- stributed Management [1 exceptions] Error creating connection pool......ExceptionError
- ERROR: failed to establish dependency between database db_name and diskgroupErrorAIDatabase
- ORA-31687: error creating worker process with worker id 1Error
- Dynamics CRM Error- Creating Entity with an invalid parent. Entity: EmailErrorAI
- 【kingsql分享】安裝EM遇到【SEVERE: Error creating the repository】SQLError
- grid control Error in getting data for creating new listenerError
- ndk編譯錯誤:error: 'override' does not name a type編譯ErrorIDE
- Error: The cluster is not configured or is not running on node NODE_NAMEError
- ORA-600[13013] Error While Creating a User. [ID 297595.1]ErrorWhile
- 【oracle】ORA-01580 error creating control backup fileOracleError
- java.lang.OutOfMemoryErrorJavaError
- Tomcat執行報錯,Annotation-specified bean name 'KY_QT_TTomcatBeanQT
- ORA-00270: error creating archive log ORA-16055: FAL request rejectedErrorHive
- Andorid“emulator: ERROR: unknown virtual device name”問題解決Errordev
- QT中error: xxx does not name a type xxx錯誤QTError
- Android之NDK開發錯誤 error: unknown type name 'JNIEXPORT'AndroidErrorExport
- 解決Mac java.net Local host name unknown error的方法MacJavaError
- java.lang.OutOfMemoryError: PermGen spaceJavaError