唯美古典
Java入门,Struts,Hibernate,Spring,Groovy,Grails
posts - 7,comments - 10,trackbacks - 0


1org.springframework.beans.NotWritablePropertyException(很畸形的bug

出现异常的原因是在application-xxx.xmlproperty name的错误。
  <property name="...."name的名字是与beanset方法相关的,而且要注意大小写。一般第二个字母不能大写
  比如

public class PostManageImpl extends BaseManage implements PostManage {
private PostDAO dao = null;
public void setPostDAO(PostDAO postDAO){
this.dao = postDAO;
}
}


  那么xml的定义应该是:

bean id="postManage" parent="txProxyTemplate"
property name="target"
 <bean class="com.yz.spring.service.implement.PostManageImpl"
  <property name="postDAO"><ref bean="postDAO"/></property
  <property name="dao"><ref bean="postDAO"/></property
 </bean
/property
/bean

2Struts中的DispatchAction中提交jsp中请求事件不能跳转到指定页面

原因是在DispatchAction中存在execute方法,Action会优先执行此方法而不会按照url传过来的method方法执行,所以千万注意此处

3Field 'id' doesn't have a default value

原因是数据库中id属性值没有让它“自动增长”

4could not initialize proxy - no Session

Hibernate3 错误: could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
原因:
hibernate3 many-to-one
的默认选项是 lazy = "proxy"
解决方法:
<many-to-one> & <one-to-many>
中设置 lazy="false"

5、在使用Jbpm工作流引擎的时候,Hibernate配置文件一定要加上属性

<property name="hibernate.hbm2ddl.auto">update</property>

Hbm2dll.auto是数据库表和类自动连接更新

6jbpmSpring整合报错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jbpmConfiguration' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: a beanFactoryReference already exists for key jbpmConfiguration

解决方法:去掉struts-config.xml文件中的org.springframework.web.struts.ContextLoaderPlugIn,也就是与Spring整合的插件



唯美古典的工作室
posted on 2009-12-01 20:11 唯美古典 阅读(2092) 评论(2)  编辑  收藏 所属分类: SSH整合

FeedBack:
# re: SSH整合常出现问题
2009-12-03 15:19 | 张晓枫
整合出现最BT的异常就是Jar包冲突   回复  更多评论
  
# re: SSH整合常出现问题
2009-12-03 15:29 | 唯美古典
@张晓枫
对,尤其是Spring和Hibernate的asm.2.3的jar包冲突  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: