在Jboss EAP 6/Wildfly中使用Hibernate 3和JSF 1.2

阅读更多

在EAP 6中使用JSF1.2

增加jboss-deployment-structure.xml文件,其内容如下:


   
                   
           
           
       

       
           
           
       

   

   
       
           
           
       

       
           
           
       

   

以上为EAP包中的配置,注意web sub deployment要再配置一遍。如为WAR仅需最外层就可以喽。

 

在EAP 6 中使用Hibernate 3

 

1. pom配置


    org.hibernate
    hibernate-core
    3.6.10.Final
   
       
            antlr
            antlr
       

       
            commons-collections
            commons-collections
       

       
            org.slf4j
            slf4j-api
       

       
            dom4j
            dom4j
       

       
            javax.transaction
            jta
       

   



    org.hibernate
    hibernate-entitymanager
    3.6.10.Final
   
       
            asm
            asm
       

       
            javassist
            javassist
       

       
            org.slf4j
            slf4j-api
       

       
            cglib
            cglib
       

   



    org.hibernate
    hibernate-validator
    3.1.0.GA
   
       
            org.slf4j
            slf4j-api
       

   



    org.hibernate
    hibernate-commons-annotations
    3.2.0.Final
   
       
            org.slf4j
            slf4j-api
       

   

2. jboss-deployment-structure.xml文件配置


   
                   
           
       

       
           
           
           
           
           
           
           
           
       

   

3. persistence.xml配置


   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
   version="2.0">
     
      java:jboss/datasources/defaultDS
     

        

        
        
        
     
  

 

EAP支持的JPA版本,请查看源码,位于模块org\jboss\as\jpa\jboss-as-jpa.jar的org.jboss.as.jpa.config.Configuration类中。

 

Wildfly

Wildfly默认不支持JSF1.2,如要使用需下载Wildfly源码编译安装。

1) cd /jsf/multi-jsf-installer
2) mvn -Djsf-version=1.2_15 -Pmojarra-1.2 clean assembly:single

3) The final artifact in the target directory will be called install-mojarra-1.2_15.zip.  Rename it to install-mojarra-1.2_15.cli.
4) Start WildFly
5) cd to /bin for the running server where you want to install the new JSF.
6) Start the Command Line Interface and invoke this command then restart WildFly.

    jboss-cli.bat --connect

    [standalone@localhost:9990 /]deploy /install-mojarra-1.2_15.cli

 

执行完以上命令后,JSF1.2安装在modules根目录下,slot为mojarra-1.2_15,需要手工修改和迁移一下(共三个模块:javax\faces\api,com\sun\jsf-impl,org\jboss\as\jsf-injection)

 

再修改一下配置:

                   
           
           

           
       
       
           
           

           
       

 

注意必须增加jsf-injection,否则启动后会报以下错误:

 java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Class javax.faces.FactoryFinder can not access a member of class org.jboss.as.jsf.injection.weld.WeldApplicationFactory with modifiers "private"

 

Jboss EAP 6 Migration Guide

How to Use Hibernate 3 in EAP 6
Steps to add any new JSF implementation or version to WildFly

你可能感兴趣的:(Jboss,EAP,6,Wildfly,JSF,1.2,Hiberante,3)