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


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

          出現(xiàn)異常的原因是在application-xxx.xmlproperty name的錯(cuò)誤。
            <property name="...."name的名字是與beanset方法相關(guān)的,而且要注意大小寫。一般第二個(gè)字母不能大寫
            比如

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


            那么xml的定義應(yīng)該是:

          bean id="postManage" parent="txProxyTemplate"
          property name="target"
           <bean class="com.yz.spring.service.implement.PostManageImpl"
            <property name="postDAO"><ref bean="postDAO"/></property對(duì)
            <property name="dao"><ref bean="postDAO"/></property錯(cuò)
           </bean
          /property
          /bean

          2Struts中的DispatchAction中提交jsp中請(qǐng)求事件不能跳轉(zhuǎn)到指定頁(yè)面

          原因是在DispatchAction中存在execute方法,Action會(huì)優(yōu)先執(zhí)行此方法而不會(huì)按照url傳過(guò)來(lái)的method方法執(zhí)行,所以千萬(wàn)注意此處

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

          原因是數(shù)據(jù)庫(kù)中id屬性值沒(méi)有讓它“自動(dòng)增長(zhǎng)”

          4could not initialize proxy - no Session

          Hibernate3 錯(cuò)誤: 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
          的默認(rèn)選項(xiàng)是 lazy = "proxy"
          解決方法:
          <many-to-one> & <one-to-many>
          中設(shè)置 lazy="false"

          5、在使用Jbpm工作流引擎的時(shí)候,Hibernate配置文件一定要加上屬性

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

          Hbm2dll.auto是數(shù)據(jù)庫(kù)表和類自動(dòng)連接更新

          6jbpmSpring整合報(bào)錯(cuò):

          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 唯美古典 閱讀(2113) 評(píng)論(2)  編輯  收藏 所屬分類: SSH整合

          FeedBack:
          # re: SSH整合常出現(xiàn)問(wèn)題
          2009-12-03 15:19 | 張曉楓
          整合出現(xiàn)最BT的異常就是Jar包沖突   回復(fù)  更多評(píng)論
            
          # re: SSH整合常出現(xiàn)問(wèn)題
          2009-12-03 15:29 | 唯美古典
          @張曉楓
          對(duì),尤其是Spring和Hibernate的asm.2.3的jar包沖突  回復(fù)  更多評(píng)論
            

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 通城县| 宜君县| 莫力| 西昌市| 萝北县| 彭泽县| 平南县| 安宁市| 威远县| 商水县| 宣恩县| 泽州县| 苗栗市| 高安市| 灌南县| 赤城县| 威宁| 炉霍县| 商洛市| 松潘县| 张家港市| 兴仁县| 论坛| 惠安县| 荣昌县| 榆中县| 出国| 镇赉县| 漳平市| 华安县| 梁山县| 灵宝市| 惠水县| 柞水县| 江孜县| 绵阳市| 漳浦县| 迭部县| 申扎县| 新宁县| 塔河县|