Spring + Hibernate Not able to address issue - spring

i am using spring 3.2.4 (latest stable version) with hibernate
i have added all the dependencies but still i am getting the error which is below
java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor
if i use maven
then i get too many errors like Failed to Autowired (in both service and DAO),
org.springframework.beans.factory.BeanCreationException:
java.lang.ClassNotFoundException: org.hibernate.cache.CacheProvider
please help me to solve problem for one of above. i want to create an application (spring + Hibernate) any of way (with maven or without maven)

The application is missing the hibernate-core-x.x.x.jar file. You will need to find the appropriate version of the jar.
Use FindJar: http://www.findjar.com/jar/org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar.html
The class java.lang.ClassNotFoundException: org.hibernate.cache.CacheProvider is included in version of Hibernate before version 4.0. I would update all of your libraries to use the 4.0 version.

Related

Spring Data DynamoDb Integration with Spring Boot(java.lang.AbstractMethodError: createPersistentProperty)

We were working on the Integration of the Dynamo Db with our Spring Boot Project (maven based project) so as to deploy it as a lambda project which can access data over dynamo db and render it to our static website .After configuring the repos and the POJOS for our project we did mvn clean install and found the following issue that occurred during the build .
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyInteractivesFunction': Unsatisfied dependency expressed through field 'MyClientDetailsRepository';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyClientDetailsRepository': Invocation of init method failed;
nested exception is java.lang.AbstractMethodError: org.springframework.data.mapping.context.AbstractMappingContext.createPersistentProperty(Lorg/springframework/data/mapping/model/Property;Lorg/springframework/data/mapping/model/MutablePersistentEntity;Lorg/springframework/data/mapping/model/SimpleTypeHolder;)Lorg/springframework/data/mapping/PersistentProperty;
It seems that the issue was in mapping the POJO properties with the columns but we created another dummy project separately and it worked there. Need a solution for it.
After lots of searching and applying various ways we found what actually was the real cause of problem was jars incompatibility. Our Spring boot version was based on 2.0.3 and the spring data dynamodb version was 4.5.0 which dont work well with each other.Hence , we found a link that very sweetly describes the issue :
https://derjust.github.io/spring-data-dynamodb/ , So we changed the spring data dynamodb version to 5.0.4 and it worked like a charm we were able to retrieve results from Dynamo Db.

Dependency conflict in pentaho data integration when an external jar is called from UDJC step

I have a spring project which is deployed in libext folder in Pentaho Data Integration and called from "User Defined Java Class" step. I get a java.lang.NoSuchMethodError: org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.batchUpdate The project has a dependency on org.springframework.spring-jdbc (version 4.1.7) which has batchUpdate method in NamedParameterJdbcTemplate. However, the Pentaho lib folder has spring-2.5.6 jar which has org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate which probably doesn't have batchUpdate method. How can this dependency conflict be resolved..I have Pentaho CE 5.3.Thanks in advance.
In addition to placing the jar file into /libext, you will also need to modify /launcher/launcher.properties to look for user defined libraries in libext. It will take effect on the next restart of Spoon.
libraries=../test:../lib:../libswt:../libext
classpath=../:../ui:../ui/images:../lib:../libext
After a bit of R&D, I figured it was the problem with the version of spring jars used. Pentaho DI 5.3 has org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate class in spring2.5.6 jar which doesn't have batchUpdate method. My project was built on spring 4 which has batchUpdate method in spring-jdbc jar. This was causing the dependency discrepancy and hence the NoSuchMethodError. I fixed it by using a later version of Pentaho DI (version 6.1) which internally uses Spring 3 and has no such conflicting jars.

java.lang.NoClassDefFoundError on using spring security on google app engine

I am using Spring Core framework version 4.1.6.RELEASE and Spring Security version 4.0.0.RELEASE in my google app. But when I try to run it in local appservere I see following log
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: java.lang.reflect.Parameter is a restricted class. Please see the Google App Engine developer's guide for more details.
Then I checked that in which jdk version this java.lang.reflect.Parameter class was introduced and found that it is there since 1.8. But app engine supports java 1.7 only. How could I find the spring framework versions which are build on 1.7 JDK. Please suggest
You have to download the JDK7 and it will work. I had the same problem.

trouble with spring-hibernate3:jar:2.0.8 and struts2-core:jar:2.3.16 for different version of asm

I am working on a project for upgrade an application to spring 3.2.0.RELEASE, struts 2.3.16, and hibernate 3.6.5.Final.
in the pom.xml, I have dependency spring-hibernate3 2.0.8 version.
And, I found out this version need asm:asm-attrs:jar:1.5.3:compile,
but, struts need asm 3.3 and 3.3.1.
Currently, when I try to start the application use Tomcat 7.0, I have issue with different asm version conflict issue.
The errors are:
Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(Z)V
I can't upgrade the hibernate to 4, I have to stay in 3.6.
So, I need introduce two version of asm, how to separate them and forbid them refer the wrong version of asm?

How do I prevent Maven including certain dependencies in deployable war?

I'm migrating an application that uses Spring security 3.0 to Spring security 3.1.
I have been getting an error about incorrect schema being referenced:
SEVERE: Exception sending context initialized event to listener instance of class
org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration
problem: You must use a 3.0 schema with Spring Security 3.0.(2.0 or 3.1 versions are not
valid) Please update your schema declarations to the 3.0.3 schema (spring-security-
3.0.3.xsd).
Offending resource: ServletContext resource [/WEB-INF/security-context.xml]
When I look in /lib I see a number of jars that are 3.1 versions are duplicated as 3.0 versions. I suspect this is what is causing the error above.
When I look at the dependency tree of the pom.xml using the Eclipse Maven plugin, I can see where the earlier versions are being referenced (eg spring-security-acl depends on several 3.0 jars) but they are marked as 'omitted for conflict with...'. Does that not mean they should be omitted from the built war file?
I've tried explicitly naming 3.1 versions of those files at the root of my pom but the older versions still get included.
Offending resource: ServletContext resource
[/WEB-INF/security-context.xml]
Actually the message indicates that security-context.xml uses schema/declarations which are incompatible with spring-security-3.1. The message is requesting you to use a 3.0 version of the library instead. You may want to review and update it and retry.
I'm still not sure what was going on, but I tried creating a new project in Eclipse with the same pom and source files and now the project seems to behave itself.

Resources