I recently downloaded Glassfish 4.0 and I want to use it in NetBeans for making some Web Applications, but when I want to start the domain1 (asadmin> start-domain domain1) I keep getting this error:"There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server". Any clue what could be the problem?
Glassfish could not resolve the host name. Diagnose the problem (on Linux) as follows:
Open a Terminal.
Type hostname.
Type: ping $(hostname)
If the ping command fails (could not find the host), then add the host name to /etc/hosts. This can be accomplished as follows:
Switch to root: sudo su -
Type: echo "127.0.0.1 $(hostname)" >> /etc/hosts
Kill GlassFish
Restart GlassFish
your system using port 4848 that is why.
when glassfish starts its need three port numbers one for administrations, one for http applications other for https.
so in you system 4848 is already reserved by some program or server.
Or you can change default port number as per your need like below.
type in command prompt.
To change the HTTP port to 10080:
asadmin set server.http-service.http-listener.http-listener-1.port=10080
To change the HTTPS port to 10443:
asadmin set server.http-service.http-listener.http-listener-2.port=10443
To change the administration server port to 14848:
asadmin set server.http-service.http-listener.admin-listener.port=14848
Try lsof -i:4848 on the terminal.
Kill the java processes listed using the command kill -9 <PID>.
If you have a GUI task manager, say like Activity Monitor on OSX, then you can just kill the java processes listed there.
Hope this works for anyone facing this problem.
1- Go to the config folder inside your domain.
(In my case: C:\Glassfish\glassfish\domains\mydomain\config\ )
2-Open the file domain
3-Update the port number on these three lines:
4-Restart your domain:
--Note
For restarting the domain:
1-Open cmd console
2-Navigate yo your domain
3-Execute: asadmin restart-domain mydomain
--I hope it helps :-)
Solution can be this:
in console type:
echo $HOSTNAME
then make sure the output follows 127.0.0.1 string in
/etc/hosts
For example:
127.0.0.1 dev.myserv.pl
Do a
netstat -aon
from command line and check which process is using your port.
If it's not important, kill it as a quick'n'dirty solution.
I am using VNC to connect to a server. I am able to VNC into the server, and open Jconsole, but cannot get it to connect to my process whether I include the PID or try connecting using the GUI. The weird thing is all the processes show up in the GUI. See below.
I get this when I try connecting:
Followed by
Is there something I need to do in order to get Jconsole working locally on a Linux server over VNC?
Fix found here: You need to pass to the VM:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false
--
Edit - Fixed the =fals error mentioned in comments.
In my case, I also had to add this option to get Jconsole to connect to the process.
-Djava.rmi.server.hostname=localhost
Remote JConsole
Add the following parameters to your java Application and run it
-Djava.rmi.server.hostname=DOMAIN_PUBLIC_URL -Dcom.sun.management.jmxremote.port=PORTNUMBER -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
DOMAIN_PUBLIC_URL - Like your instance public address
PORTNUMBER - 9955
Launch jconsole in your ubuntu from terminal command and go to remote connection and paste the DOMAIN_PUBLIC_URL and PORT and Connect it without username and password like insecure connection.
Make sure to expose the port number on your AWS Server Instance.
Adding below property as VM argument in Run Configurations --> Arguments --
-Dcom.sun.management.jmxremote=true
In my case, I had to make it false and also add a hostname to localhost. Add this in VM arguments in Run Configurations.
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=localhost
I am running Tomcat 6 on a Linux server in Amazon's cloud. I am trying to connect to it with VisualVM from my Mac at my office. I have allowed opened up all TCP ports between my desktop and the server, but I am unable to get VisualVM to do anything.
On the linux box, I have started Tomcat with:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9191
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
On my Mac, I launch VisualVM and choose File -> New JMX Connection...
I enter amazonhostname.com:9191 in the box. It says "Adding amazonhostname.com:9191..." and sits there for several minutes before timing out.
From my Mac, I can "telnet amazonhostname.com 9191" just fine, and I tried some other random ports, and they all worked. I'm pretty convinced it's not a firewall issue, unless I need to open UDP or ICMP or something like that. (Really??)
There is nothing in catalina.log on the server, or the system console on my Mac, related to jmx. netstat on the server shows 9191 and some other ports open on all interfaces.
There is no jstatd on the remote server. Is that a pre-requisite for JMX? (I am totally new to Java and I'm not even sure what those things mean, but I saw it on a blog post somewhere. I'm grasping at straws now.)
Set the hostname property before the VM starts:
java -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=9191 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Djava.rmi.server.hostname=the.public.ip \
-jar program.jar
Add the relevant rules to your security group.
What worked well for me in RHEL7 environment is to implement the JmxRemoteLifecycleListener on Tomcat using the example provided in the documentation. I have also opened up ports 10001 and 10002 on the firewall.
JMX Remote Lifecycle Listener
I'm getting the following error when I try to run a simple JSP program on Tomcat in Eclipse.
Several ports (8005, 8080, 8009) required by Tomcat v6.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).
How is this caused and how can I solve it?
You've another instance of Tomcat already running. You can confirm this by going to http://localhost:8080 in your webbrowser and check if you get the Tomcat default home page or a Tomcat-specific 404 error page. Both are equally valid evidence that Tomcat runs fine; if it didn't, then you would have gotten a browser specific HTTP connection timeout error message.
You need to shutdown it. Go to /bin subfolder of the Tomcat installation folder and execute the shutdown.bat (Windows) or shutdown.sh (Unix) script. If in vain, close Eclipse and then open the task manager and kill all java and/or javaw processes.
Or if you actually installed it as a Windows service for some reason (this is namely intented for production and is unhelpful when you're just developing), open the services manager (Start > Run > services.msc) and stop the Tomcat service. If necessary, uninstall the Windows service altogether. For development, just the ZIP file is sufficient.
Or if your actual intent is to run two instances of Tomcat simultaneously, then you have to configure the second instance to listen on different ports. Consult the Tomcat documentation for more detail.
kill $(ps -aef | grep java | grep apache | awk '{print $2}')
no need to restart Eclipse
if you get the above error, just enter this line in terminal
again start the tomcat in Eclipse.
works only in Linux based system ( Ubuntu ..etc )
If you are running on windows try this in the command line prompt:
netstat -ano
This will show all ports in use and the process id PID # of the process that is using that port.
Then Ctrl+Alt+Del and open Task Manager to see which process is that.
You can then choose either to close/stop it or configure your server to use another port.
To check if the new choosen port (let's say 8010) is available do this:
netstat -ano | grep 8010
If it does not return any lines then you are fine.
To change the port go to the Server view, open server.xml and change the port there.
Mine has this entry:
Connector port="8010" protocol="AJP/1.3" redirectPort="8443"
If you are on mac environment, here is what I did.
Find the process id running on this port from terminal, eg, 8080:
lsof -i :8080
and kill it:
kill -9 <PID>
Example:
You may see following result:
MacSys:bin krunal.$ lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 21347 krunal 52u IPv6 XXX 0t0 TCP *:http-xxx (LISTEN)
and kill it: (kill -9 21347)
Steps to free port which is already used to run tomcat server in Eclipse
For example , suppose 8080 port is used , we need to make free 8080 to run tomcat
Step 1:
C:\Users\username>netstat -o -n -a | findstr 0.0:8080
TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 3116
Now , we can see that LISTENING port is 3116 for 8080 ,
We need to kill 3116 now
Step 2:-
C:\Users\username>taskkill /F /PID 3116
Step 3:
Go to Eclipse and start Server , it will run
If you use Eclipse then double click on servers and double click on tomcat server then one file will open. In that file change HTTP port to some other port number and save(Ctrl+S) then again start the server.
If Eclipse says
Several ports (8005, 8080, 8009) required by Tomcat v6.0 Server at localhost are already in use
This error comes because tomcat may be running in background so first stop that server..follow the below details.
Solution is:
Open the "console" view (window->show view->Console)
Then stop the tomcat server.
Then open the "server" view and start the server it will work.
Thanks!
I have no another instance of Tomcat running ad no other process using "Tomcat port" (in my case, the 8088 port).
Eclipse send the same message on starting Tomcat:
....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).
I solve the problem in this way:
go to bin of tomcat by prompt
launch startup.bat
launch shutdown.bat
start tomcat by Eclipse
What I did after reading all the suggested answer and as I know my port was already in use. I double clicked on Tomcat under the Servers tab in eclipse and it opened overview information and then find port information. Just changed conflicting port as mine was 8009 port (error mentioned during starting the server). I have changed it to 8008 and it works fine. Give a try if the changed port would not be in use server will start.
Step 1: netstat -a -o -n and it will bring up a network list,search for the local address like 127.0.0.1:8080 and note the PID (eq 3624)
C:\>netstat -a -o -n
Step2 : taskkill /F /PID 3624 . Run this command to kill that process.
C:\>taskkill /F /PID 3624
link to post
On Windows use command for stopping the already running tomcat instance and try running it again in eclipse, it may work.
net stop tomcat7
Or you can change the port in server's XML if you just want to run on some other ports.
Easy way to solve your problem:
The server may already be running in another process, or a system process may be using the port. In order to kill that port, do the following:
1) Download TCPView(only 285kb) from following link.
http://technet.microsoft.com/en-in/sysinternals/bb897437.aspx
2) Extract folder and start TCPView application.
3) Right click on java.exe(because 8009,8005 ports are commonly used by java process) and select End Process option.
this would stop another process easily..
NOTE: Running TOMCATPATH/bin/shutdown.bat may not shutdown Tomcat when it contains some demon or unmanaged
threads. In such cases TCPView works fine without any issues.
I checked all the answers but informing only to kill PID.
In case if you have terminal access shared by all it will not help or maybe you do not have permission to kill PID.
In this case what you can do is:
Double click on server
Go to Overview and change ports in Ports like this:
If you are in Java EE prospective in Eclipse and trying to start the Tomcat Server in Eclipse in debug mode, then you will get such errors. You must switch to debug prospective in Eclipse. I have solved my problem like this.
Sometimes if the ports are not freed even after attempting shutdown.bat what #BalusC suggested,you can kill the javaw process. Do following steps :
Click on Start Menu and open "Windows powershell"
Right click before opening and select "Run as administrator"
Enter command ps. You may see a image as follows :
See the process number of process "javaw".The process number is the rightmost number in the columns, I have highlighted in the image process number of javaw for example.
Enter command kill . javaw is killed and now you must be able to run the program.
Here's one more option to try if none of the efforts above helped. You might be using Eclipse from a Shared Drive (for eg, H:). If so, move/copy it the entire Eclipse directory to C: and try again.
My Eclipse could not open ports for Tomcat server (with the above error), nor even connect to internet. I also tried another Tomcat plugin (Sysdeo) which failed to open the ports too.
These are the options I tried:
Check and Kill Other Tomcat Instances
In command prompt, netstat -ano and check if any other processes are using the conflicted ports.
Find the PID and kill it
Try starting the server again.
Change Tomcat Ports in Eclipse
In Eclipse Server tab, double click the Tomcat instance. This will open the configuration tab.
Under Ports, change the port numbers. (for eg, 18080).
Kill java.exe and javaw
In Task Manager, find and kill java.exe and javaw (see https://stackoverflow.com/a/25334782/4212710 and https://stackoverflow.com/a/26136890/4212710)
Try starting the server again.
See my other answer for Eclipse not connecting to Internet (https://stackoverflow.com/a/37246087/4212710).
For windows users:
Go to Task Manager directly with CTRL+SHIFT+ESC key combination.
Kill the "java.exe" processes by right clicking and selecting "End Task".
The simpler fix that works for me is deleting my current deployed webapps from tomcat through the "Server" tab. Once I remove them the problem goes away. Simply re-deploy your project by going on Run As > Run on Server.
The problem often arises when Apache Tomcat fails to terminate, properly, even though a shutdown instruction was sent. In my case, using Tomcat 8, this happens with annoying regularity. Luckily, you can use Windows PowerShell and the netstat command to create a simple script to kill the process.
The following PowerShell script will parse the output from netstat to find any process that is listening on 127.0.0.1:8005, extract its PID and then kill that process:
netstat -a -o -n `
| select -skip 4 `
| % {$a = $_ -split ' {3,}'; New-Object 'PSObject' -Property #{Original=$_;Fields=$a}} `
| ? {$_.Fields[1] -match '127\.0\.0\.1\:8005$'} `
| % {Write-Host "Killing PID" $_.Fields[4] "..."; taskkill /F /PID $_.Fields[4] }
If your server.xml configures Tomcat to use a different port or IP, edit the regular expression on the script's fourth line accordingly.
Finally, I should point out that the situation is better on Linux because you can instruct Tomcat to save its PID to a file at startup-time and use a switch to force the shutdown, later - the shutdown script for 'nix systems already features the ability to kill the process and the sleuth-work with netstat is not required.
If the above issue occurs in Windows 7 or 10 based OS, the problem occurs because Tomcat is running as Windows Service. To stop Tomcat running as Windows Services, Open Windows Control Panel. Find the service "Apache Tomcat" and Stop it.
The Another way is to kill the process running on port 8080 using cmd.
Open cmd running it as administrator.
C:\users\username>netstat -o -n -a|findstr 0.0:8080
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 2160.
The above 2160 is process id of process running on port 8080 and kill that process using the following command
C:\users\username>taskkill /F /PID 2160
Go to IDE and start Server, it will run
It may be because you are not stopping your tomcat service properly. To do that, Open your task manager there you can see a javaw.exe service. First stop that service. Now restart your tomcat it works fine.
In my case, it was giving me the error: Port 8005 required by Tomcat v8.0 Server at localhost is already in use
I changed 8005 port in apache-tomcat-8.0.39\conf\server.xml but changes were not getting reflected. Then I did these changes from eclipse. by double clicking server and modifying the port from 8005 to 8006 and it works.
Before putting 8006 I checked in windows shell if this port is available or not. By executing following command:
netstat -a -o -n | findstr 8006
I face the same problem and after searching the answer as shown below:
1. open Monitor Tomcat as shown below:
Simply press stop as shown in below picure:
Finally it works with me after many trials and suggested solutions.
Best Regards,
Kerelos Mikhail
On Eclipse make a raw delete of Tomcat configuration folder under project "Servers".
I tried it as last hope and it worked.
In case of windows, I experienced a new stuff...
stopping tomcat from /bin folder will immediately not releasing the port 8080. It takes around 5-10 mins to release the port. After 10 mins again if i try to run my project
Run-> Run on server .. it allows to run.
I'm unsure whether my understanding is correct!
Refer to the following blog "how to kill tomcat without have to restart your computer"
http://stanicblog.blogspot.fr/2012/01/how-to-kill-apache-tomcat-without.html
Hope this will help someone in the future.
It occurs when others in the project are also using the same port numbers as you are using!
double click tomcat server, change port numbers to anything 8585 or whatever. The code will now begin to run!
How to kill a windows service using PID -
open command prompt and type netstat -ano
find the PID of the ports which are in used, in this case, it will be 8080, 8005,8009. Let's say PID of these ports are 5760.
Now Type taskkill /f /pid 5760
it will close the PID and ports will be available for use. Now you can start tomcat as normal by Windows services or by eclipse itself.
Thanks
kill a Windows service that's stuck on stopping or starting
Several ports (8005, 8080, 8009) required by Tomcat vX.X Server at localhost are already in use
To check whether another instance of Tomcat already running or some other process is using the ports you can use:
netstat -b -a in command prompt for windows. This lists the ports in use and gives you the executable that's using each one. You need to be in the admin group to do this.
You might get something like this:
TCP 192.168.0.1:8009 192.168.0.1:0 LISTENING 196 [Tomcat7.exe]
TCP 192.168.0.1:8080 192.168.0.1:0 LISTENING 196 [Tomcat7.exe]
TCP 192.168.0.1:8005 192.168.0.1:0 LISTENING 196 [Tomcat7.exe]
Open task manager Ctrl+Shift+Esc, and kill Tomcat7.exe or any other process using these ports.
Your Tomcat is probably running already. That's why you have got an error. I've had the same problem before. I solved it very simply:
Restart your computer
Open Eclipse
Run your Tomcat
That's all.
How to activate JMX on a JVM for access with jconsole?
The relevant documentation can be found here:
http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html
Start your program with following parameters:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.rmi.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
For instance like this:
java -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-jar Notepad.jar
-Dcom.sun.management.jmxremote.local.only=false is not necessarily required
but without it, it doesn't work on Ubuntu. The error would be something like
this:
01 Oct 2008 2:16:22 PM sun.rmi.transport. customer .TCPTransport$AcceptLoop executeAcceptLoop
WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=37278] throws
java.io.IOException: The server sockets created using the LocalRMIServerSocketFactory only accept connections from clients running on the host where the RMI remote objects have been exported.
at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:89)
at sun.rmi.transport. customer .TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:387)
at sun.rmi.transport. customer .TCPTransport$AcceptLoop.run(TCPTransport.java:359)
at java.lang.Thread.run(Thread.java:636)
see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6754672
Also be careful with -Dcom.sun.management.jmxremote.authenticate=false which
makes access available for anyone, but if you only use it to track the JVM on
your local machine it doesn't matter.
Update:
In some cases I was not able to reach the server. This was then fixed if I set this parameter as well: -Djava.rmi.server.hostname=127.0.0.1
Running in a Docker container introduced a whole slew of additional problems for connecting so hopefully this helps someone. I ended up needed to add the following options which I'll explain below:
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=${DOCKER_HOST_IP}
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.rmi.port=9998
DOCKER_HOST_IP
Unlike using jconsole locally, you have to advertise a different IP than you'll probably see from within the container. You'll need to replace ${DOCKER_HOST_IP} with the externally resolvable IP (DNS Name) of your Docker host.
JMX Remote & RMI Ports
It looks like JMX also requires access to a remote management interface (jstat) that uses a different port to transfer some data when arbitrating the connection. I didn't see anywhere immediately obvious in jconsole to set this value. In the linked article the process was:
Try and connect from jconsole with logging enabled
Fail
Figure out which port jconsole attempted to use
Use iptables/firewall rules as necessary to allow that port to connect
While that works, it's certainly not an automatable solution. I opted for an upgrade from jconsole to VisualVM since it let's you to explicitly specify the port on which jstatd is running. In VisualVM, add a New Remote Host and update it with values that correlate to the ones specified above:
Then right-click the new Remote Host Connection and Add JMX Connection...
Don't forget to check the checkbox for Do not require SSL connection. Hopefully, that should allow you to connect.
Note, Java 6 in the latest incarnation allows for jconsole to attach itself to a running process even after it has been started without JMX incantations.
If that is available to you, also consider jvisualvm as it provides a wealth of information on running processes, including a profiler.
I'm using WAS ND 7.0
My JVM need all the following arguments to be monitored in JConsole
-Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8855
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
On Linux, I used the following params:
-Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
and also I edited /etc/hosts so that the hostname resolves to the host address (192.168.0.x) rather than the loopback address (127.0.0.1)
along with below command line parameters ,
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
Sometimes in the linux servers , imx connection doesn't get succeeded. that is because , in cloud linux host, in /etc/hosts so that the hostname resolves to the host address.
the best way to fix it is, ping the particular linux server from other machine in network and use that host IP address in the
-Djava.rmi.server.hostname=IP address that obtained when you ping that linux server.
But never rely on the ipaddress that you get from linux server using ifconfig.me. the ip that you get there is masked one which is present in the host file.
The below options works for me:
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.rmi.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname={host name}
and remember to open 9010 port in the server
sudo ufw allow 9010/udp
sudo ufw allow 9010/tcp
sudo ufw reload
Run your java application with the following command line parameters:
-Dcom.sun.management.jmxremote.port=8855
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
It is important to use the -Dcom.sun.management.jmxremote.ssl=false parameter if you don't want to setup digital certificates on the jmx host.
If you started your application on a machine having IP address 192.168.0.1, open jconsole, put 192.168.0.1:8855 in the Remote Process field, and click Connect.
Step 1: Run the application using following parameters.
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
Above arguments bind the application to the port 9999.
Step 2: Launch jconsole by executing the command jconsole in command prompt or terminal.
Select ‘Remote Process:’ and enter the url as {IP_Address}:9999 and click on Connect button to connect to the remote application.
You can refer this link for complete application.
RUN LOCAL PROCESS JCONSOLE using Remote Process option
To run locally, this worked for me -
I added this in my vm args -
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=6001
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=localhost
-Dcom.sun.management.jmxremote.rmi.port=6001
I opened JConsole via Intellij Terminal
It was showing me all PID's in grey in local
So I selected remote process and logged in using host - localhost:6001
Keep empty username & password
Then click connect
Make sure no other process is running on port 6001. You can also use other ports.
First you need to check if your java process is already running with JMX parameters. Do this:
ps -ef | grep java
Check your java process you need to monitor. If you can see jmx rmi parameter Djmx.rmi.registry.port=xxxx then use the port mentioned here in your java visualvm to connect it remotely under jmx connection.
If it's not running through jmx rmi port then you need to run your java process with below mentioned parameters :
-Djmx.rmi.registry.port=1234 -Djmx.rmi.port=1235 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
Note: port numbers are based on your choice.
Now you can use this port for jmx coneection. Here it is port 1234.
I had this exact issue, and created a GitHub project for testing and figuring out the correct settings.
It contains a working Dockerfile with supporting scripts, and a simple docker-compose.yml for quick testing.