tsluijter
tsluijter

Reputation: 41

Weird ClassNotFoundException in WebLogic 10.3.6

We have an .ear file that is running normal in a WebLogic 10.3.6 application server. The .ear uses Spring 3.0.5 and Hibernate 3.5.2.

If we deploy the same .ear file in another WebLogic 10.3.6 server, we get the next error.

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

I've tried several solutions:

Nothing seems to work. I'm kind of lost here...

Upvotes: 1

Views: 2881

Answers (1)

tsluijter
tsluijter

Reputation: 41

After some extensive searching on the web and trial and error changes on the .ear, i've found the solution for my problem.

I've changed file META-INF/weblogic-application.xml and added the tags beneath inside tag <weblogic-application>

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

Upvotes: 1

Related Questions