`
machunlin
  • 浏览: 27350 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

使用MyEclipse快速整合 SSH常常遇到的错误

阅读更多
原文引自: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框架时常遇到的错误

    在整合SSH(Spring、Struts、Hibernate)框架的过程中,初学者常常会遭遇一系列技术难题,尤其是在使用MyEclipse开发环境中构建基于Struts2+Spring2+Hibernate3架构的项目时。下面将详细解析一些常见的错误及其解决...

    WebSphere6.1+myeclipse6.0+ssh2整合手册

    本篇将详细讲解如何在WebSphere 6.1服务器上配置MyEclipse 6.0.0.M1集成开发环境,并整合Struts2、Spring2和Hibernate3这三大流行框架,即SSH2(Struts2、Spring、Hibernate2)的集成过程。 首先,我们来了解...

    MyEclipse中SSH配置文件提示插件

    总的来说,这个插件是针对MyEclipse的SSH开发增强工具,旨在提升开发者的开发体验,通过提供XML配置文件的智能提示和错误检测,使得在Spring、Struts和Hibernate的整合开发中更加高效和便捷。安装和使用此插件,...

    J2EE三大框架SSH在MyEclipse工具中整合配置流程

    ### J2EE三大框架SSH在MyEclipse工具中的整合配置流程 #### 一、概述 在Java企业级应用开发中,SSH(Struts + Spring + Hibernate)是经典的三层架构组合,其中Struts负责表现层,Spring负责业务逻辑层,Hibernate...

    ssh整合简单示例(myeclipse工程)

    在"ssh整合出现null错误.doc"文档中,可能详细记录了在整合过程中遇到的空指针异常问题。空指针异常通常发生在试图访问或操作一个值为null的对象引用时。这可能是因为缺少必要的依赖注入、对象未正确初始化,或者...

    MyEclipse下SSH配置详细步骤及异常处理

    本篇文章将详细介绍如何在MyEclipse集成开发环境中配置SSH,并提供异常处理的策略。 首先,让我们了解SSH框架的核心组件: 1. **Struts2**:这是一个基于MVC(Model-View-Controller)设计模式的Web应用框架,负责...

    MyEclipse 搭建Struts2+Spring2+Hibernate3整合SSH2

    MyEclipse作为一款强大的Java集成开发环境,提供了便捷的SSH2整合支持。以下是详细的搭建步骤及知识点解析: 1. **创建Web Project** - 首先,你需要在MyEclipse中创建一个新的Web Project,这是一个基础的项目...

    myeclipse配置ssh.docx

    在配置过程中,可能会遇到一些问题,例如由于Xerces.jar冲突导致的错误。这时,我们可以直接删除项目中的旧版本Xerces.jar,通常不会影响项目的正常运行。同时,如果发现Spring和Hibernate中存在多个log4j.jar,建议...

    整合SSH(登录示例)

    从给定的文件信息来看,文章主要讲述了如何在MyEclipse 8.0环境中整合SSH框架,即Struts2.1、Spring3.0和Hibernate3.2,并提供了一个简单的登录示例。以下是对该过程的详细解析: ### 1. 创建Web Project 在...

    SSH2整合说明文档

    SSH2整合指的是将Struts2、Spring和Hibernate这三个开源框架集成在一起,以便构建高效、松耦合的企业级Java Web...不过,需要注意的是,整合过程中可能会遇到类加载冲突、配置错误等问题,需要细心调试和查阅相关文档。

    基于myeclipse 8.6M1 的 三大框架整合

    文章总结了整合SSH三大框架的关键步骤,以及在每个步骤中可能遇到的常见问题和解决办法。通过亲自实践搭建流程,可以加深对SSH整合项目的理解和掌握。 特别注意:由于提供的文件内容不完整且存在部分OCR识别错误,...

    MyEclipse-10.0下Struts2.1+Spring3.0+Hibernate3.3整合过程+源码

    在MyEclipse 10.0中整合SSH,首先需要分别导入这三个框架的库到项目的类路径中。然后,配置Struts2的配置文件`struts.xml`,定义Action和结果页面。接下来,配置Spring的`applicationContext.xml`,声明Bean并进行...

    ssh框架整合步骤讲解

    SSH框架整合是Java Web开发中常用的整合模式,它涉及到了Struts、Spring和Hibernate三个框架,这三者的整合可以为Java Web应用提供一种高效、方便的开发模式。接下来,我们将详细介绍SSH框架整合的步骤和相关知识点...

    最详细的ssh框架整合讲解.doc

    在本文中,我们将详细讲解如何基于Myeclipse 6.5进行SSH框架的整合。 首先,确保你拥有正确的运行环境。文中提到的环境包括JDK 6、Myeclipse 6.5、Tomcat 6.0.13和MySQL 5.1.53。这些软件的安装过程通常相对简单,...

Global site tag (gtag.js) - Google Analytics