Jeg har lige testet converter eksemplet fra SUN's tutorial, og det virkede først gang. Jeg fulgte faktisk bare tutorialen, men jeg kan da godt lige løbe det igennem:
Først hentede jeg kildekoden til eksemplerne:
http://java.sun.com/j2ee/tutorial/download.html(i zip format)
Derefter pakkede jeg zip filen ud, og lagde mappen
her: C:\j2eetutorial
Startede nu j2ee serveren og deploytool
Så lavede jeg en ny j2ee application i deploytool:
1. In deploytool, select FileNewApplication.
2. Click Browse.
3. In the file chooser, navigate to j2eetutorial/examples/src/ejb/converter.
4. In the File Name field, enter ConverterApp.ear.
5. Click New Application.
6. Click OK.
Så compilerede jeg koden:
Jeg åbnede et dos-vindue, og gik til c:\j2eetutorial\examples
Der skrev jeg: ant converter
Nu skal filerne pakkes rigtigt:
I deploytool vælger du File - new - Enterprise bean
1. EJB JAR dialog box
a. Select the Create New JAR File In Application button.
b. In the combo box, select ConverterApp.
c. In the JAR Display Name field, enter ConverterJAR.
d. Click Edit.
e. In the tree under Available Files, locate the j2eetutorial/examples/build/ejb/converter directory.
f. Select the following classes from the Available Files tree and click Add: Converter.class, ConverterBean.class, and ConverterHome.class.
g. Click OK.
h. Click Next.
2. General dialog box
a. Under Bean Type, select the Session radio button.
b. Select the Stateless radio button.
c. In the Enterprise Bean Class combo box, select ConverterBean.
d. In the Enterprise Bean Name field, enter ConverterEJB.
e. In the Remote Home Interface combo box, select ConverterHome.
f. In the Remote Interface combo box, select Converter.
g. Click Next.
3. Transaction Management dialog box
Because you may skip the remaining dialog boxes, click Finish.
Nu skal clienten pakkes:
Vælg File - new Application client
1. JAR File Contents dialog box
a. In the combo box, select ConverterApp.
b. Click Edit.
c. In the tree under Available Files, locate the j2eetutorial/examples/build/ejb/converter directory.
d. Select the ConverterClient.class file and click Add.
e. Click OK.
f. Click Next.
2.General dialog box
a. In the Main Class combo box, select ConverterClient.
b. Verify that the entry in the Display Name field is ConverterClient.
c. In the Callback Handler Class combo box, select container-managed authentication.
d. Click Next.
e. Click Finish.
Nu skal clienten's ref sættes op:
1. In the tree, select ConverterClient.
2. Select the EJB Refs tab.
3. Click Add.
4. In the Coded Name column, enter ejb/SimpleConverter.
5. In the Type column, select Session.
6. In the Interfaces column, select Remote.
7. In the Home Interface column, enter ConverterHome.
8. In the Local/Remote Interface column, enter Converter.
Nu skal vi lave en web client:
Vælg File -new Web component
1. WAR File dialog box
a. Select Create New WAR File In Application.
b. In the combo box, select ConverterApp.
c. In the WAR Display Name field, enter ConverterWAR.
d. Click Edit.
e. In the tree under Available Files, locate the j2eetutorial/examples/build/ejb/converter directory.
f. Select index.jsp and click Add.
g. Click OK.
h. Click Next.
2. Choose Component Type dialog box
a. Select the JSP radio button.
b. Click Next.
3. Component General Properties dialog box
a. In the JSP Filename combo box, select index.jsp.
b. Click Finish.
Nu skal vi sætte web clientens ref op:
1. In the tree, select ConverterWAR.
2. Select the EJB Refs tab.
3. Click Add.
4. In the Coded Name column, enter ejb/TheConverter.
5. In the Type column, select Session.
6. In the Interfaces column, select Remote.
7. In the Home Interface column, enter ConverterHome.
8. In the Local/Remote Interface column, enter Converter.
Nu skal vi have sat JNDI names op:
1. Marker ConverterAPP i deploytool
2. Select the JNDI Names tab.
3. I det øverste vindue er det et ledig felt, der skriver du: MyConverter
4. I det nederste vindue er der 2 ledige felter, der skriver du også MyConverter (i begge felter)
Nu er det tid til at deploy:
Vælg Tools -deploy
Husk at sætte kryds ved "Return Client Jar. "
Tryk "next"
Ved WAR Context Root, skriver du "converter"
Tryk Finish
Nu skulle applicationen gerne deploy uden fejl....
Nu åbner du en browser og skriver:
http://localhost:8000/converter/index.jspOg det virker!