java.lang.NoClassDefFoundError: net/sf/hibernate/cfg/NamingStrategy

only
06-01-18 261

spring1 + struts1 + hibernate2
我就用这两句话来测试是否db连接成功.
ApplicationContext ctx = new FileSystemXmlApplicationContext("D:/eclipse/workspace/TestWeb/WebContent/WEB-INF/applicationContext.xml");
SessionFactory sf = (SessionFactory)ctx.getBean("sessionFactory");
出来这个错误, java.lang.NoClassDefFoundError: net/sf/hibernate/cfg/NamingStrategy不知道什么原因??
?

log4j:WARN No appenders could be found for logger (org.springframework.beans.factory.xml.XmlBeanDefinitionReader).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\eclipse\workspace\TestWeb\WebContent\WEB-INF\applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: net/sf/hibernate/cfg/NamingStrategy
java.lang.NoClassDefFoundError: net/sf/hibernate/cfg/NamingStrategy
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
at java.lang.Class.getDeclaredMethods(Class.java:1763)
at java.beans.Introspector$1.run(Introspector.java:1265)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1263)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1129)
at java.beans.Introspector.getBeanInfo(Introspector.java:387)
at java.beans.Introspector.getBeanInfo(Introspector.java:159)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:137)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:79)
at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:226)
at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:208)
at org.springframework.beans.BeanWrapperImpl.<init>(BeanWrapperImpl.java:171)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:217)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:177)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:177)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:60)
at com.test1.TestMain.main(TestMain.java:24)