To prepare your application for deployment, you have to:
· Build the WAR
· Create an Enterprise Application Project
· Create a DataSource Alias
· Assemble the EAR file
I...
1. In the J2EE Development perspective, extend the GettingStartedOpenSQLWeb node and open web.xml.
2. Go to the Mapping tab, select Servlet Mappings and choose Add.
3. Add the ProcessInput servlet and enter ProcessInput in the URLPattern field.
4. You must also add a resource reference for the DataSource that your application uses. To do this, go to the Resource tab, select Resource entries and choose Add. Modify the entry as follows:
Resource Reference Parameters
Parameter Name |
Value |
Resource Reference Name |
TMP_PERSISTENCE_EXAMPLE |
Resource Type |
javax.sql.DataSource |
Resource Authentication |
Container |
Resource Sharing Scope (checked) |
Shareable |
For more information about DataSource resource references, see Getting a Connection to the Database.
5. Save and close the XML file.
6. From the context menu of the project choose Build WEB Archive.
...
1. Choose File → New → Project. Select J2EE in the left-hand pane and Enterprise Application Project in the right-hand pane. Choose Next.
2. Enter a name for the project – for example, GettingStartedOpenSQLEar. Choose Next.
3. In the Referenced Projects field choose GettingStartedOpenSQLWeb. Choose Finish.
4. Extend the GettingStartedOpenSQLEar node and open application.xml.
5. On the General tab, enter GettingStartedOpenSQL as a display name. On the Modules tab enter gettingstarted-sql as a context root.
6. Save and close the XML file.
...
1. Select the GettingStartedOpenSQLEar project and open its context menu. Choose New → META-INF/data-source-aliases.xml.
2. Enter TMP_PERSISTENCE_EXAMPLE as the name of the DataSource alias.
For more information about DataSource aliases, see Managing Aliases.
3. Choose Finish.
Open the context menu of the GettingStartedOpenSQLEar project and choose Build Application Archive. The system informs you if the process has finished successfully.
Now you can deploy and run the application.