I'm trying to do this tutorial https://netbeans.org/kb/docs/web/jsf20-intro.html#template, but have problems with step 8 - debugging. I can deploy the application without any errors.
While deployment, I only encounter some warnings:
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
but the application gets deployed and runs fine.
However, I've got problems when it comes to debugging. I right-click my project -> Debug, and get the following error:
org.netbeans.api.debugger.jpda.DebuggerStartException: connect: Address is invalid on local machine, or port is not valid on remote machine
at org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.waitRunning(JPDADebuggerImpl.java:404)
at org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.waitRunning(JPDADebuggerImpl.java:386)
at org.netbeans.api.debugger.jpda.JPDADebugger.attach(JPDADebugger.java:324)
at org.netbeans.modules.debugger.jpda.ant.JPDAConnect$1.run(JPDAConnect.java:235)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Caused by: java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:222)
at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
at com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:90)
at org.netbeans.api.debugger.jpda.AttachingDICookie.getVirtualMachine(AttachingDICookie.java:231)
at org.netbeans.modules.debugger.jpda.actions.StartActionProvider.doStartDebugger(StartActionProvider.java:188)
at org.netbeans.modules.debugger.jpda.actions.StartActionProvider.access$200(StartActionProvider.java:80)
at org.netbeans.modules.debugger.jpda.actions.StartActionProvider$1.run(StartActionProvider.java:165)
... 4 more
BUILD FAILED (total time: 1 second)
And the Debugger Console says:
Attaching to localhost:0
Connection refused.
I tried enabling debugging in GlassFish server.
How can I fix it and make the debugger work?
...it didn't work because the server wasn't started in debug mode. I selected debug mode, restarted Glassfish and it works fine.
Address is invalid on local machine, or port is not valid on remote machine it's mean that your server is not working
Starts "System Symbol" as Administrator
(Windows+R -> CMD (Run as Administrator))
Using DOS commands locates the folder where the GlassFish server is installed and accesses its Bin folder.
C:\Program Files\glassfish-4.1\bin>
Then run the following command:
asadmin start-domain --debug
Then... in NetBeans IDE opens the "Debug" menu and enters the "Attach Debugger" option, a window will be displayed where you will be asked for the server port and timeout, by default the GlassFish port is 4848 and a sufficient timeout is 1000 [ms] , click "OK"
And now you can debug your project, just press "Ctrl+F5" or the menu option "Debug Project"
I hope you will use this solution, I was able to solve the same problem using the steps I detailed.
Related
(Adding this here as I did not find an answer anywhere)
I configured Jenkins to automatically install JDK from the "Global Tools Configuration" > "JDK Installation" menu. The option works across all 14 nodes (various Windows and Linux) but one.
A server Windows Server 2012 R2 (amd64) with 20 executors, which has been running without issue for just under 3 years.
The log file references in the build's console (i.e. ...tools\hudson.model.JDK\install1873722508778839961log) is empty.
The build's console shows the following:
[EnvInject] - Loading node environment variables. Installing
E:\Jenkins_APA_8080\tools\hudson.model.JDK\Oracle_Java_8.0_191\jdk.exe
[Oracle_Java_8.0_191] $
E:\Jenkins_APA_8080\tools\hudson.model.JDK\Oracle_Java_8.0_191\jdk.exe
/s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress
INSTALLDIR=E:\Jenkins_APA_8080\tools\hudson.model.JDK\Oracle_Java_8.0_191
/L
E:\Jenkins_APA_8080\tools\hudson.model.JDK\install1873722508778839961log
Failed to install JDK. Exit code=-1 ERROR: SEVERE ERROR occurs
org.jenkinsci.lib.envinject.EnvInjectException: hudson.AbortException
at
org.jenkinsci.plugins.envinject.util.RunHelper.getBuildVariables(RunHelper.java:137)
at
org.jenkinsci.plugins.envinject.EnvInjectListener.setUpEnvironmentWithoutJobPropertyObject(EnvInjectListener.java:235)
at
org.jenkinsci.plugins.envinject.EnvInjectListener.setUpEnvironment(EnvInjectListener.java:51)
at
hudson.model.AbstractBuild$AbstractBuildExecution.createLauncher(AbstractBuild.java:542)
at
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:462)
at hudson.model.Run.execute(Run.java:1810) at
hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at
hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429) Caused by:
hudson.AbortException at
hudson.tools.JDKInstaller.install(JDKInstaller.java:292) at
hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:157)
at
hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:72)
at
hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
at
hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
at hudson.model.JDK.forNode(JDK.java:148) at
org.jenkinsci.plugins.envinject.util.RunHelper.getJDKVariables(RunHelper.java:111)
at
org.jenkinsci.plugins.envinject.util.RunHelper.getBuildVariables(RunHelper.java:135)
... 8 more
I logged onto the server as a local admin and attempted to run the JDK installation line shown in the build console:
E:\Jenkins_APA_8080\tools\hudson.model.JDK\Oracle_Java_8.0_191\jdk.exe
/s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress
INSTALLDIR=E:\Jenkins_APA_8080\tools\hudson.model.JDK\Oracle_Java_8.0_191
/L E:\Jenkins_APA_8080\tools\hudson.model.JDK
The installation seemed to run and this time the log file contained text. I double checked the owner and permissions on the Jenkins folders and they were owned by a local admin and not a domain admin (this is normal for our Jenkins installation).
However, the login credentials of the Jenkins service on this machine were set to a domain admin (not local admin).
Changing the Jenkins Services Log On credentials resolved the issue. Even though this node has been running for over a couple years without issue, its credentials were not correct.
I am using IntelliJ 2017.3 with Payara 4.1.2.172. I used to just start the server from the command line had a Remote Debug running on port 9009, and everything used to work fine.
Then I set up an plugged in server with attached modules in IntelliJ, to enable HotSwap. I run this server in debug mode, and it works fine.
Now, if I don't use the plugged in server, but want to start the server as previous, when I run the debug remote, I get the following:
Error
Error running 'Debug Glassfish OSM': Unable to open debugger port
(localhost:9009): java.net.ConnectException "Connection refused:
connect"
I have run a netstat and there's nothing running on port 9009.
Question
How do I get the remote debug working on the server?
More info
The domail.xml has:
<system-property name="JAVA_DEBUGGER_PORT" value="9009"></system-property>
And in the server-config JVM Settings:
More info
I set the above 'Enable' checkbox to on, but now I get the following error when I try start the server, i.e. the server won't start now. (netstat shows noting running on port 9009)
ERROR: transport error 202: connect failed: Connection refused ERROR:
JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports
initialized [debugInit.c:750]
If I set it to off in the damain.cml, I still get the error and am unable to start the server.
<java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" debug-enabled="true" system-classpath="">
In glassfish\domains\domain1\config\domain.xml :
<java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n" java-home="C:\Program Files\Java\jdk1.8.0_162" debug-enabled="true" system-classpath="">
or in http://localhost:4848/common/index.jsf
2. In current Idea - Server Run Configuration - Debug - Port - address
I had the same problem and this solution also did the trick for me: Provide the IP 127.0.0.1 in the Intellij Debug configuration instead of the host name "localhost", in case you're using this hostname.
I have simple solution on that but its not permanent fix on this issue. You can invalidate and restart your IntelliJ Idea and try again to debug your codebase.
I have a Java functional TestNG test which is hitting a REST API endpoint.
Same test worked on Windows PC with IntelliJ and JBoss with no special settings.
I can hit this endpoint in Postman, so I know it's up/alive.
We made a simple Node Express server / Java ping program that listens on various ports (e.g. in the 6xxxx range) and replies if the ping was successful. This works.
But in IntelliJ and JBoss Dev Studio IDEs AND on mvn test commandline on Mac, it fails immediately, doesn't even touch any of my test code, and I get:
Connected to the target VM, address: '127.0.0.1:60329', transport: 'socket'
[TestNG] Running:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
...
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:74)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:124)
I've tried a few things with no luck:
Allow IntelliJ in firewall, and even turn off Mac firewall completely
java.net.preferIPv4Stack in VM options and in Info.plist for IntelliJ in case it was an IPv6 thing
Auto-detect proxy settings in IntelliJ settings (never had to do this on Windows IntelliJ, but just to make sure)
Debugger > Transport > Shared memory (actually it won't let me select this at the moment, but one web page suggested this as a fix)
Versions:
IntelliJ 2016.2
Java 1.7.0_79
Mac 10.11.5
​Well, I ended up deleting my entire set of Git repos and starting over from scratch. My TestNG tests are now running. Why that worked? I have no idea. Just glad to get back to work.
I am trying to debug a simple Java application on my machine using Eclipse as an IDE. When I try to debug the application by entering the Debug Perspective, I set a breakpoint and start debug. Within a few seconds, the following pop-up window:
Launching unicodeRead has encountered a problem. Cannot connect to VM.
The message dumped on the console is as follows:
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:708]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
How do I correct this? Why does this happen?
I just had the same problem.
Yesterday everything worked fine, now nothing - same error as you gave. I found out that network admins made some changes in the meantime. Some firewall stuff. Problem is that Eclipse tries to establish connection to JVM at "localhost" (and some random port). When I tried pinging localhost (or 127.0.0.1) I got following:
C:\Windows\system32>ping 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
PING: transmit failed. General failure.
PING: transmit failed. General failure.
PING: transmit failed. General failure.
PING: transmit failed. General failure.
and
C:\Windows\system32>ping localhost
Ping request could not find host localhost. Please check the name and try again.
It seams that in some cases DNS is expected to resolve this, and if firewall prevents localhost requests to DNS - stuff breaks. I had to alter hosts file and remove comments in following lines, so I would not rely on DNS for this anymore:
# 127.0.0.1 localhost
# ::1 localhost
Although it is written that hosts file changes take effect immediately, I think that some processes locked this and restart was necessary in my case. After that, everything worked again.
Had same problem, but the solution was to run the application with -server=y option and not with -server=n.
Before:
java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:5005
After:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:5005
Looks like the same problem as here. A reboot of the pc fixed the problem there. I haven't found any other solutions.
I was seeing an error while using the -X format:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n myapp
The error went away when I switched to the newer format:
java -agentlib:jdwp=transport=dt_socket,server=y,address=4000,suspend=n myapp
Its Very Simple,Just do the Following Changes in eclipse.ini file.
-vm
binary\com.sun.java.jdk.win32.x86_1.6.0.u43\jre\bin\javaw.exe
I changed
-agentlib:jdwp=transport=dt_socket,address=9009,server=n,suspend=y
to
-agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n
and that did the trick!
My case is I have a bunch of domains refer to 127.0.0.1 in hosts file, like this:
127.0.0.1 localhost domian1.local domain2.local domain3.local
one day I added another new domain to refer to 127.0.0.1. By mistake, I put the domain in front of "localhost", like this:
127.0.0.1 domain4.local localhost domian1.local domain2.local domainx.local
After this, I always got an alert window in eclipse while debugging:
Cannot connect to VM
com.sun.jdi.connect.TransportTimeoutException
In console:
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP: Failed to initialize transport via localhost:50470, trying localhost via 127.0.0.1:50470
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
The solution is keep "localhost" at the first position all the time.
127.0.0.1 localhost domian1.local domain2.local domainx.local domain4.local
What solved for me was deleting the entire domain1 folder inside the domains folder on glassfish main folder.
Eclipse will ask you to recreate a domain and then everything works again.
In eclipse select Run tab -> Debug configuration -> Junit -> select your test name ->
Environment tab -> add variable server=y .
I was getting the same error on my ubuntu machine because of a mishap with the /etc/hosts file. I had commented out the mapping of localhost to 127.0.0.1, and to complicate matters further there was a swap file hanging around.
This was the first line of my /etc/hosts:
127.0.0.1 #localhost
Deleting the # fixed the problem, whereas rebooting understandably had not.
My cause & solution were completely different.
I think in my case it was due to the installation of JProfiler. I fixed it by uninstalling JProfiler and launching eclipse with the -clean option. I suspect that JProfiler was inserting itself in the debugger. The -clean option forces Eclipse to re-assess its plugins, so that alone might have been sufficient.
Continuing #gonadarian's answer, it seems Eclipse uses port 127.0.0.1 for debug purposes. This port is also called localhost. The way this error can be removed is by ensuring that there are no processes or services running on the above ports. The way to do this, on Linux is:
As root, enter the command:
netstat -tulpn | grep 127.0.0.1
If there are processes running on the above port, it will show up in the format:
process_id/process name.
Kill the above processes like so: kill -KILL process_id
Restart the computer for these changes to take effect. The error should no longer occur.
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?
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"
In the far right column, you'll see a process identifier.
Bring up the windows task manager (hit ctrl+alt+delete and select
"Start Task Manager") and go to the processes tab.
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.
On Mac OS 10.6 I had many of the same problems described above:
First I had the CREDENTIAL_ERROR.
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.
I then started getting the CREDENTIAL_ERROR again.
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)
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.
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
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:
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.
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.
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.
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.
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.
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).
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.
Try this : kill java process from task manager if it not show java process then restart your pc >> it work for me
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.