Results 1 to 2 of 2

Thread: Cache Module "java.lang.NoClassDefFoundError"

Hybrid View

  1. #1
    Join Date
    Oct 2008
    Posts
    2

    Default Cache Module "java.lang.NoClassDefFoundError"

    Hi,

    I'm setting up the spring cache module in the following environment:

    Spring Modules 0.9
    Spring 2.5.5
    Sun JDK 1.5_13
    EHCache 1.5.0

    When I declare a cache proxy using the the <map> for the cachingModels everything works fine:

    Code:
    <bean id="myBean" class="org.springmodules.cache.interceptor.proxy.CacheProxyFactoryBean">
    		<property name="cacheProviderFacade" ref="cacheProviderFacade" />
    		<property name="cachingModels">			
    			<map>
    			    <entry key="get*">
    			      <bean class="org.springmodules.cache.provider.ehcache.EhCacheCachingModel">
    			        <property name="cacheName" value="myCache" />			        
    			      </bean>
    			    </entry>
    			  </map>
    			
    		</property>
    		<property name="target" ref="myTarget" />
    	</bean>
    But when I attempt to use the <props> syntax I get "java.lang.NoClassDefFoundError" but it does not specify what class it cannot find.

    Code:
    <bean id="myBean" class="org.springmodules.cache.interceptor.proxy.CacheProxyFactoryBean">
    		<property name="cacheProviderFacade" ref="cacheProviderFacade" />
    		<property name="cachingModels">
    			<props>
        			<prop key="get*">cacheName=myCache</prop>
      			</props>
    		</property>		
    		<property name="target" ref="myTarget" />
    	</bean>
    Results in:

    Code:
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myBean' defined in class path resource [/application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:42)
    	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:173)
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:199)
    	... 16 more
    Caused by: java.lang.NoClassDefFoundError
    	at org.springmodules.cache.provider.ReflectionCacheModelEditor.setAsText(ReflectionCacheModelEditor.java:84)
    	at org.springmodules.cache.interceptor.caching.AbstractCachingInterceptor.propertiesToModels(AbstractCachingInterceptor.java:177)
    	at org.springmodules.cache.interceptor.caching.AbstractCachingInterceptor.afterPropertiesSet(AbstractCachingInterceptor.java:71)
    	at org.springmodules.cache.interceptor.proxy.CacheProxyFactoryBean.afterPropertiesSet(CacheProxyFactoryBean.java:92)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
    	... 32 more

    I downloaded the source to debug it and it blows up on the same line as the stack trace with no extra information.

    I'm stumped. Can anyone point me in the right direction?

  2. #2
    Join Date
    Oct 2008
    Posts
    2

    Default Figured it out.

    After 4 hours of banging my head against the wall I've figured out this issue.

    Basically some class buried in the Spring Cache Module called "SemicolonSeparatedPropertiesParser" had a dependency to apache oro.

    The funny thing is the "java.lang.NoClassDefFoundError" error message was all but useless because it did not specify what class it could not find.

    I looked through the Module docs before I started setting all this up to find the depencency documentation and I could find none. That would have saved me a *lot* of headache.

    I also looked throught he dependencies that came with Spring Modules and did not even find the oro jar in them. Another mystery...

    Anyway, problem solved for now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •