锁定老帖子 主题:框架整合错误解决方法
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-11-20
框架整合错误解决方法(1) 注意: (1)其中应特别注意第七点,导入包冲突问题!!! (2)建立工程后先为工程加入log4j文件:
log4j配置文件 log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.file=org.apache.log4j.RollingFileAppender
下面是错误示例及解决方法: 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 严重: Error in resourceStart() 5.jsf+spring+hibernate 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 严重: Error listenerStart 方案:spring-framework-2.0.5\lib\jakarta-commons下的commons-collections.jar commons-dbcp.jar commons-pool.jar加载到工程去 6. 方案:把tomcat的安装文件换了位置就没事了 7.spring MVC+hibernate 严重: StandardWrapper.Throwable 在使用Spring的AOP编程时,会用到这几个lib: Hibernate使用如果lib: asm.jar 其中asm-2.2.2.jar与asm.jar存在类上的冲突!!! 或者加入 asm-all-3.0.jar
框架整合错误解决方法(2) 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 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 方案:没加 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?
12.
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
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] Instruction] 或者:查询语句没写对from com.tweb.dao.hb.po.TSysDept as t where t.deptName like '%11%' pname 这里com.tweb.dao.hb.po.TSysDept是类名,而且必须包含包名,也就是TSysDept.hbm.xml完整类名,deptName是TSysDept.hbm.xml里面的name,而不是表字段名!! 15. java.sql.SQLException: Field 'userId' doesn't have a default value 16.org.apache.jasper.JasperException: Unable to compile class for JSP 原因:jsp页面中的java代码括号不对称! 17.当引用不同的工程中的DAO层时,直接调用dao层会出问题,必须引入配置文件 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2009-02-26
无外乎一下几点:
1.包少了 2.包多了 3.包重复了 4.版本不支持 |
|
返回顶楼 | |
浏览 4525 次