NetBeans can use multiple deployment servers. When your web application uses the Entity Framework and you select the Glassfish server as the deployment server, you can get the error message when you try to run your application in the IDEÉ
Severe: Exception while preparing the app : The persistence-context-ref-name […] in module […] resolves to a persistence unit called […] which is of type RESOURCE_LOCAL. Only persistence units with transaction type JTA can be used as a container managed entity manager. Please verify your application.
When you first run the application NetBeans asks you to select the deployment server you want to use.
If only the Glassfish server is available, and Tomcat is installed on your workstation, add Tomcat to the available deployment servers.
Install Tomcat
For the Tomcat installation see Tomcat web server installation
Add Tomcat to the NetBeans server list
- In the Tools menu select Servers
- Click the Add Server button
- In the list select the Apache Tomcat or TomEEE server
- Click the Browse… button
- Select the Tomcat directory on your workstation
- Enter a Tomcat username and password for NetBeans, and click the Finish button.
- The user will be created in the tomcat-users.xml file in the Tomcat conf directory
- Click the Close button.
Select the Deployment Server
- Right-click the NetBeans project and select Run
- In the Select deployment server window select Apache Tomcat or TomEE
If the Select deployment server window does not pop up
- Right-click the NetBeans project and select Set Configuration -> Customize…
- On the Run tab select the Apache server.
Starting of Tomcat failed, the server port 8080 is already in use
- If the Glassfish server already started, Tomcat cannot use the same ports and an error message will appear in the NetBeans Run, Output tab
- To stop the Glassfish server, restart your workstation.