源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Java编程ssh整合常见错误解析

  • 时间:2020-03-21 18:13 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Java编程ssh整合常见错误解析
[b]1. [/b]org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.UnsupportedOperationException: Not supported by BasicDataSource [b]Spring不能为JAP创建事务。原因是bean.xml设定了数据源persistence.xml中要把数据库连接去掉[/b]
<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"/>

[b]2. [/b]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)] [b]原因:@Id @GeneratedValue(strategy = GenerationType.AUTO) [/b] [b]这个注解写在get方法上不要写在属性声明上。[/b] [b]3.[/b] 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 [b]原因:实体类字段中的visible插入到数据库中所对应的值为ASCII码味49,超出范围。 [/b] [b]换个mysql的jar包解决问题。[/b] [b]4. [/b]web容器出现 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory [b]此问题多样化,查阅资料说是jar包commons-logging.jar问题 ,但解决的方式是重新导入项目...[/b] [b]5. [/b]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 [b]原因: Spring2.5下asm-2.2.3.jar 与hibernate下的asm.jar 冲突, 删除asm-2.2.3.jar 。[/b] [b]6. [/b]Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV org.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) [b]原因:lib中缺少standard.jar , jstl.jar[/b] [b]7. [/b]java.lang.NoSuchFieldError: DIRECTORY at 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) [b]原因:包冲突,删掉struts1.3自带的commons-io-1.1.jar,commons-fileupload-1.1.1.jar,加入commons-io-1.3.2.jar,commons-fileupload-1.2.1.jar[/b] [b]8.[/b]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.<init>(ObjectInputStream.java:280) [b]原因是tomcat对硬盘的session读取失败,彻底解决办法一下:将work下面的文件清空,主要是*.ser文件,或者只是删除掉session.ser即可以解决。 [/b] [b]9.[/b]javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: com.dalton.domain.User org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException [b]原因:[/b] [b](1) 是entity bean的 @Id标记错了,标记在了String 等类型上 (2) 对id字段手工设定了值。[/b] [b]10 [/b]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 [b]原因:项目使用了<context:component-scan/>扫描机制, 而类BrandAction没有标注为原型, 为类添加 @Scope("prototype")标注(与@Controller相同位置)[/b] [b]11 [/b]org.hibernate.tool.hbm2ddl.SchemaUpdate(line:222) - could not complete schema update java.lang.UnsupportedOperationException: Not supported by BasicDataSource [b]原因 spring.xml 与 persistence.xml中都配置了数据库连接,注释掉persistence.xml中的连接信息[/b] [b]12[/b] 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] [b]原因 struts.xml中使用了<constant name="struts.objectFactory" value="spring"/>,将其注释掉[/b] [b]总结[/b] 以上就是本文关于Java编程ssh整合常见错误解析的全部内容,希望能对大家有所帮助。如有不足之处,欢迎留言指出,小编会及时更正。感兴趣的朋友可以参阅:[url=http://www.1sucai.cn/article/125233.htm]Kryo框架使用方法代码示例[/url]、[url=http://www.1sucai.cn/article/124537.htm]Java集合框架源码分析之LinkedHashMap详解[/url]、[url=http://www.1sucai.cn/article/125785.htm]浅谈Zookeeper开源客户端框架Curator[/url]等以及本站其他相关专题,感谢大家对本站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部