Glassfish 3.1 CREDENTIAL_ERROR in Eclipse

2019-01-18 13:21发布

问题:

I can't start Glassfish 3.1 on Eclipse Indigo with "Oracle Glassfish Server Tools" plugin on Windows 7. After installing the plugin, I've chosen "New" -> "Server" in the server view and clicked on GlassFish 3.1 and downloaded the installation through Eclipse.

Every time I try to start it, I've the following message:

The Eclipse plugin cannot communicate with the GlassFish server, 
status is :CREDENTIAL_ERROR

I've found out that the initial password is 'changeit' and I've changed it to my own, on the command line:

bin/asadmin change-master-password  domain1
Enter the current master password>
Enter the new master password>
Enter the new master password again>
Command change-master-password executed successfully.

I've changed it accordingly in GlasshFish 3.1 configuration screen within Eclipse in the section Application Server (Admin Password).

The ports listed (8080, 4848) seems compatible with domain.xml configuration:

<network-listeners>
    <network-listener port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
    <network-listener port="8181" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
    <network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener>
</network-listeners>

However, in my .log I find the following:

!ENTRY oracle.eclipse.tools.glassfish 4 1 2011-08-04 11:38:43.925
!MESSAGE GlassFish: error 
!STACK 0
java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:525)
    at java.net.Socket.connect(Socket.java:475)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
    at sun.net.www.http.HttpClient.New(HttpClient.java:306)
    at sun.net.www.http.HttpClient.New(HttpClient.java:323)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
    at com.sun.enterprise.jst.server.sunappsrv.commands.CommandRunner.call(CommandRunner.java:607)
    at com.sun.enterprise.jst.server.sunappsrv.commands.CommandRunner.call(CommandRunner.java:1)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)

!ENTRY oracle.eclipse.tools.glassfish 4 150 2011-08-04 11:38:43.928
!MESSAGE The Eclipse plugin cannot communicate with the GlassFish server, status is :CREDENTIAL_ERROR
!STACK 0
java.lang.RuntimeException: The Eclipse plugin cannot communicate with the GlassFish server.Status is :CREDENTIAL_ERROR
    at com.sun.enterprise.jst.server.sunappsrv.SunAppServerLaunch.launch(SunAppServerLaunch.java:163)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:696)
    at org.eclipse.wst.server.core.internal.Server.startImpl2(Server.java:3404)
    at org.eclipse.wst.server.core.internal.Server.startImpl(Server.java:3342)
    at org.eclipse.wst.server.core.internal.Server$StartJob.run(Server.java:363)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

So it seems that the error message shown in the interface is misleading, it should be a connection problem, not password problem, as far as I understand. Anyone knows how to solve this problem?

回答1:

I got the "The Eclipse plugin cannot communicate with the GlassFish server, status is :CREDENTIAL_ERROR" error too.

I found a solution to my problem by ensuring that no other process was listening at port 8080.
To find processes that listens to port 8080, bring up a command prompt and type in the following:

netstat -a -n -o | find "8080"
  1. In the far right column, you'll see a process identifier.
  2. Bring up the windows task manager (hit ctrl+alt+delete and select "Start Task Manager") and go to the processes tab.
  3. Look for the column named "PID" (if it is not present already go to view -> select columns... -> check PID) and find the process with the PID you found using netstat.
    -> kill the process -> try again.

It worked for me.



回答2:

On Mac OS 10.6 I had many of the same problems described above:

  1. First I had the CREDENTIAL_ERROR.

  2. I tried creating a new server, as suggested in answer 2. However, I accidentally added the wrong password (it should be left blank), and started getting "wrong user name or password" messages. I was not able to change the password.

  3. I then started getting the CREDENTIAL_ERROR again.

  4. The solution was suggested by answer 3, that there is another process running. I decided to try completely deleting all of the servers on my Eclipse setup, and then adding a new server, as described in answer 2.

That worked beautifully, and I was immediately up and running (remembering to leave the password blank this time through)



回答3:

The reason your port swapping probably worked, is because when 8080 was the http listener it was likely that your anti-virus was scanning the port for http traffic, which causes the Credential Error. I removed the 8080 entry from my AV settings under web scanning and the server started up fine. Only took my a week and a half and a PC Rebuild before I found that one!!!!!

Regards Chris

Update: It turns out that I had to disable the HTTP Scanner entirely to stop this issue. As soon as it was re-enabled the CREDENTIAL_ERROR returned. I've tried adding all sorts of exceptions to the AV settings, but none worked.



回答4:

The issue with another process occupying the port 80, check for other webservers or app servers running on that port, stop them and re-try



回答5:

After disabling ZoneAlarm firewall I could successfully start GlassFish on Windows. However, I then started to have many kind of unrelated and annoying problems and as Mico suggested, I switched back using Linux, which is my usual development platform, and everything went fine.

To document the process:

  1. with Eclipse Indigo, GlassFish connector is not present by default. In WTP's server tab, right click and choose New -> Server and click on the link "Download additional server adapters", choose GlassFish and press Next, accept the license and Finish.

  2. This time I downloaded GlassFish myself from http://glassfish.java.net/ and choose the open source edition full platform for Unix in the flavour of .sh file.

  3. On the command line I moved the archive in the parent folder where I wanted it installed and called "sh glassfish-3.1.1-unix.sh", which brings up a graphical configuration. I choose Typical configuration.

  4. If you choose the auto upgrade option, be prepared to wait several minutes. It's a known bug since 3.0.1, that seems they preferred to document, rather than fix it. It's not necessary to follow the advice to cancel the install, just grab a coffee or read some news, it will get through.

  5. Once GlassFish is installed, in Eclipse server tab, choose New -> Server and choose "GlassFish" -> "GlassFish Server Open Source Edition 4 (Java EE 6)", browse domain1 directory of Glassfish, leave admin password blank.

At this point it's possible to deploy projects on Glassfish, just like I used to do in Tomcat. In my first day experience, hot redeployment sort of work, but not always, quite often a server stop + start has been necessary.



回答6:

I got the "The Eclipse plugin cannot communicate with the GlassFish server, status is :CREDENTIAL_ERROR" error too.

For me it was a Firewall problem. -- For some reason the Firewall (configured by the IT) blocks eclipse to communicate with Glassfish on port 4848, by default used as "Admin Server Port".

But port 8080 is not blocked.

My workaround was to switch the ports in the domain.xml

<network-listeners>
  <network-listener port="4848" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
  <network-listener port="8181" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
  <network-listener port="8080" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener>
</network-listeners>

Now I can start the server from eclipse. And access the normal pages in the browser (because 4848 is not blocked for the browser).



回答7:

I want to improve the answer from Andreas.

Yes, This is important to check your port:

netstat -a -n -o | find "8080"

If you are using Windows 7 make sure your proxy host is not active. Please check your host list file and open using notepad then restart your PC after comment all unnecessary host. Here is the tutorial.

\%systemroot%\system32\drivers\etc\host

In my case jmx failed to start because current host is using activate.adobe.com not your computer-name nor localhost.

service:jmx:rmi://activate.adobe.com:8686/jndi/rmi://activate.adobe.com:8686/jmxrmi

The host should be "localhost" or "127.0.0.1" or your computer-name

service:jmx:rmi://My-PC-Name:8686/jndi/rmi://My-PC-Name:8686/jmxrmi

Last thing is to check your processes list from Task Manager, end the anti virus proxy service process, like mine is using Trend Micro Internet Security then end process tmproxy.exe *32.

Go back to your eclipse double click your GlassFish server in server list tab, please uncheck "Use Anonymous Connection for Admin Console" then make sure to fill "Admin Name" and "Admin Password" for example user admin and password adminadmin as GlassFish default admin login. Now you can run the GlassFish server from your eclipse. It's worked.



回答8:

Try this : kill java process from task manager if it not show java process then restart your pc >> it work for me



回答9:

Ensure that you have JDK set as JRE in your eclipse.

On Windows set it to

window>preferences>java>installed jres

On Mac set it to

eclipse>preferences>java>installed jres

These should point to the JDK location.