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正常运行,内存也足够剩余。

[[email protected] ~]# 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
...
[[email protected] ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          5938       3368       2570          0        195        296
-/+ buffers/cache:       2876       3061
Swap:         7935          0       7935
[[email protected] ~]#

问题在哪里?再看看日志里面有误error或者warning信息:

[[email protected] ~]# cat  /tmp/memcache_error.log  |grep warning
[[email protected] ~]# cat  /tmp/memcache_error.log  |grep error
[[email protected] ~]#

一点错误信息也没有,判断问题不是出在memcache这一块。

3,去check tomcat服务器

[[email protected] logs]# free -m
             total       used       free     shared    buffers     cached
Mem:         18022      16943       1078          0        104        675
-/+ buffers/cache:      16162       1859
Swap:        20031       8012      12019
[[email protected] logs]# 

只剩余1个G的内存,去修改一下tomcat的内存配置:

[[email protected] 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需要谨慎,且写且谨慎。

Error creating bean with name 'memcachedClient'...java.lang.OutOfMemoryError,布布扣,bubuko.com

Error creating bean with name 'memcachedClient'...java.lang.OutOfMemoryError

时间: 2024-10-23 15:02:43

Error creating bean with name 'memcachedClient'...java.lang.OutOfMemoryError的相关文章

java.lang.OutOfMemoryError: Java heap space错误及处理办法(收集整理、转)

下面是从网上找到的关于堆空间溢出的错误解决的方法: java.lang.OutOfMemoryError: Java heap space =================================================== 使用Java程序从数据库中查询大量的数据时出现异常:java.lang.OutOfMemoryError: Java heap space 在JVM中假设98%的时间是用于GC且可用的 Heap size 不足2%的时候将抛出此异常信息. JVM堆的设置是

java.lang.OutOfMemoryError: Java heap space错误及处理办法

以下是从网上找到的关于堆空间溢出的错误解决办法: java.lang.OutOfMemoryError: Java heap space =================================================== 使用Java程序从数据库中查询大量的数据时出现异常:java.lang.OutOfMemoryError: Java heap space 在JVM中如果98%的时间是用于GC且可用的 Heap size 不足2%的时候将抛出此异常信息. JVM堆的设置是指

java.lang.OutOfMemoryError: Java heap space错误和方法(集、转)

错误的方式来解决溢出下面的堆空间是从网上找: java.lang.OutOfMemoryError: Java heap space =================================================== 使用Java程序从数据库中查询大量的数据时出现异常:java.lang.OutOfMemoryError: Java heap space 在JVM中假设98%的时间是用于GC且可用的 Heap size 不足2%的时候将抛出此异常信息. JVM堆的设置是指ja

关于java.lang.OutOfMemoryError: Java heap space的错误分析

今天无意间遇到这个错误:java.lang.OutOfMemoryError: Java heap space 问题出现原因:使用a标签实现快速下载[当然已经实现了,但想了想还是要归纳解决这类问题] <a href="/visecRepos/downFileServlet?filepath=/tdp/upload/14066209657…ename=%BC%AF%BF%D8%CF%B5%CD%B3%B0%B2%D7%B0%CE%C4%BC%FE_1.rar" target=&qu

转:java.lang.OutOfMemoryError: Java heap space错误及处理办法(收集整理、转)

以下是从网上找到的关于堆空间溢出的错误解决办法: Java.lang.OutOfMemoryError: Java heap space =================================================== 使用Java程序从数据库中查询大量的数据时出现异常:java.lang.OutOfMemoryError: Java heap space 在JVM中如果98%的时间是用于GC且可用的 Heap size 不足2%的时候将抛出此异常信息. JVM堆的设置是指

Java AOP nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice || Error creating bean with name &#39;org.springframework.aop.aspectj.AspectJPointcutAdvisor#0&#39; 两个异常解决办法

贴出applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://ww

java数据库执行迁移报错Error creating bean with name &#39;flywayInitializer&#39; defined in class path resource

报错原因 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocati

Error creating bean with name

今天碰到一个特别奇怪的问题: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ecfCustomerEditService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: C

Error creating bean with name &#39;sessionFactory&#39; defined in class path resource [applicationContext.xm

报错信息如下: <span style="font-size:24px;">17:18:32,245 ERROR ContextLoader:307 - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resour