如何在Netbeans中将现有企业项目从Java EE5升级到Java EE 6(6.9)

时间:2010-08-09 12:14:02

标签: java netbeans java-ee java-ee-6 java-ee-5

该项目有一个EJB模块&一个网络模块。更改服务器很简单,但我也想切换到EJB 3.1,但我相信我需要更改所有类型的配置文件,因为我无法从项目属性窗口中执行此操作。

任何提示或链接都会提供有用的文档,我们将不胜感激。

谢谢!

1 个答案:

答案 0 :(得分:6)

显然它并不复杂。它通过修改以下文件为我工作:

<强> <project-folder> / nbproject文件/ project.properties 改变以下几行:

j2ee.platform=1.5
javac.source=1.5
javac.target=1.5

j2ee.platform=1.6
javac.source=1.6
javac.target=1.6

重复相同的内容:

<强> <project-name> / <project-name> - EJB / nbproject文件/ project.properties

<强> <project-name> / <project-name> - 战/ nbproject文件/ project.properties

在ejb-jar.xml中更改行:

   <ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee" 
         version = "3.0"
         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/ejb-jar_3_0.xsd">

<ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee" 
         version = "3.1"
         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/ejb-jar_3_1.xsd">

接下来,找到persistence.xml并更改此行:

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" 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_1_0.xsd">

<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" 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">