jar中的NoClassDefFoundError LocalSessionFactoryBuilder

时间:2012-11-06 22:41:40

标签: jar war noclassdeffounderror web-inf

我是Web应用程序开发的新手,需要您的帮助。我在Weblogic 10.3上使用Spring3.1.2 / Hibernate 4.1。我部署了war文件但是在运行时下面得到了NoClassDefFoundError。

它抱怨LocalSessionFactoryBuilder。但是如果你看到stacktrace的第一行,则调用是从org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet()开始的。 LocalSessionFactoryBuilder和LocalSessionFactoryBean在同一个包中,我可以在WEB-INF / lib中的org.springframework.orm-3.1.2.RELEASE.jar中看到这两个类。任何线索?

Caused By: java.lang.NoClassDefFoundError: org/springframework/orm/hibernate4/LocalSessionFactoryBuilder
        at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:277)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:591)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

1 个答案:

答案 0 :(得分:0)

我用其他方式解决了这个问题。我已将所有jar放在$ DOMAIN / servers / $ MYSERVER / lib目录中,并将它们添加到setEnvsstserver的类路径中。不知道为什么WEB-INF / lib中的jar没有被拿起。