国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

J2EE程序從JBoss4.0.0及3.2.x升級到4.0.1+的問題解決辦法

2019-11-18 16:11:35
字體:
來源:轉載
供稿:網友
    在JBoss的文檔中,宣稱JBoss4.0版本是業界第一個支持J2EE1.4規范的應用服務器。以前公司的很多程序都是在JBoss3.2.x的版本上開發的,所以就想把他們移植到JBoss4.0.2中。于是,我就把預案原來程序原封不動的copy到JBoss4.0.2的default/deploy目錄中,但是運行時卻怎么也出不來結果。最后通過一步步跟蹤,發現程序在獲得EJB的home接口時發生了異常,異常類型為ClassCastException——類型轉換錯誤。
    在JBoss的服務器類型中一般會包含三種配置:default、minimal和all,這種配置方式在3.2和4.0.1+中都是一致,但是有一個版本例外,那就是4.0.0。在4.0.0中包含了4種服務器配置:default、minimal、all和standard。在4.0.0中standard配置就相當于3.2和4.0.1+中的default配置,而4.0.0中的defaut配置和standard配置是一樣的,除了default完全兼容于J2EE1.4規范。在3.2和4.0.1+的default配置中以及4.0.0的standard配置中,JBoss在它的統一標準的類裝載器里啟動所有的J2EE服務。這樣,當所有組件都發布在同一個JVM中時,它就會獲得最優化的性能。但是,在JBoss的這種配置中,被發布的應用程序并沒有被嚴格劃分。于是就導致這種配置并不能完全適應J2EE1.4的規范。因此當我們把程序直接copy過來時才會發生異常。為了使這種配置完全適應J2EE規范,我們必須按照以下的步驟修改配置文件的設置,使范圍類裝載行為和通過值調用的JNDI查找行為起作用。
    第一步,編輯conf/jboss-services.xml文件,將NamingService的CallByValue屬性的值設置為true。
    <mbean code="org.jboss.naming.NamingService"
           name="jboss:service=Naming">
          <!-- The call by value mode. true if all lookups are unmarshalled using
               the caller's TCL, false if in VM lookups return the value by reference.
          -->
          <attribute name="CallByValue">true</attribute>
          ...
    </mbean>
    第二步,編輯deploy/ear-deployer.xml文件,設置Isolated和CallByValue屬性的值為true。
    <server>
      <!-- EAR deployer, remove if you are not using ear deployments -->
      <mbean code="org.jboss.deployment.EARDeployer"
             name="jboss.j2ee:service=EARDeployer">
        <!-- A flag indicating if ear deployments should have their own scoped
             class loader to isolate their classes from other deployments.
          -->
        <attribute name="Isolated">true</attribute>
        <!-- A flag indicating if the ear components should have in VM call
             optimization disabled.
          -->
        <attribute name="CallByValue">true</attribute>
      </mbean>
    </server>
    最后,編輯deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml文件,設置java2ClassLoadingCompliance和UseJBossWebLoader屬性的值為true。
    <server>
      <mbean code="org.jboss.web.tomcat.tc5.Tomcat5"
             name="jboss.web:service=WebServer">
        <!-- Get the flag indicating if the normal Java2 parent first class
             loading model should be used over the servlet 2.3 web container first
             model.
          -->
        <attribute name="Java2ClassLoadingCompliance">true</attribute>
        <attribute name="LenientEjbLink">true</attribute>
        <!-- A flag indicating if the JBoss Loader should be used. This loader
             uses a unified class loader as the class loader rather than the tomcat
             specific class loader.
          -->
        <attribute name="UseJBossWebLoader">true</attribute>
    經過以上步驟地修改以后,這個配置就完全適應J2EE規范了,升級時出現的問題也就順利解決了。

(出處:http://m.survivalescaperooms.com)



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 玉环县| 乐至县| 左权县| 邳州市| 积石山| 庆云县| 威信县| 天全县| 岑巩县| 井冈山市| 江华| 逊克县| 浮梁县| 封丘县| 红原县| 沈阳市| 依兰县| 时尚| 苍溪县| 新郑市| 花莲县| 襄樊市| 海伦市| 乐陵市| 高唐县| 舟山市| 如东县| 文登市| 上林县| 西宁市| 定结县| 红原县| 泊头市| 乐亭县| 扎鲁特旗| 松潘县| 比如县| 定州市| 公主岭市| 莲花县| 黄山市|