To deploy RESTful web applications on the Tomcat 6.0 web server with NetBeans IDE , you need to perform the following setup procedures:
| Procedure | Version of NetBeans IDE |
|---|---|
| One-time-only setup of Tomcat 6.0 to support the IDE | All versions. Not all steps necessary with NetBeans 6.5 and higher. |
| Additional setup of each individual project | Only versions before 6.5 |
| Modify applicationContext.xml | Only for NetBeans IDE 6.5 Beta, and only if you want to create RESTful web services with the Spring framework |
toplink-essentials.jar (for NB version < 6.5)
toplink-essentials-agent.jar (for NB version < 6.5)
derbynet.jar (all versions NB)
derbyclient.jar (all versions NB)
See http://wiki.netbeans.org/wiki/view/FaqEndorsedDirTomcat for more details on version 5.
In versions of the IDE prior to 6.5, for every Web Application project you create that deploys RESTful services to Tomcat 6.0, you must perform the following additional configuration:
Although you added Toplink files to Tomcat, you still need to add the TopLink Essentials library to your project in order to avoid class casting exceptions. You must add this library above the REST libraries.
Expand your project's Configuration Files node and you will see the persistence.xml file. Edit persistence.xml based on the following example:
<persistence-unit name="WebApplication8PU" transaction-type="RESOURCE_LOCAL">
<provider>oracle.toplink.essentials.PersistenceProvider</provider>
<!-- <non-jta-data-source>jdbc/sample</non-jta-data-source> -->
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="toplink.jdbc.user" value="app"/>
<property name="toplink.jdbc.password" value="app"/>
<property name="toplink.jdbc.url" value="jdbc:derby://localhost:1527/sample"/>
<property name="toplink.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
</properties>
</persistence-unit>
</bean>
<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
}}}
Note that the user also needs to replace YourPUName with the PU name from the original bean definition for entityManagerFactory.