File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes NoClassDefinition found exception even when the jar file is in WEB-INF/lib Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "NoClassDefinition found exception even when the jar file is in WEB-INF/lib" Watch "NoClassDefinition found exception even when the jar file is in WEB-INF/lib" New topic
Author

NoClassDefinition found exception even when the jar file is in WEB-INF/lib

ravi cccc
Greenhorn

Joined: Feb 01, 2011
Posts: 2
hi,

i get the NoClassDefinitionFoundException even when the relevant jar (spring-beans3.0.0.jar) exists in WEB-INF/lib folder. No new jars are added to tomcat lib. I reran with verbose:class as the jvm option and initially the logs say it has loaded the class InitializingBean; but still it throws NoClassDefinitionFoundException

When i put the spring-beans-3.0.0.jar in tomcat/lib then the exception goes off. But this is not a clean solution as i have to move all its dependencies into this.

How do we debug such issues (i use apache tomcat 6.0)? any ideas?

Below is the stack trace

g.config.admin.actions.BasicViewAction.operations; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class
[com.pg.config.def.ConfigConfigurator] for bean with name 'configConfi' defined in class path resource [META-INF/spring/config-common-beans.xml]: problem
with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/beans/factory/InitializingBean
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcesso
r.java:283)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1055)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
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)
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 446

When are you getting this exception....I mean while the server starts up or when you start using the application.

Check that no other application has been deployed which requires Spring library...

There is no hard and fast rule to debug these issues. It comes by experience.
ravi cccc
Greenhorn

Joined: Feb 01, 2011
Posts: 2
WE get the exception during the server statup

only 1 context is in the webapp and it is this
Atul Darne
Ranch Hand

Joined: Jul 05, 2009
Posts: 117

check out the option of clean and build, and try running again.

check your web.xml too if there are any specific mappings , and packages that are not properly defined.


Regards, Atul.
I came to this world on a Learner's License
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: NoClassDefinition found exception even when the jar file is in WEB-INF/lib
 
Similar Threads
Error while starting the tomcat.
Exception during application startup
Bean Initialization fails... Why?
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class
Error defining a bean. Please help