贺显伟
2014-08-27 17:02
采纳率: 0%
浏览 235
已采纳

tomcat 加载ssh,运行服务器的时候报错,请大神赐教!

求大神赐教!
一个一模一样的项目,教程视频里面都可以运行,为什么我就运行不了?包的什么都是拷贝的它的,我用测试spring是没有问题的,但是运行tomcat服务器就不行, 

在!! 线!! 等!!!
主要是这个错误:java.lang.NoClassDefFoundError: Lorg/hibernate/SessionFactory;
比较全的错误如下(红线以下开始报错):
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultLista
bleBeanFactory@1cad7d80: defining beans [testAction,testService,org.springframework.contex
t.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.inte
rnalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAn
notationProcessor,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0
,dataSource,sessionFactory,transactionManager,org.springframework.aop.config.internalAutoP
roxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSourc
e#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframewo
rk.transaction.config.internalTransactionAdvisor,org.springframework.beans.factory.config.
PropertyPlaceholderConfigurer#1]; root of factory hierarchy
2014-8-27 11:49:01 org.springframework.web.context.ContextLoader initWebApplicationContext
严重: Context initialization failed
java.lang.NoClassDefFoundError: Lorg/hibernate/SessionFactory;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2300)
at java.lang.Class.getDeclaredFields(Class.java:1745)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:516)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:500)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceM
etadata(CommonAnnotationBeanPostProcessor.java:319)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMe
rgedBeanDefinition(CommonAnnotationBeanPostProcessor.java:277)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMerg
edBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:745)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateB
ean(AbstractAutowireCapableBeanFactory.java:448)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(Abs
tractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBea
n(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBean
Factory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(De
faultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFa
ctory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFact
ory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFact
ory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSin
gletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitia
lization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplica
tionContext.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoade
r.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.
java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoader
Listener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142
)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: org.hibernate.SessionFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
... 47 more
2014-8-27 11:49:01 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springfr
amework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: Lorg/hibernate/SessionFactory;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2300)
at java.lang.Class.getDeclaredFields(Class.java:1745)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:516)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:500)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceM
etadata(CommonAnnotationBeanPostProcessor.java:319)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMe
rgedBeanDefinition(CommonAnnotationBeanPostProcessor.java:277)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMerg
edBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:745)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateB
ean(AbstractAutowireCapableBeanFactory.java:448)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(Abs
tractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBea
n(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBean
Factory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(De
faultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFa
ctory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFact
ory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFact
ory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSin
gletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitia
lization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplica
tionContext.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoade
r.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.
java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoader
Listener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • pll001 2014-08-27 17:30
    已采纳

    在eclipse中,把你所有的jar包放在WEB-INF/lib/下面(不要放到子文件夹里面),再选中所有的jar包,右键之后选择buil Path 再选择Add...
    如果还是不行,不用找我,如果行了,也不用找我,个人经验而已。

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • yongskyq 2014-08-27 17:37

    这肯定是没有hibernate的jar包啊,在项目上右键->properties->Java Build Path->Libraries看下有没有hibernate的包,没有就加进去。

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题