How do I access an Eclipse Tomcat server externally? - eclipse

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?

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.

The server may already be running in another process

Several ports (8005, 8080) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
Can you please tell me what is the problem with Tomcat. I am running it on my Ubuntu machine.
Are you using tomcat with apache or other engine? If so you would have to change apache or tomcat ports so they do not overlap.
Maybe you start tomcat on system start and then you try to run it from eclipse? Before starting eclipse try to shutdown tomcat server.

jconsole cannot connect to local processes on my new Mac Air

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)

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?

Can't Remotely Debug Tomcat Running on CentOS Virtual Machine from Eclipse on Host Windows 7

Setup
VMWare Virtual Machine
CentOS 5.5 64-bit
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
Tomcat 6.0
Host Machine
Windows 7 64-bit
Oracle/Sun JDK 1.6 64-bit
Eclipse Helios for Java EE developers
Problem
My eclipse Remote Java Application has following connection properties:
Host: 192.168.94.133
Port: 8000
When I run the above configuration, I get:
Failed to connect to remote VM. Connection refused.
Connection refused: connect
Nothing new comes out of tomcat's log.
But when I telnet from the windows box:
bash-3.2$ telnet 192.168.94.133 8000
Trying 192.168.94.133...
Connected to 192.168.94.133.
Escape character is '^]'.
Connection closed by foreign host.
Every time I try the above telnet, tomcat spits this out in the log:
Debugger failed to attach: timeout during handshake
Because of the telnet behavior, I think the issue is in Eclipse... I'd appreciate any help.
Thanks,
-Dave
You are probably trying to connect twice to port 8000 from Eclipse (without noticing).
Switch to the Debug Perspective explicitly ("Window - Open Perspective - Debug") and see if you are connected.
Settings required in Tomcat 1)Create setenv.sh file under */tomcat/bin/. The location will be same as the catalina.sh file
2)Place the below content inside it. export CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
Now start the Tomcat server. Once it is started please proceed with the below steps.
Settings required in Eclipse
3)In Eclipse go to Windows-->Preference--> General-->Network Connection --> Active Provider should be Direct. After changing to direct restart the eclipse.
4)In eclipse right click on project and debug as ->debug configuration ->Remote java application ->Create new configuration. Fill the below fields Name: as your wish Project:Select the project which you need to debug. ConnectionType: Standard socket attach Host: Localhost Port: 8000(It should be same as mentioned in point 2) Then click debug.
The debug will start at port 8000. Now you can verify by keeping breakpoints.