Student类的完整路径”>
13.严重: 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 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException:
Association references unmapped class: Score
Caused by: org.hibernate.MappingException: Association references unmapped class: Score 原因:除了修改13问题位置的类路径外,many-to-one这样地方路径也需要改变。14.Exception starting filter Struts2Filter
Action class [queryScoreAciton] not found - action -
file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/s2s h/WEB-INF/classes/struts.xml:11:60
原因:queryScoreAciton应该写成queryScoreAction;或者struts2倒错jar包了,要用spring+struts包。
15.严重: Servlet.service() for servlet default threw exception
https://www.wendangku.net/doc/079331666.html,ng.ClassCastException: com.s2sh.domain.Student
at org.hibernate.type.StringType.toString(StringType.java:44)
原因:不是配置文件错了,而是编写的代码有错误。
public List findStudentBySnumber(Student student){
return studentDAO.findBySnumber(student.getSnumber());
}
public List findBySnumber(Object snumber) { //snumber希望得到的是学号字符串,而真正传给它的是student对象。
return findByProperty(SNUMBER, snumber);
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Student instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Student as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
16.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 'studentService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is https://www.wendangku.net/doc/079331666.html,ng.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
Caused by: https://www.wendangku.net/doc/079331666.html,ng.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
原因:public class StudentServiceImpl extends HibernateDaoSupport implements StudentService
StudentServiceImpl不能继承HibernateDaoSupport,应该改为public class
StudentServiceImpl implements StudentService
17.严重: 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 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw
exception; nested exception is https://www.wendangku.net/doc/079331666.html,ng.NoClassDefFoundError:
org.hibernate.cfg.Configuration
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is https://www.wendangku.net/doc/079331666.html,ng.NoClassDefFoundError:
org.hibernate.cfg.Configuration
Caused by: https://www.wendangku.net/doc/079331666.html,ng.NoClassDefFoundError: org.hibernate.cfg.Configuration
方法1:web服务器重启
18.Illegal modifier for parameter url; only final is permitted
原因:在方法中使用了修饰符public、protected、private
19.Cannot make a static reference to the non-static field url
原因:静态方法只能调用静态成员
20.Syntax error, insert "Finally" to complete TryStatement
https://www.wendangku.net/doc/079331666.html,ng.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
原因:缺少SQLSERVER2000的三个驱动包,把包加入工程后还需要deploy一下。21.java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid parameter
binding(s).
原因:PreparedStatement ps=conn.prepareStatement(sql);
ps.setString(0,username);
sql语句中第一个问号用1表示而不是0
22.严重: Servlet.service() for servlet LoginServlet threw exception
https://www.wendangku.net/doc/079331666.html,ng.IndexOutOfBoundsException: Index: 0, Size: 0
将if(list!=null){
queryUser=(User)list.get(0);
改为:
if(list!=null&&list.size()>0){
queryUser=(User)list.get(0);
list没数据时,用list.get(0)取数就会出现上述错误。
23.java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]在关键字
'user' 附近有语法错误。
原因:表名user可能和数据库关键字冲突,将表名user换成users。
24.java.sql.SQLException: No suitable driver
原因:数据库连接出问题了。
String url="jdbc:mircrosoft:sqlserver://localhost;databaseName=login";
连接字符串中mircrosoft多了个r。
25.<%@ taglib prefix="s" uri="/struts-tags" %>的问题Cannot find the tag library descriptor for
"/struts-tags"
原因:是在/struts-tags的/后面加个空格再删除空格后没有问题的,可能是输入法的问题。
26.严重: Exception starting filter Struts2Filter
https://www.wendangku.net/doc/079331666.html,ng.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.struts2.dispatcher.FilterDispatcher.(FilterDispatcher.java:149)
原因:类包加载错了,我加载的是和Spring结合的struts类包,应该换成单独运行框架的类包。
在Action中必须定义相应的属性来接受form传来的数据,如果不定义的话,action出来不了,另外在跳转其他页面的时候数据也会丢失。
27.警告: No configuration found for the specified action: 'testInterceptor.action' in namespace:
'/struts2'. Form action defaulting to 'action' attribute's literal value.
原因:经过测试发现,是没有正确使用tag的原因,这种情况下,正确的写法应该是, 。
注意, 不能写成 这样仍然有对应的警告信息,并且提交后出现无法访问的结果。因为没有
ShowMessage.action这样一个action,这个.action不能由我们手工添加,Struts2会自动为你完成这个工作,并且手工添加是不行的,就不必多此一举了。但是在其他的场合,比如使用超级链结,则可以加上这个.action。结合Spring时要加.action,单独不
用加。
28.result defined for action com.struts2.action.TestValidate and result input - action -
file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/stru ts2/WEB-INF/classes/struts.xml:18:71
原因:加一个***.jsp
https://www.wendangku.net/doc/079331666.html,.hibernate.hql.ast.QuerySyntaxException: homeNews is not mapped. [from homeNews as
h]
原因:homeNews应该为对象名,而不是数据库表名
https://www.wendangku.net/doc/079331666.html,.hibernate.PropertyNotFoundException: Could not find a getter for Tpassport in class
https://www.wendangku.net/doc/079331666.html,er
原因:配置文件中:
outer-join="true"/>
实体类中:private Passport TPassport;
大小写不统一。
31.Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext
configured!
原因:将Session session=sessionFactory.getCurrentSession()该为Session
session=sessionFactory.openSession()
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC][SQLServer]DELETE 语句与COLUMN REFERENCE 约束'FK_T_Passport_T_User' 冲突。该冲突发生于数据库'onetoone',表'T_Passport', column 'id'。
原因:主表删除记录后,该记录的主键从表的外键,所有从表外键的值在主表找不到了。
https://www.wendangku.net/doc/079331666.html,.hibernate.HibernateException: identifier of an instance of https://www.wendangku.net/doc/079331666.html,er
was altered from 2 to 1
原因:ID值是不能修改的
https://www.wendangku.net/doc/079331666.html,.hibernate.TransientObjectException: com.relation1n.domain.UniCustomer
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)原因:主表没有从表依赖的主键记录。
34.log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
原因:没有将log4j.properties放入到src目录下。
35.Unhandled exception type IllegalAccessException
原因:将Class.forName(dbDriver).newInstance();改为Class.forName(dbDriver);
https://www.wendangku.net/doc/079331666.html,ng.NoClassDefFoundError: org/apache/commons/logging/LogFactory
原因:缺少commons-logging.jar包
37.严重: Error configuring application listener of class
org.springframework.web.context.ContextLoaderListener
https://www.wendangku.net/doc/079331666.html,ng.ClassNotFoundException:
org.springframework.web.context.ContextLoaderListener
解决方法:重启myeclipse。
38.DWRMethods未定义。
原因:将
改为
。
39.来自网页的消息:error
原因:数据库服务器没启动。DWR无法获得数据
40.cannot set property 'disabled' of null。
原因:浏览器问题,换成IE浏览器
41.表单中的数据提交给action发现action接收到的值都为null。
原因:检查表单控件的名称和action中属性成员的名称是否一致,如果一致还出现null很可能tomcat服务器宕机了,重新启动tomcat服务器。
42.test class not found in selected project
原因:JUNIT4要求测试方法的返回值要求是void,且方法不能带有任何参数。
43.java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名'xxx'
无效
原因:解决方法:sql写的不对,应该写:select * from databasename.dbo.tablename 即可。或改为:“use mydb select * from t_user”。
44.MyEclipse中JSP文件无法保存中文的问题的解决
在MyEclipse操作界面中:
window-->preferences-->general-->content types
在右边的窗口中打开列表,选中"JSP",在下面的"default encoding"右边的输入框中输入"GBK"或"GB2312"或"UTF-8"都行,再点"update"按钮,就可以。
这里同样可以设置HTML等的默认编码,省得每次建个页面都要去改编码,
45.Allocate exception for servlet Struts2Filter
https://www.wendangku.net/doc/079331666.html,ng.ClassCastException: org.apache.struts2.dispatcher.FilterDispatcher
原因:org.apache.struts2.dispatcher.FilterDispatcher这是个Filter,你是不是在web.xml 中配置成了servlet?
46.报错:No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the
classpath:.....
原因:报这个错是因为在/sandh/web-inf/classes下面没有ehcache.xml这个文件!这个文件是hibernate缓存配置文件。
解决方法:从ehcache-1.1.jar 中把文件ehcache-failsafe.xml 解压出来改名
ehcache.xml 复制到src下面就行了!
47.Exception in thread "main" org.hibernate.MappingException: Association references
unmapped class: BookNumber
原因:在Book.hbm.xml中改为class="com.www2.domain.BookNumber"/>
48.Exception in thread "main" org.hibernate.MappingException: An association from the table
reader_bookNumber refers to an unmapped class: com.www2.domain.Reader
原因:在hibernate.cfg.xml中没有做配置。
49.many-to-one有时候不发出transient错误,有时候又发?
原因:到commit时外键还为空,这时发出transient错误;如果到commit时group对象已经save了,session就能够获取外键的值了,故不再发了。
发出的情况 Group g=new Group();g.setName("尚学堂");User u1=new User();u1.setName("zhangsan");u1.setGroup(g);session.save(u1);https://www.wendangku.net/doc/079331666.html,mit();不发的情况:Group g=new Group();g.setName("尚学堂");User u1=new User();u1.setName("zhangsan");u1.setGroup(g);session.save(u1);
session.save(g);https://www.wendangku.net/doc/079331666.html,mit();50.JS Alert: Max depth exceeded when dereferencing 原因:类型不对。将operator.isRegist(document.getElementById("name"),callBackCheckName);改为operator.isRegist(document.getElementById("name").value,callBackCh eckName);因为document.getElementById("name")返回值为OBJECT 类型,而isRegist 方法要求该参数为string 类型,document.getElementById("name").
value 就为string 类型。51.查看发布的dwr,就显示classes known to dwr 为什么看不到我的方法?...原因:将
改为:
52.通过卷相互作用与相互关系,根据力保护装置调试技术,电力保护