首页 文章

WebLogic 10.3.6中的奇怪的ClassNotFoundException

提问于
浏览
1

我们有一个在WebLogic 10.3.6应用程序服务器中正常运行的.ear文件 . .ear使用Spring 3.0.5和Hibernate 3.5.2 .

如果我们在另一个WebLogic 10.3.6服务器中部署相同的.ear文件,则会出现下一个错误 .

org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterService': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private nl.surf.adapter.generic.dao.MessageFilterDAO nl.surf.adapter.generic.service.FilterService.messageFilterDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/domain-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private nl.surf.adapter.generic.dao.MessageFilterDAO nl.surf.adapter.generic.service.FilterService.messageFilterDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/domain-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/domain-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: java.lang.NoClassDefFoundError
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration

我尝试了几种解决方案:

  • 将hibernate3.jar放在.war / WEB-INF / lib中(所有jar现在都在.ear / lib中)

  • 在.war / WEB-INF / weblogic.xml中使用<prefer-web-inf-classes> true </ prefer-web-inf-classes>

似乎没什么用 . 我有点迷失在这里......

1 回答

  • 1

    在对网络进行了大量搜索并在.ear上进行了试错后,我找到了解决问题的方法 .

    我已经更改了文件META-INF / weblogic-application.xml并在标签<weblogic-application>中添加了标签

    <prefer-application-packages>
      <package-name>org.apache.*</package-name>
      <package-name>antlr.*</package-name>
    </prefer-application-packages>
    

相关问题