This brief article shows how to make a Glassfish server available to Eclipse when you have installed Glassfish outside Eclipse in your computer. I assume that you installed it on folder C:\glassfish3122. If you need more information about how to install Glassfish you can see my previous article talking about it. Probably you will also need to have installed Oracle Glassfish Server Tools. Follow the previous link to read my article about how to install it.
So, you have installed Glassfish on your computer, but we need to make it available to use it inside the Eclipse workspace. To do that, open Eclipse and choose perspective Java EE. You will see a View called Servers.
Follow next steps:
- Go to Servers view, right-click with your mouse and select New → Server in your contextual menu.
- Choose Glassfish 126.96.36.199 inside the available servers list. If you don’t see version 188.8.131.52. follow the steps in my previous article talking about how to install Oracle Glassfish Server adapter. Or maybe there is a second reason to not to see it. I have verified that with the latest version of Eclipse it doesn’t appear version 184.108.40.206, but appears version 3.1. It will work also with version 3.1, as I show in the next example (it seems Oracle is preparing the release of Glassfish 4, as you see there).
- Specify where you have installed your Glassfish server. In this case is
- Specify the domain directory inside your Glassfish directory. In this case the domain created is called MyDomain, so the directory is
- Click Finish and you will have created your server in Eclipse. You can run it in normal or debug mode, using the buttons shown below.
In other tests I have done, sometimes I have found problems after installing the server because some kind of problem related to admin authentication. This is not the case of this example. But in case that you run into problems try to uncheck option “Use anonymous Connection for Admin Commands” that appears at configuration screen of the recently created server. You can acces this screen double-clicking the server created inside your Servers view.
So now you have installed your Glassfih Server and Eclipse knows where it is and where is the domain. Now you can use this server in your projects.