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. Hacker(19)----检测Windows系统漏洞

    想完全掌握Windows中存在的漏洞需要使用专业的漏洞扫描软件.目前常用的有MBSA(MircosoftBaselineSecurityAnalyzer).360安全卫士等. 一.使用MBSA检测系统 ...

  2. encodeURI与encodeURIComponent的区别

    webservice输出时选择的格式与Content-Type报文头有关 encodeURI与encodeURIComponent的区别:后者会将URI进行编码(包括"://")

  3. Web API零碎知识

    查看EF生成的sql的方法 1.通过在context中设置可以追踪EF[版本必须是6.0或以上]中生成的sql public BookServiceContext() : base("nam ...

  4. unity音频组件

    unity 支持的四种音频格式: .AIFF  适用于较短的音乐文件可用作游戏打斗音效 .WAV  适用于较短的音乐文件可用作游戏打斗音效 .MP3  适用于较长的音乐文件可用作游戏背景音乐 .OGG ...

  5. MyEclipse java was started but returned exit code=-1

    java was started but returned exit code=-1 Vm指的是java虚拟机,默认你安装MyEclipse时会自带一个java虚拟机,Vm配置那一行换成你安装的jav ...

  6. [算法导论]练习2-4.d求排列中逆序对的数量

    转载请注明:http://www.cnblogs.com/StartoverX/p/4283186.html 题目:给出一个确定在n个不同元素的任何排列中逆序对数量的算法,最坏情况需要Θ(nlgn)时 ...

  7. python多进程断点续传分片下载器

    python多进程断点续传分片下载器 标签:python 下载器 多进程 因为爬虫要用到下载器,但是直接用urllib下载很慢,所以找了很久终于找到一个让我欣喜的下载器.他能够断点续传分片下载,极大提 ...

  8. [1] Tornado Todo Day0

    Github地址: day0 初始化数据库: jakeychen@JC:~/Public/tornado_todo$ pwd /home/jakeychen/Public/tornado_todo j ...

  9. 翻译Oracle文档--SYSDBA和SYSOPER系统权限

    SYSDBA和SYSOPER是管理权限,被用户来执行高级管理操作例如:创建 开启/关闭 备份/恢复 数据库.SYSDBA系统权限是针对想给予完全授权的数据库管理员SYSOPER系统权限允许一个用户执行 ...

  10. 利用Azure高级存储搭建高性能Linux服务器(1)

    目前Azure针对虚拟机提供两种类型的存储,一种是标准存储,基于HDD的,一种是高性能存储Premium Storage(在下文中简称PS),基于SSD的.针对用户高性能,低延迟,I/O密集型的应用, ...