1

I am getting an exception while deploying on Weblogic Server:

[2012-01-13 01:17:11,496] ERROR [org.springframework.web.servlet.DispatcherServlet] Context
initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method
failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.

I have some jars as below:

log4j-1.2.14.jar
spring-asm-3.0.3.RELEASE.jar
spring-beans-3.0.3.RELEASE.jar
spring-context-3.0.3.RELEASE.jar
spring-core-3.0.3.RELEASE.jar
spring-expression-3.0.3.RELEASE.jar
spring-web-3.0.3.RELEASE.jar
spring-webmvc-3.0.3.RELEASE.jar
servlet-2.3.jar
validation-api-1.0.0.GA.jar
commons-logging-1.1.1.jar
hibernate-validator-4.0.2.GA.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6.jar
standard.jar
commons-fileupload-1.1.1.jar
ESAPI-1.4.4.jar

I am guessing the issues can be but need guidance to solve it:

After researching the issue, 2 likely scenarios came to the forefront: Hibernate Validator Library has a bug resulting in a dependency on JDK 6 Hibernate Validator has a dependency on the JAXBException Class, and the class is not present in the existing Weblogic Environment Upon further research, the hibernate-validator-4.0.2.jar build states a clear dependency on JDK 5. Digging deeper into the Hibernate Validator code, it appears that version 4.0.2 relies on JAXB API 2.1.

Weblogic servers are on java 1.5 and code is also compiled on java 1.5 then why the exceptions seems to pop up??

GOK
  • 2,338
  • 6
  • 34
  • 63
  • I found that hibernate validator has a dependency on java 6 i added a api named jaxb-api-2.1.jar and then also this issue comes up..any other criteria to resolve this?? – GOK Jan 17 '12 at 13:55

1 Answers1

1

You're being bitten by JAr incompatibilities. Your project has one version of the JAR, but WebLogic has another. The two don't match. (This is what OSGi was born to solve.)

You'll need to tell WebLogic which JAR you prefer. There's a setting in the weblogic.xml for "prefer WAR file JARs." I'm sorry, I can't recall the exact tag name; please Google for it.

duffymo
  • 305,152
  • 44
  • 369
  • 561
  • Thanks buddy!!! Where can i find this weblogic.xml, i have been very new to weblogic (worked on Apache Tomcat)..:) – GOK Jan 17 '12 at 11:09
  • I found that hibernate validator has a dependency on java 6 i added a api named jaxb-api-2.1.jar and then also this issue comes up..any other criteria to resolve this?? – GOK Jan 17 '12 at 13:54
  • 1
    Look here for setting the prefered WAR file JAR : http://stackoverflow.com/questions/7187581/how-to-set-order-of-jars-in-weblogic – Nuno Furtado Apr 08 '14 at 15:56