JavaWEB开发中的部分常见异常

[java]

1、nested exception is java.lang.OutOfMemoryError: Java heap space:list

[hibernate]

1、should be mapped with insert="false" update="false":存在重复映射的字段;

2、Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]:

配置文件与实体文件映射错误,多了字段或少了字段或少些了getter 方法;

3、org.hibernate.LazyInitializationException: could not initialize proxy - no Session:映射关系中加上 lazy="false";

4、org.hibernate.ObjectNotFoundException: No row with the given identifier exists:根据外键id查询不到映射表的相应数据;

5、Could not determine type for: String, for columns: [org.hibernate.mapping.Column(XXX)]:type指的是*.hbm.xml配置文件中的类型,string要小写;

6、nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists:映射表中数据的主键id不匹配;

7、org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of XXX:配置文件与实体类字段类型不一致;

8、org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1:级联新增,打印出来的sql语句显示主表为insert,从表为update  可以将配置文件中自增id设置 unsaved-value="0";

9、ConstraintViolationException: Could not execute JDBC batch update:两个表建立了外键约束,删除约束后操作成功;

10、 nested exception is org.springframework.beans.NotWritablePropertyException:

11、org.springframework.beans.factory.BeanCreationException:Spring中的“asm-2.2.3.jar”和Hibernate中的“asm.jar”包冲突。解决办法是移除Spring2.0 AOP Libraries中的“asm-2.2.3.jar”即可

12、org.springframework.beans.MethodInvocationException: 在classes目录有一个以前的类,但现在的类的路径已经发生了变化,发生变化的类全部封装在 jar 里面,但class loader 是优先装载 classes 目录下的类,所以存在装载时发生“NoClassDefFoundError”错误!只要把classes下的class文件删除即可。

13、com.sun.faces.mgbean.ManagedBeanCreationException:数据问题

14、a different object with the same identifier value was already associated with the session:getHibernateTemplate().merge(object);http://chenying.blog.51cto.com/614874/134702

15、MySQLSyntaxErrorException: SELECT command denied to user 'XXX'@'XXX.XXX.XXX.XXX' for table 'XXX':http://ganhaitian.blog.sohu.com/198205957.html

[spring]

1、org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [classes/config/spring/beans/DataSource.xml]:路径不对

2、spring未注入引起的NullPointException

ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");     //source目录(一般是在src目录下) 第一种获取配置文件的方式//ApplicationContext context = new FileSystemXmlApplicationContext("D:\\applicationContext.xml"); //绝对路径  第二种获取配置文件的方式

 IDao dao = (Dao)context.getBean("dao");  //获取bean
 //dao.add(obj);//正常调用方法

路径问题

3、 java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required:配置文件未配置sessionFactory

4、com.sun.faces.mgbean.ManagedBeanCreationException: 无法设置受管 bean buildingBean 的属性 buildingBo:实体类和配置文件映射错误

5、启动 org.springframework.beans.factory.BeanCreationException:asm.jar包冲突

6、

[MySql]

1、mysql 内存表 #1114: The table is full  

修改tmp_table_size(set tmp_table_size=314572800;);

修改max_heap_table_size(Set max_heap_table_size=314572800;);

查询命令: show variables like '%tmp_table_size%'; show variables like '%max_heap_table_size%';

2、Warning: World-writable config file '/etc/my.cnf' is ignored:http://blog.sina.com.cn/s/blog_71261a2d0100yjj1.html

3、mysql Starting MySQL..The server quit without updating PID file:http://www.phpufo.com/?p=560

4、Can't start server: Bind on TCP/IP port: Permission denied  Do you already have another mysqld server running on port: 3308http://blog.csdn.net/daodan988/article/details/8378893

5、mysqldump备份数据库时出现when using LOCK TABLEShttp://hi.baidu.com/ttianmy/item/236ec32161c8bc9ab6326377

[tomcat]

1、IOException while loading persisted sessions: java.io.EOFException:清理一下tomcat的work目录

[primefaces][jsf]

1、javax.faces.FacesException: Cannot find component "xxx" in view.:jsf调不到html页面中"xxx"这个id。

2、javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String:使用标签<p:pickList 时未定义 converter;

3、com.sun.faces.config.ConfigManager initialize  

  • 信息: Unsanitized stacktrace from failed start...

http://feuyeux.iteye.com/blog/751439

4、viewExpiredException 无法恢复视图http://wenku.baidu.com/view/cf325dd433d4b14e852468c5.html

[dwr]

1、session error :web.xml需要配置 http://nshg.iteye.com/blog/1513181

?

<init-param>  
    <param-name>crossDomainSessionSecurity</param-name>  
    <param-value> false </param-value>  
   </init-param>

  

code

faces-config.xml:

<converter>
        <converter-id>sceneConverter</converter-id>
        <converter-class>cn.ac.sim.ilec.utils.SceneConverter</converter-class>
</converter>

SceneConverter.java:


import javax.faces.component.UIComponent;import javax.faces.context.FacesContext;

import javax.faces.convert.Converter;import cn.ac.sim.ilec.model.Scene;

/** *@description Scene是一个实体类 */

publicclass SceneConverter  implements Converter {    

@Override    

public Object getAsObject(FacesContext context, UIComponent component, String value) {        

Scene scene =new Scene();        

scene.setId(Integer.parseInt(value));        

return scene;  

}    

@Override    

public String getAsString(FacesContext context, UIComponent component, Object value) {        

return String.valueOf(((Scene) value).getId());  

}

}


xhtml:

<p:pickList id="scenesPickList" value="#{ruleBean.scenes}" converter="sceneConverter" var="scene"                                    

itemLabel="#{scene.name}" itemValue="#{scene}" showSourceControls="true" showTargetControls="true"                                showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains" />

转载于:https://my.oschina.net/ministyle/blog/313958

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值