Current location - Quotes Website - Signature design - hibernate connection error in spring MVC
hibernate connection error in spring MVC

Spring+hibernate error summary:

(1)java.lang.NoClassDefFoundError: org/hibernate/context/CurrentSessionContext

Cause: When this error occurs, Please change the hibernate package to the latest or above 3.1

(2)java.lang.NoClassDefFoundError: javax/transaction/TransactionManager

Cause: jta.jar is missing or cannot be found Going to the hbm.xml file causes an error in sessionfactory. Check whether the hbm file path is correct and whether the file exists

(3) Error:

Exception in thread "main" org.hibernate.exception. SQLGrammarException: Could not execute JDBC batch update

or org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: could not insert: [com.yourcompany.model.Login]; bad SQL grammar [insert into mysql__login (name , password) values ??(?, ?)]; nested exception is java.sql.SQLException: Table 'mysql.mysql__login' doesn't exist java.sql.SQLException: Table 'mysql.mysql__login' doesn't exist

Cause and solution: Because the *.hbn.xml tool generated by Hibernate Tools (or Eclipse's own Database Explorer) contains attributes such as catalog="***" (* represents the database name), delete this attribute. That’s ok

(4)org.springframework.orm.hibernate3.HibernateQueryException: undefined alias

Cause: In the spring configuration file, you may have set

org.hibernate.hql.classic.ClassicQueryTranslatorFactory, the HQL interpreter is specified, please delete or change another interpreter org.hibernate.hql.ast.ASTQueryTranslatorFactory , If it is not set, please confirm whether you have written the wrong HQL statement and whether it is the same as the attribute in POJO. Note that it is case sensitive.

(5)quartz error: Caused by: java.lang.NoSuchMethodError:

org.apache.commons.collections.SetUtils.orderedSet(Ljava/util/Set;)Ljava/ util/Set;

The reason is that the commons-collections.jar version used is too low, so you need to use 3.*. The download address is: mons.apache.org/downloads/download_collections.cgi

Select the zip download under Binary. After downloading, place the commons-collections-x.x.x.jar in it into your classpath.

Remember to delete the old jar package

(6)org.springframework.beans.factory.CannotLoadBeanClassException:

Cannot find class [com.mchange.v2.c3p0.ComboPooledDataSource] for bean

This is because your sping configuration file uses c3p0 as the data pool, and the c3p0 jar package is not found in your classpath. Just download a jar and import it into the classpath.

The address is: mons/pool/impl/GenericObjectPool Solution

java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool Reason:

Cannot be found Caused by:

java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool

It is the basic object pool provided by Apache.

Solution:

Go to mons.apache.org/downloads/download_pool.cgi to download the package, and then copy the commons-pool-x.jar inside to the Referenced Libraries of myEclipse Next.

(12) Error message: java.lang.NoClassDefFoundError:

org/apache/commons/collections/LRUMap class not found,

or org The /apache/commons/collections/SequenceHashMap class was not found:

The commons-collections.jar package in the project does not match other packages. For example, if you use

commons-beanutils -1.7.0.jar, commons-collections-3.2.jar will cause your problem. If it is commons-beanutils-1.7.0.jar, commons-collections-3.1.jar, this problem will not occur. ...Wish you good luck

(13) Spring2.0 and Hibernate3.0 error resolution

Serious: action: null

org.springframework .beans.factory.BeanCreationException: Error creating bean with name

'sessionfactory' defined in ServletContext resource [/WEB-INF/beans-config.xml]: Initialization of bean failed; nested exception is java.lang .SecurityException:

class "org.apache.commons.collections.SequencedHashMap"'s signer information does not match signer information of other classes in the same package

java.lang.SecurityException : class "org.apache.commons.collections.SequencedHashMap"s signer information does not match signer information of other classes in the same package

at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)

at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)

at java.lang.ClassLoader.defineClass(ClassLoader.java:614)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at

org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)

at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872).........

asm2.2.3.jar in Spring2.0 AOP Liberaries and Hiberate There is a conflict with the asm.jar used to generate the agent. Later, I deleted asm2.2.3.jar to make it work again

or

java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor< /p>

java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor

java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit

java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V

This error is because the system requires a package called "asm.jar", which is included in the SpingAop package and the Hibernate package, and what's weird is the class org.objectweb.asm.ClassVisitor in these two packages. The method visit method signatures are actually different, so the solution is very simple. When adding HIBERNATE3 capabilities to the project, you don’t need to add a library. You can just use Spring’s AOP library directly.

When using Spring's AOP programming, these libs will be used:

asm-2.2.2.jar

asm-commons-2.2. 2.jar

asm-util-2.2.2.jar

Hibernate uses if lib:

asm.jar

asm- attrs.jar

There is a class conflict between asm-2.2.2.jar and asm.jar!

Using one or both of them, the following error may occur :

java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor

java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor

java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit. . . . . .

The solution is:

Remove the three Hibernate libs on the class path

asm.jar

asm-attrs. jar

cglib-2.1.3.jar

Reserve the following 4 libs in Spring

asm-2.2.2.jar

asm-commons-2.2.2.jar

asm-util-2.2.2.jar

cglib-nodep-2.1_3.jar

Or remove it asm-commons-2.2.2.jar

asm-util-2.2.2.jar

cglib-nodep-2.1_3.jar

(14) Error message: net.sf.cglib.core.CodeGenerationException:

java.lang.reflect.InvocationTargetException-->null

Caused by: java.lang.reflect.InvocationTargetException

p>

Caused by: java.lang.SecurityException:

class "com.wuwei.struts.bean.User

EnhancerByCGLIB

1016ffbf"' s signer information does not match signer information of other classes in the same package

In the....hbm.xml file, change the lazy attribute of the class tag to false (the default is true)

< p>. If there is schema="dbo" catalog="test" configuration information, please delete it