jconsole cannot connect to local processes on my new Mac Air - jconsole

I'm stumped. On my old Mac, Jconsole couldn't connect to local JVMs. I thought I had done something to mess up system configuration. Then I got a new Mac. The first thing I did was download a jdk, install it and check to see if jconsole could connect. It could.
Then I pulled over users and applications from my old mac using my Time Machine backup drive except my system files. Still worked.
But I found that odd things were happening with my development environment. In eclipse, I could start my Jboss server, but eclipse never recognised that the Jboss server had started. So, I could never add or delete war files to it through eclipse.
Also, the jboss instance could not connect to my localhost PostGres database even though the ds file clearly gave localhost as the host to connect to.
I fixed these problems by giving my new Mac the hostname the old Mac had had.
But now I am back to not being able to connect to my local JVMs through jconsole.
This affects not just jconsole, but jprof as well so I'd like to get it fixed.
jconsole can see the JVM processes. It just times out when I try to connect.
I also tried connecting to localhost: by writing a java class that slept for five minutes and running it with the following command line:
java -Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false
but I cannot connect to localhost:9010 or :9010 either.
My guess would be this is some network configuration problem, but any help would be really really appreciated.
Thanks,
George

I had similar issues with timeouts. Looking at the packets being sent, it seems that jconsole was trying to connect via an external interface and being blocked by the firewall.
I added
JAVA_TOOL_OPTIONS=-Djava.rmi.server.hostname=localhost
to my environment to ensure all java processes used localhost instead of an external interface for RMI (which is what jconsole is using for connections)

Related

Confused about "Remote Debugging" Wildfly 20 from Eclipse 2020-06

I need to be able to "remotely debug" a Java/Jakarta EE servlet running under Wildfly 20 under Ubuntu 20 from Eclipse 2020-06 running on Windows 10 at a different IP.
My research has discovered what appears to be two different approaches: one is what I want and the other is a simpler "subset".
*** First the "simple" approach. This approach is supposed to let me debug from Eclipse an app that is already deployed and running on Wildfly. To do this I uncomment this line in standalone.conf:
JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"
Then I start Wildfly and ensure the app also starts.
In Eclipse I create in Debug Configuration a new Remote Java Application and ensure I use the same port 8787 as above. Then I just push "Debug".
I get this error:
Failed to connect to remote VM. Connection refused. Connection refused: connect
If I return to the Wildfly system and run the following I see that port 8787 is not being monitored so that sure looks like a problem:
ss -tp | grep 8787
(nothing is found)
*** The other approach appears to be what I want to do which is to have Eclipse deploy changed files to Wildfly and also allow me to debug remotely. That is how I worked with Eclipse Oxygen and Wildfly 10 when both were installed on the same Windows machine.
In this case I set up a new Remote Connection in Eclipse and then a new Server (and attach my Project to the Server) using that Connection. I then start the Server in Debug mode. In the Progress View I can see files being copied to a Path on the Wildfly server so that seems like progress but after 20 seconds I see the same error I got in the "simple" approach above.
Failed to connect to remote VM. Connection refused.
What's interesting is that if, in the Remote Systems View I open the Remote Connection I created, I am able to use the sftp item to see files on the remote Wildfly system. So it seems that I am able to connect to Wildfly.
I need help fixing both of these problems but especially the last one since I need to have Eclipse deploy changes to Wildfly as it did when Wildfly was local.
Thank you in advance.

Tomcat webapp failing to run on someone else's computer

I have an apache-tomcat (8.5.35) that runs a web app. It runs on different computers (Windows 10, Mac OS X) without a problem but won't work on a specific computer (also Windows 10). I am not really sure why and have spent hours trying to find out why it won't work. The log files display
org.apache.catalina.loader.WebappClassLoaderBase.clearReferenceJdbc The web application [web-app] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it whenthe web application was stopped. To prevent a memory leak, the JDBC has been forcibly unregistered.
Any idea why it won't work with this specific computer? I have postgresql 10 (x86) installed in this computer. I thought Kaspersky would have been an issue so I disabled it and uninstalled both the Small Office Security and Secure Connection but the problem seems to be linked into Windows or something.
I also tried different versions of tomcat, postgresql, and jdbc drivers (postgresql jar files).

Intellij IDEA: Run Scala REPL Console on a remote machine.

I am wondering if it is possible to run Intellij's scala console process on a remote machine.
The Problem
I am developing a scala application on my local machine, but it needs to run on a remote machine.
What I am hoping for, is to launch the console process (that executes code) remotely and connect the console view/editor in IntelliJ to it - naturally with access to the local classes I am developing. I.e., this is a setup that is a little similar to launch an process remotely and then connecting the debugger.
A little background
The application (which builds on Spark) needs to talk a lot with servers that are on the same network as the remote machine. Running the console process on the remote machine will help a lot with port/hostname/proxy configurations. It will also improve performance, but that is secondary in this problem.
I have ssh access to the remote machine, so it is easy to setup proxies/ssh-tunnels.
Hope you can help :)
Why not just use the Terminal tab in IntelliJ, SSH to the machine, and use SBT from there? I do this all the time.

How do I access an Eclipse Tomcat server externally?

I am trying to access an Apache Tomcat v6.0 server running inside Eclipse (OsX) on port 8090 on a machine that is on a different network. I have tried http://my_public_ip:8090/ and it is not working and googling hasn't turned up anything that worked.
Any ideas?
Is it a Windows machine? If so, is Windows Firewall turned on? If so, have you added an exception for port 8090 and/or java.exe (maybe javaw.exe)?
In what way is it not working?

Tomcat port in use in NetBeans

I tried searching for this problem here and in other forums but could not resolve this issue.
I have downloaded NetBeansBeans 7.0 Java EE pack which also installs Tomcat 7 which it did.
I created sample web application and when trying to deploy I get an error:
Starting of Tomcat failed, the server port 8080 is already in use.
I tried changing the ports but no success. However, when i try to run same Tomcat from Command prompt using "startup.bat" command, it runs successfully.
Operating system is Vista. I tried checking for open ports using "netstat -a" but no open port for 8080. also tried to see if any "java.exe" process is running but it was not.
Thanks in advance for the help.
Sometimes Vista, especially after hibernation, doesn't free a previously used port. Have you tried restarting the pc?