Chan Chen Coding...

Java Exception FAQ Collection (On Going)

1. NoClassDefFoundErr
TOMCAT REQ: /verify.gsp?novisitor=true&noses=true Sun Mar 11 20:20:23 PDT 2012 <RequestID: sdc-avo1-e9_2107008000_83300096>
- Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: Could not initialize 
class com.wm.weblib.marketplace.catalog.data.ItemDataCache
        at com.wm.weblib.gs.GracefulShutdownFilter.doFilter(GracefulShutdownFilter.java:
94)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
188)
        at org.apache.tomcat.filters.WMTimerFilter.doFilter(WMTimerFilter.java:
224)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
172)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
174)
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:
200)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:
291)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:
775)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
704)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:
897)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:
689)
        at java.lang.Thread.run(Thread.java:
619)

Solution:

NoClassDefFound error is a nebulous error and is often hiding a more serious issue. It is not the same as ClassNotFoundException (which is thrown when the class is just plain not there).

NoClassDefFound may indicate the class is not there, as the javadocs indicate, but it is typically thrown when, after the classloader has loaded the bytes for the class and calls "defineClass" on them.

The first place to look when you get a NoClassDefFoundError is in the static bits of your class i.e. any initilisation that takes place during the defining of the class. If this fails it will throw a NoClassDefFoundError - it's supposed to throw an ExceptionInInitializer error and indicate the details of the problem but in my experience, these are rare. It will only do the ExceptionInInitializer error the first time it tries to define the class, after that it will just throw NoClassDefFound.

I would thus suggest looking at the code in that HibernateTransactionInterceptor line and seeing what it is requiring. It seems that it is unable to define the class SpringFactory. So maybe check the initilisation code in that class, that might help. If you can debug it, stop it at the last line above (17) and debug into so you can try find the exact line that is causing the exception. Also check higher up in the log, if you very lucky there might be an ExceptionInInitialiser error.


After investigated CatalogCache source code we find this issue caused by generated NameSpace ITEM_PRICING unsuccessfully.
Source code: ITEM_PRICING 
= Namespace.getNamespace(CacheUtil.itemPricingName); 
Line number: 
50.
We had adding 
try catch block to tracking this issue find the root cause.
Tracking code:
try{
                
if(null==ITEM_PRICING){
                                _logger.info(
"ITEM_PRICING equals null!");
                }
                dynamicItemPricing 
= new SpilloverStrandCache(ITEM_PRICING, ITEM_PRICING.getName(), cacheDir, INV_EXTRA_LARGE_CACHE, new MemoryBasedSpilloverEnforcer(0.755010 * 1000));
        }
catch(Exception e){
                _logger.info(
"================================="+e.toString());
        }
Please see error msg:
[com.wm.weblib.catalog.CatalogCache
/<init><MsgText: ITEM_PRICING equals null!> <ThreadID: 50> <SessionID: 000000007d0042683fd3bdd2090c44563fe663864aec98e8> <RequestID: lweng-linux_8443864064_23844608>
[WEB.AVOCADO.INFO.
30000][Mon 2012/03/12 03:39:15:413 EDT][com.wm.weblib.catalog.CatalogCache/<init><MsgText: =================================java.lang.NullPointerException> <ThreadID: 50> <SessionID: 000000007d0042683fd3bdd2090c44563fe663864aec98e8> <RequestID: lweng-linux_8443864064_23844608>

 



-----------------------------------------------------
Silence, the way to avoid many problems;
Smile, the way to solve many problems;

posted on 2012-03-13 09:36 Chan Chen 阅读(178) 评论(0)  编辑  收藏 所属分类: Scala / Java


只有注册用户登录后才能发表评论。


网站导航: