原文引自:http://blog.sina.com.cn/s/reader_53edf7c101009gy3.html
1.
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
原因:<id>元素配置不正确,<id>元素缺少其子元素<generator></generator>的配置。解决方法:<id>元素映射了相应数据库表的主键字段,对其子元素<generator class="">,其中class的取值可以为increment、identity、sequence、hilo、native......等,一般取其值为native 。
2.
java.lang.IllegalArgumentException: id to load is required for loading
方案:Users user=(Users)this.getHibernateTemplate().get(Users.class, id);如果以用户名为参数不能用此方法
3.
org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
方案:sql语句有错误
4.
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\tomcat-docs does not exist or is not a readable directory
严重: Error in resourceStart()
2007-6-6 23:32:25 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2007-6-6 23:32:25 org.apache.catalina.core.StandardContext start
严重: Context startup failed due to previous errors
2007-6-6 23:32:25 org.apache.catalina.core.StandardContext start
严重: Exception during cleanup after start failed
LifecycleException: Container StandardContext[/tomcat-docs] has not been started
5.jsf+spring+hibernate
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
严重: Error listenerStart
2007-6-8 10:31:55 org.apache.catalina.core.StandardContext start
严重: Context [/shj01] startup failed due to previous errors
2007-6-8 10:31:55 org.apache.catalina.core.ApplicationContext log
方案:spring-framework-2.0.5\lib\jakarta-commons下的commons-collections.jar commons-dbcp.jar commons-pool.jar加载到工程去
6.
严重: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
javax.faces.FacesException: Can't parse configuration file:jar:file:/E:/工具/apache-tomcat-6.0.9/apache-tomcat-6.0.9/webapps/jsf02/WEB-INF/lib/jsf-impl.jar!/com/sun/faces/standard-html-renderkit.xml
方案:把tomcat的安装文件换了位置就没事了
7.spring MVC+hibernate
严重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.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
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
方案:
在使用Spring的AOP编程时,会用到这几个lib:
asm-2.2.2.jar
asm-commons-2.2.2.jar
asm-util-2.2.2.jar
Hibernate使用如果lib:
asm.jar
asm-attrs.jar
其中asm-2.2.2.jar与asm.jar存在类上的冲突!!!
使用其中之一或两者都使用,可能会出现如下错误:
java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor
java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor
java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit。。。。。。
解决办法是:
1.去掉类路径上的关于Hibernate的3个lib
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
2.加入Spring中的以下4个lib
asm-2.2.2.jar
asm-commons-2.2.2.jar
asm-util-2.2.2.jar
cglib-nodep-2.1_3.jar
8.spring MVC+hibernate
Exception in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
Caused by: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
9.
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.transaction.interceptor.TransactionProxyFactoryBean] for bean with name 'userService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/framework/AbstractSingletonProxyFactoryBean
Caused by: java.lang.NoClassDefFoundError: org/springframework/aop/framework/AbstractSingletonProxyFactoryBean
方案:没加 spring 2.0 aop libraries
10.
org.apache.jasper.JasperException: Unable to compile class for JSP:
方案:jsp网页中的java代码有问题
11.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CompanyController' defined in class path resource [com/company/test/company-config.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'methodNameResolver' of bean class [com.company.action.CompanyController]: Bean property 'methodNameResolver' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'methodNameResolver' of bean class [com.company.action.CompanyController]: Bean property 'methodNameResolver' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
控制器没继承MultiActionController
12.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'turDiffService' defined in class path resource [com/expert/test/expert-config.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'turDifficultDao' of bean class [com.expert.operation.impl.TurDiffSerImpl]: Bean property 'turDifficultDao' is not writable or has an invalid setter method. Did you mean 'truDifficultDao'?
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'turDifficultDao' of bean class [com.expert.operation.impl.TurDiffSerImpl]: Bean property 'turDifficultDao' is not writable or has an invalid setter method. Did you mean 'truDifficultDao'?
原因:
在定义时TurDifficultDao turDifficultDao ,把有个字母写错,后发现错误,改过来了,但没把get() set()方法中对应的改过来
13.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in class path resource [com/expert/test/expert-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '' is defined
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '' is defined
原因:
在expert-config.xml中创建
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key=""></prop>
</props>
</property>
</bean>
没有给<prop key=""></prop>赋值
14.
org.springframework.orm.hibernate3.HibernateQueryException: Instruction is not mapped
[from Instruction]; nested exception is org.hibernate.hql.ast.QuerySyntaxException:
Instruction is not mapped [from Instruction]
Caused by: org.hibernate.hql.ast.QuerySyntaxException: Instruction is not mapped [from
Instruction]
原因:在data-config.xml中没加入<value>com/serializ/Instruction.hbm.xml</value>
15.
java.sql.SQLException: Field 'userId' doesn't have a default value
原因:把配置文件的主键改为<generator class="assigned" /> 可以进行自定义主键值,因为我在设主键时没有设成自动增长的,要求填默认值是受了配置文件里<generator class="native"/>的影响了。
16.org.apache.jasper.JasperException: Unable to compile class for JSP
原因:jsp页面中的java代码括号不对称!
分享到:
相关推荐
配置SSH整合框架时经常遇到各种问题,文档整理了遇到的常见问题以及相关解决办法
以下是对这些常见错误的详细分析: 1. **连接拒绝(Connection Refused)** 当你尝试连接到远程服务器时,如果看到“Connection refused”错误,这通常意味着SSH服务未运行或防火墙配置不允许连接。检查目标主机的...
### SSH常见错误与解决方案 #### 一、Java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource 错误 在使用MyEclipse进行Struts项目开发时,配置`struts-config.xml`文件中的`data-sources`时...
本文总结了SSH框架常见的错误和解决方法,以便开发者快速解决问题,提高开发效率。 一、Struts配置文件错误 在Struts框架中,struts-config.xml文件是核心配置文件,一旦配置错误,将导致应用程序无法正常运行。...
SSH2框架整合常见错误整理
在Ubuntu系统中,SSH(Secure ...总之,安装和配置SSH服务器是Ubuntu系统管理的重要部分,理解其工作原理和常见问题的解决方法,对于远程运维和开发工作至关重要。通过排查上述问题,你应能解决大多数SSH连接错误。
以下是对SSH常见错误及其解决方案的详细总结: 1. **错误1:Permission denied (publickey).** 这个错误意味着服务器拒绝了你的公钥身份验证。可能的原因是: - 公钥未正确地添加到服务器的`~/.ssh/authorized_...
本篇文章将详细讨论在SSH项目开发中遇到的几种常见异常以及相应的解决方法。 一、连接失败 1. **错误提示:“Connection refused”**:这通常意味着目标服务器未监听SSH端口(默认22)。检查服务器的SSH服务是否...
在IT行业中,SSH整合指的是Spring、Struts和Hibernate这三个开源框架的集成,它们共同构建了一个强大的企业级Web应用开发解决方案。然而,在实际操作过程中,开发者经常会遇到各种问题,其中之一就是...
SSH 错误集锦是一个常见的 SSH 错误总结,涵盖了 Struts1.x 中的常见错误,包括 ServletException、ActionForm 等问题,本文将对这些错误进行详细的分析和解决方法。 1. javax.servlet.ServletException: Must ...
ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目错误锦集ssh2项目...
以下是对这些常见错误的分析和解决方案: 一、关于错误“Error creating bean with name '*' defined in file [*.xml]” 这个错误通常表示Spring在尝试实例化一个Bean时遇到了问题,可能的原因包括但不限于: 1. ...
Java编程ssh整合常见错误解析 Java编程ssh整合是一种常见的技术架构,但是在实际应用中,经常会遇到一些常见的错误。本文将主要介绍Java编程ssh整合常见错误解析,并提供解决方案。 一、 ...
### SSH连接Linux虚拟机及其常见错误解决方法 SSH(Secure Shell)是一种安全的远程登录协议,广泛应用于Linux系统中进行远程管理和数据传输等操作。本文将详细介绍如何通过SSH连接Linux虚拟机,并针对连接过程中...
#### SSH常见的报错及解决方法 1. **无法连接到SSH服务器:** - **错误提示**:“ssh: connect to host [IP地址] port 22: Connection refused” - **原因**:SSH服务没有运行。 - **解决方法**:确保SSH服务已...
总的来说,SSH远程执行脚本是Linux运维中的常见技巧,它依赖于SSH的免密登录和shell脚本的灵活性,能有效提高效率并减少手动操作错误。然而,务必注意安全问题,确保所有操作都在安全的框架内进行。
### 一、常见错误及解决方案 #### 错误1:类路径冲突 当启动项目时,可能会遇到与Hibernate相关的三个库(`asm.jar`、`asm-attrs.jar`、`cglib-2.1.3.jar`)引发的类路径冲突问题。这通常发生在同时使用Hibernate...
常见的错误包括: 1. **配置错误**:如XML配置文件中的实体映射错误、数据源配置错误等,可能导致SessionFactory无法创建。 2. **SQL异常**:查询语句编写错误或数据库表结构与实体类不匹配,可能导致无法执行HQL或...
HTTP状态码404是客户端常见的错误反馈,表示请求的URL无法在服务器上找到。在SSH框架(如Struts、Spring和Hibernate的组合,也称为SSH框架)的Web应用中,这个错误可能由多种原因引起: 1. **Servlet配置错误**:...