Home >Java >javaTutorial >Solving common errors in Java's ssh integration

Solving common errors in Java's ssh integration

黄舟
黄舟Original
2017-10-17 09:34:032777browse

This article mainly introduces the analysis of common errors in Java programming ssh integration. If there are any shortcomings, please leave a message to add.

1. org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.UnsupportedOperationException: Not supported by BasicDataSource

Spring cannot create transactions for JAP. The reason is that bean.xml sets the data source persistence.xml to remove the database connection


<property name="hibernate.connection.username" value="xxx"/>
<property name="hibernate.connection.password" value="xxx"/> 
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/xxx? useUnicode=true&characterEncoding=UTF-8"/>

2. org .springframework.beans.factory.BeanCreationException: Error creating bean with name 'productServiceBean': Injection of persistence fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: org.hibernate.MappingException: Could not determine type for: java.util.Set, for columns: [org.hibernate.mapping.Column (childtypes)]

Reason: @Id @GeneratedValue(strategy = GenerationType.AUTO)

This annotation is written in the get method Do not write on property declarations.

3. javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not insert: [com.yufei.bean.product.ProductType]
Caused by: java.sql.SQLException: Data too long for column 'visible' at row 1

Cause: The value corresponding to visible in the entity class field is inserted into the database It is ASCII code flavor 49, which is out of range.

Change the mysql jar package to solve the problem.

4. Web container appears

Severe: Exception sending context initialized event to listener instance of class org.springframework.web. context.ContextLoaderListener java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

This problem is diverse. According to the information, it is a problem with the jar package commons-logging.jar, but it is solved The way is to re-import the project...

5. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productTypeService': Injection of persistence fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError : org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V

## Reason: asm-2.2.3.jar under Spring2.5 conflicts with asm.jar under hibernate, delete asm-2.2.3.jar.

6. Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLVorg.apache.jasper.compiler. DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java: 88)
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:340)

Cause: standard.jar, jstl.jar is missing in the lib

7. java.lang.NoSuchFieldError: DIRECTORYat net.fckeditor.connector.impl.AbstractLocalFileSystemConnector.getFolders(AbstractLocalFileSystemConnector.java:140)
at net.fckeditor.connector.Dispatcher.getFoldersAndOrFiles(Dispatcher.java:204)
at net.fckeditor.connector.Dispatcher.doGet(Dispatcher.java:156)
at net.fckeditor.connector.ConnectorServlet.doGet( ConnectorServlet.java:89)

Cause: package conflict, delete commons-io-1.1.jar, commons-fileupload-1.1.1.jar that comes with struts1.3, and add it commons-io-1.3.2.jar, commons-fileupload-1.2.1.jar

8.IOException while loading persisted sessions: java.io.EOFException java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2281)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.7e51f00a783d7eb8f68358439dee7daf(ObjectInputStream.java:280)

Reason Tomcat failed to read the session from the hard disk. Here is a complete solution: clear the files under work, mainly *.ser files, or just delete session.ser to solve the problem.

9.javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: com.dalton.domain.Userorg. hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException

##Cause:

(1) The @Id mark of the entity bean is wrong, it is marked on String and other types.
(2) The value of the id field is manually set.

10 org.springframework.web.context.ContextLoader(line:215) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'brand' defined in file [D:\Tomcat6\webapps\autoet\WEB-INF\classes\com\autoet\
action\brand\BrandAction.class]: Instantiation of bean failed ; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate bean
class [com.autoet.action.brand.BrandAction]: Constructor threw exception; nested
exception is java.lang.NullPointerException

Reason: The project uses the 4c768a35efd9b5c69daed3835397d811 scanning mechanism, but the class BrandAction is not marked as a prototype.
Add @Scope("prototype" to the class ) annotation (same position as @Controller)

11 org.hibernate.tool.hbm2ddl.SchemaUpdate(line:222) - could not complete schema update
java.lang.UnsupportedOperationException: Not supported by BasicDataSource

Cause database connections are configured in both spring.xml and persistence.xml, comment out the connection information in persistence.xml

12 org.apache.struts2.dispatcher.Dispatcher(line:27) - Dispatcher initialization failed
Unable to load configuration. - [unknown location]
Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]

The reason is that 24ad0ab83c573ec5304a5620b7bb24c1 is used in struts.xml , comment it out

Summary

The above is the detailed content of Solving common errors in Java's ssh integration. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn