The reason for the invalid Glassfish server. You may not be able to install the correct Server installation folder (Glassfish / Tomcat). Adding a server to the project is as follows
Go to the Services tab, select Servers, then right-click on it. Select "Add Server." Select your server (Glassfish) and name it, then click Next.
In the "Server" field, specify the correct installation location (on my computer, c:\Program Files\glassfish-3.1 ), click the "Next" button. Give the domain name as you like. Do not use the default port. Leave the goal name, username, password, and click Finish. It will show successful domain creation.
For reference: Create a Glassfish server
source share