1

我有一个曾经在 Tomcat Server Application 7.0 中运行的项目。现在我必须将它迁移到 Jboss 5.1。

我必须在项目中更改哪些配置?

这是我的 pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.labcon</groupId>
<artifactId>Catalogo2</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Catalogo2</name>

<properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

  <repositories>


  <repository>
        <url>http://download.java.net/maven/2/</url>
        <id>jsf20</id>
        <layout>default</layout>
        <name>Repository for library Library[jsf20]</name>
    </repository>
    <repository>
        <url>http://repo1.maven.org/maven2/</url>
        <id>jstl11</id>
        <layout>default</layout>
        <name>Repository for library Library[jstl11]</name>
    </repository>
    <repository>  
        <id>prime-repo</id>  
        <name>PrimeFaces Maven Repository</name>  
        <url>http://repository.primefaces.org</url>  
        <layout>default</layout>  
    </repository> 


        <repository>
            <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <id>apache.snapshots</id>
        <name>Apache Snapshot Repository</name>
        <url>https://repository.apache.org/content/repositories/snapshots</url>
    </repository>
</repositories>

<dependencies>

 <dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>jstl</artifactId>
   <version>1.2</version>
 </dependency>

 <dependency>
  <groupId>javax.persistence</groupId>
  <artifactId>persistence-api</artifactId>
  <version>1.0</version>
 </dependency>

 <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-core</artifactId>
   <version>3.1.2.RELEASE</version>
 </dependency>

  <dependency>
   <groupId>org.springframework</groupId>
    <artifactId>spring-expression</artifactId>
    <version>3.1.2.RELEASE</version>
  </dependency>

  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>3.1.2.RELEASE</version>
  </dependency>

  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-aop</artifactId>
   <version>3.1.2.RELEASE</version>
  </dependency>

  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>3.1.2.RELEASE</version>
  </dependency>

  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-context-support</artifactId>
   <version>3.1.2.RELEASE</version>
  </dependency>

  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>3.1.2.RELEASE</version>
  </dependency>

  <dependency>
    <groupId>org.springframework</groupId>
     <artifactId>spring-jdbc</artifactId>
     <version>3.1.2.RELEASE</version>
  </dependency>

  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-orm</artifactId>
   <version>3.1.2.RELEASE</version>
  </dependency>

  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.1.2.RELEASE</version>
  </dependency>

  <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.3.2.GA</version>
  </dependency>

  <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-validator</artifactId>
   <version>4.0.2.GA</version>
  </dependency>

  <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.15</version>
  </dependency>

  <dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib-nodep</artifactId>
    <version>2.2.2</version>
  </dependency>

  <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.6.1</version>
  </dependency>

  <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.6.1</version>
  </dependency>

  <dependency>
    <groupId>asm</groupId>
    <artifactId>asm-commons</artifactId>
    <version>3.1</version>
  </dependency>

  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.10</version>
  <scope>test</scope>
  </dependency>

  <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate</artifactId>
   <version>3.2.5.ga</version>
  </dependency>

  <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>ejb3-persistence</artifactId>
   <version>1.0.1.GA</version>
  </dependency>

  <dependency>
    <groupId>javax.sql</groupId>
    <artifactId>jdbc-stdext</artifactId>
    <version>2.0</version>
  </dependency>

  <dependency>
    <groupId>javax.transaction</groupId>
    <artifactId>jta</artifactId>
    <version>1.0.1B</version>
  </dependency>

 <dependency>
  <groupId>org.primefaces</groupId>  
  <artifactId>primefaces</artifactId>
  <version>3.4.1</version>
 </dependency>

  <dependency>
    <groupId>org.primefaces.themes</groupId>
    <artifactId>all-themes</artifactId>
    <version>1.0.9</version>
  </dependency>

  <dependency>
     <groupId>commons-fileupload</groupId>
 <artifactId>commons-fileupload</artifactId>
 <version>1.2.3-SNAPSHOT</version>
  </dependency>

 <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5-SNAPSHOT</version>
 </dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>   
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.0.7</version>
</dependency>
    <dependency>
        <groupId>javax</groupId>
         <artifactId>javaee-api</artifactId>
        <version>6.0</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>6.0</version>
        <type>jar</type>
    </dependency>

</dependencies>

    <build>
       <plugins>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-compiler-plugin</artifactId>
               <version>2.3.2</version>
               <configuration>
                  <source>1.6</source>
                <target>1.6</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${endorsed.dir}</outputDirectory>
                        <silent>true</silent>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax</groupId>
                                <artifactId>javaee-endorsed-api</artifactId>
                                <version>6.0</version>
                                <type>jar</type>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
   </build>

这是我的 web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">


<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>

<servlet>  
    <servlet-name>
        Resource Servlet
    </servlet-name>  
    <servlet-class>
        org.primefaces.resource.ResourceServlet
    </servlet-class>  
</servlet> 

<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>

<welcome-file-list>
    <welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>

<context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>bootstrap</param-value>
</context-param>

<filter>    
   <filter-name>PrimeFaces FileUpload Filter</filter-name>      
   <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class> 
</filter>   

<filter-mapping>    
   <filter-name>PrimeFaces FileUpload Filter</filter-name>  
   <servlet-name>Faces Servlet</servlet-name> 
</filter-mapping>

另一个问题是我安装了 JBoss 5.1 并设法在 netbeans 中单独运行它,但是当我选择运行项目时,选项:JBoss 对我来说没有出现。

4

1 回答 1

1

所以这是你的“快速”答案;-)

我们比我们大 2 岁,JBoss AS 5 被 JBoss AS 7 和 WildFly 8 淘汰了。所以我认为今天的读者想要迁移到那个。

有两个工具可以帮助迁移到 JBoss AS 7 / WildFly 8 / EAP 6:

1) JBoss SwanLoom - 针对服务器配置迁移的自动化迁移工具。

2) JBoss WindUp - 一个针对应用程序迁移的报告工具 - 部署描述符等。

最后,有一个专门用于 JBoss 迁移的新站点:http ://www.jboss.org/migration/ ,您可以在其中找到所有迁移指南来手动进行迁移。

关于pom.xml,您必须踢出 JBoss AS 中已包含的所有部门。API 可能会保留,但仅作为编译时依赖项(不应以 .war 结尾)。

根据您要迁移的程度,您可能还希望完全删除 Spring 并用 JBoss AS 提供的服务替换它,并使用 CDI 注释连接应用程序的各个部分。

关于 NetBeans 中的 JBoss AS,对 AS 5 的内置支持已经很久了,至少从 6.x 开始,从 7.3.1 开始,它也应该支持 AS 7。

于 2013-07-03T16:01:57.403 回答