1. 程式人生 > >從Jboss EAP 6.4遷移到EAP 7.1

從Jboss EAP 6.4遷移到EAP 7.1

Jboss EAP 6 Jboss EAP 7 Migration EJB ActiveMQ

POM
  • JavaEE升級
    
    <!-- javaee -->
    <dependency>
    <groupId>org.jboss.bom</groupId>
    <artifactId>jboss-eap-javaee7</artifactId>
    <version>7.1.1.GA</version>
    <type>pom</type>
    <scope>import</scope>
    </dependency>
org.jboss.eap wildfly-ejb-client-bom 7.1.1.GA-redhat-2
pom import
org.jboss.eap wildfly-jms-client-bom 7.1.1.GA-redhat-2 pom import ``` * 升級dependency ``` org.jboss.spec.javax.servlet jboss-servlet-api_3.1_spec provided org.jboss.remoting jboss-remoting provided org.jboss.spec.javax.ejb jboss-ejb-api_3.2_spec provided
org.jboss.spec.javax.jms jboss-jms-api_2.0_spec provided ... ``` # JSF 1.2 EAP 7不支持JSF 1.2,可從EAP 6將JSF 1.2 Module(包含javax.faces.api,com.sun.jsf-impl,org.jboss.as.jsf-injection)遷移過來,module.xml內容無需更改,建議修改一下module版本urn:jboss:module:1.5 如部署使用的ear包,在jboss-deployment-structure.xml中增加如下配置: ```
``` # Hibernate 3.5 * 強烈建議升級到Hibernate 5,如確實不能升級,需創建一個3.5 module,放入依賴包,module配置如下: ``` ``` * jboss-deployment-structure.xml中排除org.hibernate,引入3.5 ``` ``` * 修改persistence.xml ``` org.hibernate.ejb.HibernatePersistence java:jboss/datasources/scheduleDatasource ... ... ``` # HornetQ EAP 7 使用了ActiveMQ Artemis取代了HornetQ,原Message-Driven Bean不需更改,需更改配置和客戶端調用代碼。 * jms-destinations EAP 6中jms-destinations配置如下: ``` ... ... ``` 要更改為: ``` ... ... ``` * security 如不啟用security,增加如下配置: ``` ... ``` * Dependency ``` org.apache.activemq artemis-jms-client provided org.jboss.spec.javax.jms jboss-jms-api_2.0_spec provided org.jboss.spec.javax.json jboss-json-api_1.0_spec provided ``` * org.apache.activemq.artemis module取代org.hornetq * 更改PROVIDER_URL EAP 7,默認connector從remote改為http-remoting,默認remote connection port從4447改為8080,PROVIDER_URL要從remote://localhost:4447修改為http-remoting://localhost:8080。 * 更改INITIAL_CONTEXT_FACTORY 從org.jboss.naming.remote.client.InitialContextFactory修改為org.wildfly.naming.client.WildFlyInitialContextFactory。 # EJB * POM dependency ``` org.jboss jboss-ejb-client provided org.jboss.remoting jboss-remoting provided org.wildfly wildfly-naming-client provided org.jboss.spec.javax.ejb jboss-ejb-api_3.2_spec provided org.jboss.spec.javax.transaction jboss-transaction-api_1.2_spec provided org.jboss.marshalling jboss-marshalling-river provided org.jboss.xnio xnio-api provided org.jboss.xnio xnio-nio provided ``` * jboss-ejb-client.properties EAP 6: ``` remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false remote.connections=default remote.connection.default.protocol=remote remote.connection.default.host=localhost remote.connection.default.port=4447 remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false ``` EAP 7: ``` remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false remote.connections=default remote.connection.default.protocol=http-remoting remote.connection.default.host=localhost remote.connection.default.port=8080 remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false ``` * 修改客戶端代碼 EAP 6: ``` java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory java.naming.provider.url=remote://localhost:4447 ``` EAP 7: ``` java.naming.factory.initial=org.wildfly.naming.client.WildFlyInitialContextFactory java.naming.provider.url=http-remoting://localhost:8080 ``` # 參考文檔 [Jboss EAP 7.1 Migration Guide](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/migration_guide/) [Using the JBoss Server Migration Tool](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/using_the_jboss_server_migration_tool/) [Developing EJB Applications](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html-single/developing_ejb_applications/#project_dependencies_for_remote_ejb_clients) [Configuring Messaging](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/configuring_messaging/)

從Jboss EAP 6.4遷移到EAP 7.1