Thursday, October 30, 2014

Upgrading spring from 3.0.6. to 4.1.1.RELEASE[Respective hibernate mapping files]

Here is the changes:

Below are the artifacts which are used in the 3.0.6 release


<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.6.RELEASE</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>

<!-- Hibernate dependencies -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.5.6-Final</version>
</dependency>

Now I am updating this with spring version:
<org.springframework.version>4.1.1.RELEASE</org.springframework.version>

and the hibernate core version with  4.2.4.Final


After upgrading to this,When I started my application I got the below exception.

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.VerifyError: (class: org/springframework/context/annotation/ConfigurationClassEnhancer$BeanMethodInterceptor, method: intercept signature: (Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;Lorg/springframework/cglib/proxy/MethodProxy;)Ljava/lang/Object;) Incompatible argument to function
at org.springframework.context.annotation.ConfigurationClassEnhancer.<clinit>(ConfigurationClassEnhancer.java:67)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:377)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:259)


Issue because of JReble.. , I run my server with out JReble got different issue.

Issue 2#
java.lang.NoClassDefFoundError: org/hibernate/util/DTDEntityResolve


Solution :

When I got the above exception I removed the below dependency.

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>

Hibernate 3.5 and onward contains Hibernate Annotations.

Issue 3#

NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given,

Solution:
Added the below property in hibernate.cfg.xml file

<property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</property>

Now I am ready :-)

No comments: