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报错,立即去memcacheserver查看一下,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 tomcatserver

[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须要慎重,且写且慎重。

Error creating bean with name &#39;memcachedClient&#39;...java.lang.OutOfMemoryError的更多相关文章

  1. Error creating bean with name &#39;menuController&#39;: Injection of autowired dependency……

    出现了一大串错误 Error creating bean with name 'userController': Injection of autowired dependencies failed. ...

  2. Error creating bean with name &#39;com.you.user.dao.StudentDaoTest&#39;: Injection of autowired dependencies

    1.错误叙述性说明 七月 13, 2014 6:37:41 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadB ...

  3. [bigdata] 启动CM出现 “JDBC Driver class not found: com.mysql.jdbc.Driver” 以及“Error creating bean with name 'serverLogFetcherImpl'”问题的解决方法

    问题:“JDBC Driver class not found: com.mysql.jdbc.Driver”  通过以下命令启动cm [root@hadoop1 ~]# /etc/init.d/cl ...

  4. Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer'

    @Configuration public class HttpSessionConfig { @Bean public static ConfigureRedisAction configureRe ...

  5. 出错:Error creating bean with name 'studentServiceImpl': Unsatisfied dependency expressed through field 'studentMapper';

    详细错误: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with nam ...

  6. ssh整合报错严重: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxx'

    错误描述:eclipse整合ssh的时候 报不能创建名字为xxx的对象 信息: Destroying singletons in org.springframework.beans.factory.s ...

  7. Error creating bean with name 'adminUserController': Injection of autowired dependencies failed;

    spring 个坑爹地,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ...

  8. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto

    控制台: 2016-4-1 16:32:06 org.hibernate.annotations.common.Version <clinit> 信息: Hibernate Commons ...

  9. Error creating bean with name 'us' defined in class path resource [com/liuyang/test/DI/beans2.xml]: Cannot resolve reference to bean 'daoa' while setting bean property 'daoa'; nested exception is org.

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'us' defined ...

随机推荐

  1. VSIM生成fsdb波形文件(VERILOG)

    VSIM生成fsdb波形文件(verilog) 两步主要的设置 testbench加入函数 运行库调用 1.testbench加入函数 initial begin $fsdbDumpfile(&quo ...

  2. .NET基础拾遗(3)字符串、集合和流1

    一.字符串处理 1.1 StringBuilder类型 众所周知,在.NET中String是引用类型,具有不可变性,当一个String对象被修改.插入.连接.截断时,新的String对象就将被分配,这 ...

  3. seajs初尝 加载jquery返回null解决学习日志含示例下载

    原文地址:http://www.tuicool.com/articles/bmuaEb 如需demo示例,请点击下方链接下载: http://yunpan.cn/cVEybKs8nV7CF  提取码 ...

  4. C# 操作 AppSettings节点

    1.实例 //1.简单获取内容 string value = ConfigurationManager.AppSettings["one"] as string; Console. ...

  5. vector -1

    vector的特色有支持随机存取,在集合尾端增删元素很快,但是在集合中间增删元素比较费时. vector以模板(泛型)方式实现,可以保存任意类型的变数,包括使用者自定义的资料型态,例如:它可以是放置整 ...

  6. sdsdd

    while(scanf("%d",&n)!=EOF) { res=-; level(tmp,n,res,); printf("%d/n",res); }

  7. HEAP[xxx.exe]:Invalid Address specified to RtlValidateHeap 错误的解决方法总结

    一.情况 抽象出问题是这样的: class DLL_API1 A { func() { vector vec; B b; b.func(vec); return TRUE; } } 其中B是另一个导出 ...

  8. IT编程培训,线上线下,孰优孰劣

    现在Java培训机构确实参差不齐,主要有在线培训和线下培训两大类: 1,虚拟和现实的区别:不论视觉,听觉,体验上在线教学都不如线下教学. 2,学费问 题:在线教学由于成本低,不受地域,教学设备限制一般 ...

  9. mysql update语句,修改字段,,或者是批量修改字段

    更新一个字段,在它的后面加一个字符串,不查询数据库得到这个字段值 怎么添加?? 例如: 我的test表,有个user字段,我现在想在它后面加了另一个用户的名字 我在mysql数据库这样写 UPDATE ...

  10. 关于JS中的this关键字

    在学习js时,应该先了解下this关键字,关于js中的this关键字和其他的面向对象语言中的this是不同的,比如在java中,this指的的是当前对象,而在js中,w3c是这样规定的: 关键字 th ...