问题
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 the project properties window(s).
Any tips or links do useful documentation will be greatly appreciated.
Thank you!
回答1:
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">
来源:https://stackoverflow.com/questions/3439865/how-do-i-upgrade-an-existing-enterprise-project-from-java-ee5-to-java-ee-6-in-ne