问题1:IDE报错could not initialize proxy - the owning Session was closed
处理:把User.hbm.xml配置文件中懒加载设置为false lazy="false"
问题2:java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
处理:该问题由于list数据溢出,只需核对list数组内容即可
问题3:javax.el.PropertyNotFoundException :
处理:实体类里的属性最好不要用一个小写字母开头,eg:pCount 可以写成proCount 否则用${}取该属性时会报’pCount’ property not found 的错误
问题4:若要让ajax每次重新请求(ajax缓存问题)
处理:在open方法后面加上:xmlHTTP.setRequestHeader("If-Modified-Since","0");
问题5:Jquery 缓存
处理:1、 get请求路径后加new Date().getTime()使每次请求不同
2、换不同的页面存储jquery需要调用的内容
问题6:οnclick=”checkUser(${user.name},<%=totalPrice %>)” js出错
处理: 应改为οnclick=”checkUser(‘${user.name}’,<%=totalPrice %>)”,即此处el表达式要加 引号
问题7:sessionFactory无法创建 spring配置文件无法加载,bean无法创建
处理:jar包有问题,tomcat有问题,jdk有问题,可以重新装一遍
问题8:由ajax转到action中做处理,则页面表单数据就取不到
处理:此时不能用actionform收集数据,只能用js收集页面数据
问题9:Jsp中图片不显示
处理:看下jsp用的是否是高级模板,如果是需要把
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>">
去掉
问题10:Too many connections
处理:Mysql中 My.ini 中max_connections的值改大一点
问题11:Sqlserver 远程访问出错
处理:看下本身的远程访问设置对不对,再看防火墙有没有关掉
问题12:将截断字符串或二进制数据。
处理:出错原因:当前字符集和数据库不匹配或者超过了数据库规定的长度
问题13:java.lang.OutOfMemoryError
处理:MyEclipse tomcat jdk arguments 加上 -Xms32m -Xmx800m
问题14:getOutputStream() has already been called for this response
处理:在JSP页面中的java代码中再加两行,这两行代码如下:
out.clear(); //清空缓存的内容。
out = pageContext.pushBody(); //参考API
问题15:private Set set=new HashSet();
处理:set只初始化一次,以后再进来该类时,set不初始化,原有的元素都还存在,可改为类内部声明set
问题16:IE8 js实现全选功能
处理:有多个复选框公用同一个名字时用document.getElementsByName(“cb”);而不能用document.all(“cb”);否则js将不起作用
1. java.lang.UnsupportedClassVersionError: Bad version number in .class file
check that if the installed jres and tomcat jdk are the same
2. try to put constant in front of equals like:”hello”.equals(this.getUsername().trim()),then the function equals will never throw exception “nullpointerexception”
3. web addresses
4. you should supply a jdbc driver
check the file hibernate.cfg.xml ,there may be something wrong with it
mysql:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/knowledgekingdom </property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">123456</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>
<mapping resource="com/kingdom/knowledgekingdom/bean/Users.hbm.xml"/>
</session-factory>
</hibernate-configuration>
5. hibernate one-to-many java.lang.IllegalArgumentException: argument type mismatch
check the entity if the “many” is stored in “Set” because it is “Set” in the hbm.xml file
just make they are the same type
6. can not export tables
the hbm file :check the data type
7. OpenSessionInViewFilter does’t work
Solution: configure it before strut2
8. Fckeditor you are not authorized error
Add fckeditor.properties
connector.userActionImpl=net.fckeditor.requestcycle.impl.EnabledUserAction
9. Fckeditor has conflicts with struts2
Modify struts2
In Web.xml
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
To:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
</filter-mapping>