w0051977 w0051977 - 4 months ago 37
Java Question

Glassfish not running web application independently of Netbeans

Please see the steps I have followed below:

1) Start the Glassfish server in Netbeans:

enter image description here

2) Run the Netbeans project, which successfully browses to: http://localhost:8080/CRUDWebAppSQL/StudentServlet I am able to use the application.
3) Close Netbeans, which stops Glassfish (in preparation for the next step)

Then I try this:

1) Run the following DOS commands:

cd C:\Program Files\glassfish-4.0\bin
sadmin start-domain domain1

2) Message received saying server has started. Browse to: http://localhost:4848/ and login. Make sure that CRUDWebAppSQL is listed as an app.
3) Browse to: http://localhost:8080/CRUDWebAppSQL/StudentServlet which display a Glassfish 404 error

Why does step three produce a Glassfish 404 error? Does it have something to do with this: Where does glassfish save your class/project after deployment on Windows?


NetBeans is using a different mechanism to deploy your application to support hot deployment in comparison to a manual deployment.

To run the application without NetBeans first build the web application with e.g. with Maven mvn clean install to get the *.war file.

Start the Glassfish application server and either deploy the war file through the web interface or with command line asadmin deploy war-name

By the way I would suggest to update NetBeans to the current 8.2 release and have a look at Payara, which is a patched drop-in replacement for Glassfish: http://www.payara.fish/downloads