?
Solved

Spring 3.0 and Websphere 6.1

Posted on 2011-04-24
4
Medium Priority
?
1,069 Views
Last Modified: 2012-05-11
Hi Experts,

My project is developed using Spring 3.0, JPA with Hibernate and Oracle 10g database. I developed the project using Tomcat 7 and JDK1.6.

Later, when I tried deploying the application on Websphere 6.1, I ran in to JAXBException. Later, I found that there is a dependency in Hibernate 3.0 validator with JDK1.6 and Websphere 6.1 supports only JDK1.5, therefore, the issue occured.

In the Spring community, it was told that we shall download and use Hibernate 3.5, which does not have any dependency on JDK1.6 and compatible with JDK1.5. But still I am running into issues.

Right now, I am testing environment is, Tomcat 6.0 and JDK1.5. I have attached the error for your review, please advice.
Apr 25, 2011 9:14:38 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_22\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Windows Imaging\;D:\Program Files\TortoiseSVN\bin;C:\Program Files\QuickTime\QTSystem\;C:\apache-maven-2.0.9\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Windows Imaging\;D:\Program Files\TortoiseSVN\bin;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jre1.5.0_22\bin;C:\apache-tomcat-6.0.26\apache-tomcat-6.0.26\bin;C:\Jboss6.0\bin;
Apr 25, 2011 9:14:38 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:ETW' did not find a matching property.
Apr 25, 2011 9:14:39 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Apr 25, 2011 9:14:39 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1029 ms
Apr 25, 2011 9:14:39 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Apr 25, 2011 9:14:39 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.26
Apr 25, 2011 9:14:39 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\ElectronicTakeonWizard\ReleaseV1.1\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ETW\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Apr 25, 2011 9:14:40 AM org.apache.catalina.core.ApplicationContext log
INFO: Set web app root system property: 'webapp.root' = [D:\ElectronicTakeonWizard\ReleaseV1.1\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ETW\]
Apr 25, 2011 9:14:40 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing log4j from [classpath:/resources/log4j.properties]
Apr 25, 2011 9:14:40 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Apr 25, 2011 9:14:41 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginDAO' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: INSTANCE
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1317)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	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.java:563)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:519)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: INSTANCE
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
	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: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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
	... 30 more
Caused by: java.lang.NoSuchFieldError: INSTANCE
	at org.hibernate.type.BasicTypeRegistry.<init>(BasicTypeRegistry.java:94)
	at org.hibernate.type.TypeResolver.<init>(TypeResolver.java:59)
	at org.hibernate.cfg.Configuration.<init>(Configuration.java:250)
	at org.hibernate.cfg.Configuration.<init>(Configuration.java:302)
	at org.hibernate.cfg.AnnotationConfiguration.<init>(AnnotationConfiguration.java:98)
	at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:107)
	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:130)
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
	... 37 more
Apr 25, 2011 9:14:41 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Apr 25, 2011 9:14:41 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/ETW] startup failed due to previous errors
Apr 25, 2011 9:14:41 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Apr 25, 2011 9:14:41 AM org.apache.catalina.core.ApplicationContext log
INFO: Shutting down log4j

Open in new window

0
Comment
Question by:vijayprabakar
  • 2
4 Comments
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35464678
its says that ...
your bean def is worng.. or it cant find out the setter method for property of loginDAO ?


Is that working code ??
0
 
LVL 8

Expert Comment

by:colr__
ID: 35482188
When you were developing in tomcat 7 I assume ou are using the Sun jdk? Websphere only works with the IBM jdk and there are differences in a number of places that I know of.

I'm taking a stab in the dark, but try adding this to a context listener:

System.setProperty("javax.xml.stream.XMLInputFactory", "com.sun.xml.internal.stream.XMLInputFactoryImpl");	

Open in new window


This will force websphere to use the sun stax implementation. I had to do this in a past project as the ibm stax implementation was truncating data.

I thought of this as soon as you mentioned problems with JAXB - it's worth a try.
0
 

Accepted Solution

by:
vijayprabakar earned 0 total points
ID: 35799765
JAXB error was due to the dependency of Hibernate Validator towards JDK1.6. I rectified it.
0
 

Author Closing Comment

by:vijayprabakar
ID: 35821861
I found the reason for the bug.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

-Xmx and -Xms are the two JVM options often used to tune JVM heap size.   Here are some common mistakes made when using them:   Assume BigApp is a java class file for the below examples. 1.         Missing m, M, g or G at the end …
Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question