JdonFramework的自带缓存问题(板桥先生进)?

11-04-02 weili0677
使用SJH做的项目,在长时间运行或者大量访问后老是会报如下的错误,并且一直在跳:

请问板桥先生,这是怎么回事?

我也在论坛中找到有一个人也是同样的问题(贴子:http://www.jdon.com/jivejdon/thread/32901),板桥先生的建议是关掉Jdon的自带缓存(修改aspect.xml),但是按照板桥先生的建议关闭后会直接报aop错误,本人是java新手,还望板桥先生详细指点。谢谢。

2011-04-01 08:54:42,156 [http-3251-exec-36] WARN  com.jdon.util.Debug - 
java.lang.NullPointerException
	at com.jdon.util.LRUCache.put(LRUCache.java:47)
	at com.jdon.controller.cache.CacheManager.putObect(CacheManager.java:99)
	at com.jdon.model.cache.ModelCacheManager.saveToCache(ModelCacheManager.java:68)
	at com.jdon.model.cache.ModelCacheManager.setCache2(ModelCacheManager.java:82)
	at com.jdon.model.ModelManagerImp.addCache(ModelManagerImp.java:152)
	at com.jdon.aop.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:71)
	at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:84)
	at com.jdon.aop.AopClient.invoke(AopClient.java:95)
	at com.jdon.bussinessproxy.dyncproxy.DynamicProxyWeaving.invoke(DynamicProxyWeaving.java:62)
	at $Proxy5.getF0101(Unknown Source)
	at cu.zb.ps.SenderListAction.findModelByKey(SenderListAction.java:101)
	at com.jdon.strutsutil.ModelListAction.findModelIFByKey(ModelListAction.java:271)
	at com.jdon.strutsutil.ModelListAction.fetchModel(ModelListAction.java:230)
	at com.jdon.strutsutil.ModelListAction.getModelList(ModelListAction.java:182)
	at com.jdon.strutsutil.ModelListAction.setModellistByKey(ModelListAction.java:88)
	at com.jdon.strutsutil.ModelListAction.execute(ModelListAction.java:59)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at cu.zb.filter.UserLoginFilter.doFilter(UserLoginFilter.java:58)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at com.jdon.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at com.jdon.persistence.hibernate.CloseSessionInViewFilter.doFilter(CloseSessionInViewFilter.java:43)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:282)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:357)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1687)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
<p>

banq
2011-04-02 09:51
2011年04月02日 09:13 "

weili0677"的内容

java.lang.NullPointerException

at com.jdon.util.LRUCache.put(LRUCache.java:47) ...

可能是你的JF版本有点低,我在47行没有看到代码,只有49行:

public void put(Object key, Object value) {

cache.put(key, value);

}

建议:

1.先下载使用最新JF

2.是不是ehcache等jar包没有,没有缓存报错。

weili0677
2011-04-02 10:01
谢谢板桥先生的回复

我是下载了JdonRails和struts1+hibernate_lib

然后以里面的mysjh为基础做的项目

难道struts1+hibernate_lib里面的jf版本是比较低的?还要用6.2.3的jf去替换吗?

banq
2011-04-02 10:03
2011年04月02日 10:01 "weili0677"的内容
难道struts1+hibernate_lib里面的jf版本是比较低的?还要用6.2.3的jf去替换吗? ...

是的,一般案例中的版本都比较低,都要用最新版本替代,本想用Maven,但担心对初学者有些麻烦,所幸jf版本更新不算太快。

weili0677
2011-04-02 10:06
好的,谢谢板桥先生。我先试试去啦。。

weili0677
2011-04-02 10:09
报错了。。新的jf在配置方面也有许些不同呀?蒙了。。

严重: StandardWrapper.Throwable
java.lang.NoSuchMethodError: com/jdon/container/startup/ContainerSetupScript.prepare(Ljava/lang/String;Ljavax/servlet/ServletContext;)V
	at com.jdon.strutsutil.InitPlugIn.init(InitPlugIn.java:83)
	at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:839)
	at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332)
	at javax.servlet.GenericServlet.init(GenericServlet.java:212)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2011-4-2 10:10:55 org.apache.catalina.core.StandardContext loadOnStartup
<p>

banq
2011-04-02 10:27
2011年04月02日 10:09 "

weili0677"的内容

java.lang.NoSuchMethodError: ...

凡是NoSuchMethodError 基本都是版本冲突,存在两个JF,一个是旧的,一个是新的,你要确认替代了tomcat下lib目录,必须是关闭tomcat才能替换,不能有重名。

weili0677
2011-04-02 11:19
尝试了很多种替换方式,都不行呢。

单单只替换更新jdonframework.jar的时候:

直接用myeclipse自带的tomcat时报的是上面的这种错误

把项目打包到安装版的tomcat时启动是成功的,但是加载后又是报的另外的错误。

要慢慢测试了。唉,杯具啊。

banq
2011-04-02 12:19
主要是classpath,你要查看classpath先后,如果之前有一个路径里有jf,是老版本,就会有这个问题,所以,要替换就替换你机器里所有的jf,不用的多余的全部删除,保持一个调试方便。

weili0677
2011-04-02 13:27
谢谢板桥先生,现在我已经弄到可以正常启动tomcat了,不过,在加截完一些类后,就报如下错误了,麻烦再帮我看看,谢谢。。

2011-04-02 13:28:48,942 [http-8080-1] INFO  org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
2011-04-02 13:28:48,954 [http-8080-1] INFO  org.hibernate.cache.UpdateTimestampsCache - starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCache
2011-04-02 13:28:48,958 [http-8080-1] WARN  org.hibernate.cache.EhCacheProvider - Could not find configuration [org.hibernate.cache.UpdateTimestampsCache]; using defaults.
2011-04-02 13:28:48,981 [http-8080-1] INFO  org.hibernate.cache.StandardQueryCache - starting query cache at region: org.hibernate.cache.StandardQueryCache
2011-04-02 13:28:48,981 [http-8080-1] WARN  org.hibernate.cache.EhCacheProvider - Could not find configuration [org.hibernate.cache.StandardQueryCache]; using defaults.
2011-04-02 13:29:02,846 [http-8080-6] ERROR com.jdon.util.Debug - 
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.jdon.aop.reflection.MethodInvokerUtil.execute(MethodInvokerUtil.java:63)
	at com.jdon.aop.reflection.ProxyMethodInvocation.methodInvoke(ProxyMethodInvocation.java:113)
	at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:80)
	at com.jdon.aop.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:76)
	at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:88)
	at com.jdon.aop.interceptor.SessionContextInterceptor.invoke(SessionContextInterceptor.java:84)
	at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:88)
	at com.jdon.aop.interceptor.StatefulInterceptor.invoke(StatefulInterceptor.java:87)
	at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:88)
	at com.jdon.aop.interceptor.PoolInterceptor.invoke(PoolInterceptor.java:95)
	at com.jdon.aop.reflection.ProxyMethodInvocation.proceed(ProxyMethodInvocation.java:88)
	at com.jdon.aop.AopClient.invoke(AopClient.java:110)
	at com.jdon.bussinessproxy.dyncproxy.cglib.CGLIBDynamicProxyWeaving.intercept(CGLIBDynamicProxyWeaving.java:59)
	at cu.zb.service.UserService$$EnhancerByCGLIB$$5aaa596d.getUser(<generated>)
	at cu.zb.ps.UserLoginAction.execute(UserLoginAction.java:507)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at cu.zb.filter.UserLoginFilter.doFilter(UserLoginFilter.java:50)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.jdon.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.jdon.persistence.hibernate.CloseSessionInViewFilter.doFilter(CloseSessionInViewFilter.java:41)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoClassDefFoundError: antlr/ANTLRException
	at org.hibernate.hql.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:35)
	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74)
	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
	at com.jdon.persistence.hibernate.HibernateTemplate$29.execute(HibernateTemplate.java:452)
	at com.jdon.persistence.hibernate.HibernateTemplate.doHibernate(HibernateTemplate.java:74)
	at com.jdon.persistence.hibernate.HibernateTemplate.find(HibernateTemplate.java:450)
	at cu.zb.dao.JdbcDaoImp.getUser(JdbcDaoImp.java:191)
	at cu.zb.service.UserServiceImp.getUser(UserServiceImp.java:112)
	... 46 more
2011-04-02 13:29:02,852 [http-8080-6] ERROR com.jdon.aop.reflection.MethodInvokerUtil - Errors happened in your method:[cu.zb.service.UserServiceImp.getUser]
2011-4-2 13:29:02 org.apache.catalina.core.StandardWrapperValve invoke
<p>

banq
2011-04-02 13:42
没有类发现,缺少antl,这是hibernate需要的一个包,你把noclass found 冒号后面的缺少类名复制到google搜索,就能找到包含该文件的jar包。

weili0677
2011-04-02 13:48
谢谢板桥先生,我下面的这个错误没看到。。

现在已经可以正常使用了,但是现在一些原先正常的地方,会冒

2011-04-02 13:51:25,116 [http-8080-4] ERROR com.jdon.aop.interceptor.CacheInterceptor - [JdonFramework]CacheInterceptor Exception error:java.lang.NullPointerException

的错误,是什么原因呢?也不影响使用。

banq
2011-04-02 15:02
使用缓存拦截器的地方有些没有进行空指针检查,java空指针报错是致命问题,你每使用一个对象,准备访问其内部方法或属性时,多留心眼检查它是否为空,怀疑性对待每一行代码。希望对你和其他初学者有用。

weili0677
2011-04-02 15:18
好的,谢谢,不过,我还不知道要怎么去检查呢。。因为我虽然在很多方用了try..catch,但是都没抓到这个错误。我也不清楚要从哪里入手以及怎样入手了。。。

如果板桥有时间不吝赐教的话,那就再感激不尽了。

weili0677
2011-04-02 15:31
谢谢板桥先生,我知道怎么去解决了。。再次感谢!!!

猜你喜欢