问题
I am working on a Mac.
I am running Linux Ubuntu server in a VirtualBox. GlassFish 4 and MySql are already running there. The Linux IP is 10.0.1.12.
On the guest system (Mac) I am running Eclipse Luna. I installed the GlassFish Tools for Eclipse Luna and restarted Eclipse.
Then I wanted to add server for GlassFish4. But Eclipse is asking me for "Server root" and I have no clue what it means! I entered "10.0.1.12:4848/" just as I can access GlassFish from the host system (Mac OS) by a browser. But it just doesn't accept that URL. It seems to expect a local directory path. Here is the dialog box:

Thanks in advance for any hints!!
回答1:
You need to install a Glassfish4 Server to your local machine (the one Eclipse is running on) despite the fact that you want to connect to and manage a remote Glassfish server; Eclipse will use some of the files in that local installation to manage the remote Glassfish server. Assuming you already have Glassfish4 installed on a remote machine:
[For example purposes]
- Let's assume the remote Glassfish server is at 192.168.2.7 on default port 4848 for administration and you've set a password for 'admin' user as 'gfish'.
Let's also assume that your local desktop (development machine running Eclipse Luna) is at 192.168.2.3
Download Glassfish4 Open Source edition zip
- Unzip the contents to a directory on your local machine: let's say inside of path
/glassfish_server/
you will now have:/glassfish_server/glassfish4/glassfish/
structure
Back in Eclipse:
- Create a New Server -> Select 'Glassfish4' option
- Server's Hostname =[remote ip address] // E.G. 192.168.2.7
Server Name: GlassFish 4 at 192.168.2.7 // get's auto-filled - [Next] This is the page you were specifically having issue with:
Set the Root Path to your Local Glassfish Server install directory
so in this example:/glassfish_server/glassfish4/glassfish/
should be accepted - [Next] Now use the credentials and configuration for your remote glassfish server. Run a Ping-Test to test connection.
回答2:
The server root means the directory where GlassFish is located. This might be, for example, /opt/glassfish4/glassfish
. Eclipse needs this so that it can look for the bin/
directory and be able to start/stop the server using the scripts in there.
来源:https://stackoverflow.com/questions/28723917/access-remote-glassfish4-server-from-eclipse-luna