开发者

How do I upgrade an existing enterprise project from Java EE5 to Java EE 6 in Netbeans (6.9)

开发者 https://www.devze.com 2023-01-11 05:49 出处:网络
The project has an EJB module & a web module. Changing the server is easy, but I\'d like to switch to EJB 3.1 also but I believe I need to change all kind of configuration files since I can\'t do

The project has an EJB module & a web module. Changing the server is easy, but I'd like to switch to EJB 3.1 also but I believe I need to change all kind of configuration files since I can't do it from th开发者_开发问答e project properties window(s).

Any tips or links do useful documentation will be greatly appreciated.

Thank you!


Apparently it's not that complicated. It worked for me by modifying the following files:

<project-folder>/nbproject/project.properties change the following lines:

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

to

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

Repeat the same for:

<project-name>/<project-name>-ejb/nbproject/project.properties

<project-name>/<project-name>-war/nbproject/project.properties

In ejb-jar.xml change the line:

   <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">

to

<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">

Next, find persistence.xml and change this line:

<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">

to

<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">
0

精彩评论

暂无评论...
验证码 换一张
取 消