2013-06-12 4 views
0

У нас есть .ear файл, который работает нормально на сервере приложений WebLogic 10.3.6. . Использует Spring 3.0.5 и Hibernate 3.5.2.Weird ClassNotFoundException в WebLogic 10.3.6

Если мы разворачиваем тот же файл .ear на другом сервере WebLogic 10.3.6, мы получаем следующую ошибку.

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 (все банки сейчас находятся в .ear/Lib)
  • Использование < предпочитают -WEB-иНФ-классы > правда </предпочитать-веб-иНФ-классы > в .WAR/WEB-INF/weblogic.xml

Ничто не похоже на работу. Я как бы потерял здесь ...

+0

решить эту проблему самостоятельно. Не могу ответить, поэтому ответ следует завтра. – tsluijter

+0

Я вижу, что в исключенном случае в web.xml отсутствует загрузочный бутстрапинг спящего режима. Правильно? – Sam

+0

У меня такая же проблема с Velocity. Мне интересен подход, чтобы обойти эту проблему NoClassDefFoundError для org/apache/velocity/app/VelocityEngine. –

ответ

0

После некоторого обширного поиска в Интернете и пробных ошибок и ошибок на .ear, я нашел решение для своей проблемы.

Я изменил файл META-INF/НаWebLogic-application.xml и добавил теги под внутри тега < WebLogic-приложения >

<prefer-application-packages> 
    <package-name>org.apache.*</package-name> 
    <package-name>antlr.*</package-name> 
</prefer-application-packages> 
Смежные вопросы