RAD - JVM debug port is in use - java

I am using RAD 7.5.0 and the websphere server v6.1. When i start the server in debug mode, it displays a error message states that
'Starting WebSphere application server in localhost; has encountered a problem.
JVM debug port #### is in use.
What is the problem? How to resolve this?

i also frustrated many times because of this eroor.. Finally found out the solution
To resolve this problem you will need to do the following to all of your subsequent servers:
1.Start the server in 'normal' mode (i.e. non-debug mode).
2.Launch the Administrative console and log in.
3.Expand 'Servers', click on 'Application Servers', and then your server instance (typically 'server1').
4.On the 'Configuration' tab expand 'Java and Process Management' and then click on 'Process Definition'.
5.Under the 'Additional Properties' header, click on 'Java Virtual Machine'.
6.Scroll to the bottom of the page, locate the 'Debug Arguments' text field, and increment the 'address' property at the very end of the string so it will use a unique port value.
7.Save your changes, exit the administrative console, stop the server, and then start it in debug mode

It simply means that the debug port is currently in use. Do you have any other IBM products already running on that box? Does this happen when you start your server for the first time or for subsequent tries?
One suggestion would be to hunt down rogue hanging Java processes and kill them (in case you don't need them) to resolve this.

Open task manager in admin mode and run the following two commands.
1: netstat -ano | findstr :PORT_NUMBER
e.g.: netstat -ano | findstr 7781
2: taskkill /PID PID /F (PID will be the number that is shown e.g.: 32181)
e.g.: taskkill /PID 32181 /F

Related

Appium Question. If "listen eaddrinuse: address already in use", how to stop it? why it didn't stop?

I had been started Appium using default 0.0.0.0:4723 address and port, but then I got this error:
C:\User\me>appium
[Appium] Welcome to Appium v1.17.0
[HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
Fatal Error: listen EADDRINUSE: address already in use 0.0.0.0:4723
at Server.setupListenHandle [as _listen2] (net.js:1309:16)
at listenInCluster (net.js:1357:12)
at doListen (net.js:1496:7)
at processTicksAndRejections (internal/process/task_queues.js:85:21)
I found that I can change the port using:
appium -p 4724
I also found that I can close connection to 0.0.0.0:4723, if any, whether on the Appium desktop app or a second CMD. I closed Appium desktop app, I stopped and closed any other CMD, but I still got the same Fatal Error: listen EADDRINUSE: address already in use 0.0.0.0:4723
Then my questions: How to stop this already used address? and, Why it didn't stop?
I am ok with using another port to start my server, but shouldn't I be able to simply stop the connection to 4723 port and using it again?
Open a CMD window in Administrator mode by navigating to Start > Run > type cmd > right-click Command Prompt, then select Run as administrator.
C:\Users\admin>netstat -ano|findstr "PID :4723"
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:4723 0.0.0.0:0 LISTENING 6134
To kill the process type the PID of the port you want to kill (which will be displayed on the CMD screen)
[/f is force]
taskkill /pid 6134 /f
It means that port is already in use. You must kill the process running in that port.
Type following in your command prompt/terminal to get the process ids(PID).
ps aux | grep appium
Then kill that process with following command
kill -9 PID
Alternate process for window:
netstat -ano | findstr :4723
tskill typeyourPIDhere
taskkill /F /IM node.exe
Instead of remembering and getting to know the process id, just execute the above in command line and Appium service will be ended.

Web server failed to start. Port 8080 was already in use. Spring Boot microservice

I am trying to call webAPI from gradle project.
My build.gradle is as following.
plugins {
id 'org.springframework.boot' version '2.1.4.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
runtimeOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
compile 'org.springframework.boot:spring-boot-starter-webflux'
compile 'org.projectreactor:reactor-spring:1.0.1.RELEASE'
}
If I remove following dependency
compile 'org.springframework.boot:spring-boot-starter-webflux'
It works, but if I add it back. it gives error as
Web server failed to start. Port 8080 was already in use.
So, how do I fix this, so that I can use webclient? Because application is not web application which requires port to run. it is a sort of microservice.
I just want to use WebClient of Spring Boot. How do i use it without converting my application into web application.
If on windows and your getting this every time you run the application you need to keep doing:
> netstat -ano | findstr *<port used>*
TCP 0.0.0.0:*<port used>* 0.0.0.0:0 LISTENING *<pid>*
TCP [::]:*<port used>* [::]:0 LISTENING *<pid>*
> taskkill /F /PID *<pid>*
SUCCESS: The process with PID *<pid>* has been terminated.
If netstat above includes something like this;
TCP [zzzz:e2ce:44xx:1:axx6:dxxf:xxx:xxxx]:540yy [zzzz:e2ce:44xx:1:axx6:dxxf:xxx:xxxx]:*<port used>* TIME_WAIT 0
Then you can either wait for a little while or reconfigure to use another port.
I suppose we could write some code to randomly generate and check if a port is free when the application runs. Though this will have diminishing returns as they start to get used up. On the other hand could add a resource clean up code that does what we have above once the application stops.
You can change the default port of your application in application.properties by adding the following line:
server.port = 8090
If you don't want the embedded server to start, just set the following property in you application.properties (or .yml):
spring.main.web-application-type=none
If your classpath contains the necessary bits to start a web server, Spring Boot will automatically start it. To disable this behaviour configure the WebApplicationType in your application.properties
Source: https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-web-servers.html
If you application really is a Web application, then you can easily change the port using the server.port property (in your application's .properties/.yaml file, as a command line argument at startup, etc).
Another way to do this is by first checking what processes are using that specific port, then killing it using its process ID:
Run lsof -i :8080
This will identify which process is listening on port 8080.
Take note of the process ID (PID) e.g. 63262
Run kill -9 <PID> e.g. kill -9 63262
Some time if you can manually kill the that port problem can solve.
Using CurrPorts software you can view what are the running all ports in your machine and you can kill that port if you want.
You can download CurrPorts from here. (download link is in bottom of the page)
============== OR ==============
Without CurrPorts you can do this using like below method also.
CMD as run as administrator
Enter netstat -a -o -n and hit enter. Now you can see like below. Port can see Local Address column after : sign.
select the process id(not port) that your port running and type taskkill /F /PID <process_id_here> command and hit enter.
You can use npm to kill the port
**npx kill-port 8080** //8080 for example
Requirement: npm
read more: https://www.npmjs.com/package/kill-port
create /resources folder inside src/main
create application.properties file inside /resources
write server.port=9090 //(use any port number of your choice)
if port:8080 already in use error occurs:
goto command prompt
.type command> .netstat -ano
.Enter->this will show all running port check port 8080
.type command> taskkill /F /PID 8080
.process will terminate.
you can set server.port= #some-available-port number in application.properties file
or run command prompt in administrator mode and run netstat -a -o -n.
Find the process id which is using port 8080.
Run taskkill /F /PID #Processid command
It's easy we have two methods to solve.
First one is to change the port number in your application.properties i.e
server.port=9999 // something like this...
and second is, to first stop the available running server and then re-run your server again.
I am sure it work :)
If you had previously started the spring boot app and forgot to stop before hitting play again then Go to windows task manager and locate the java application(Something like "OpenJDK Platform binary" and click on End Task. (Java app not eclipse). Then try running again. It worked for me.
open command prompt as administrator
step1: netstat -ano | findstr :<enter your 4 digit port number>
netstat -ano | findstr :8080
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 6436
TCP [::]:8080 [::]:0 LISTENING 6436
step2: taskkill /PID <enter above pid number(sometimes it shown 3/4/5/6 digits)> /F
taskkill /PID 6436 /F
SUCCESS: The process with PID 6436 has been terminated.
To reset port 8080, you need to find PID (Process ID) and specify it for the command as, for example, on the screen 10512:
taskkill /F /PID 10512
You try to use an already used port.
Ports are used on the transport layer - tcp, http is application layer and uses a transport layer to send and receive requests.
Default port exposed by spring boot app is 8080. In your case you have two solutions:
change port for your application
stop the service that uses the port you want to use
to catch java.net.BindException e with message: Address already in use and to start on other available port and to use webclient with one of 2 ports.
try {
SpringApplication.run(Application.class, args);
} catch (org.springframework.boot.web.server.PortInUseException e) {
//Runtime.exec("pkil")..
//or
SpringApplication.run(Application.class, otherargs);
//SpringApplication.run(Application.class, new String[]{"--server.port=8444"});
//when invoked recursively it is a port rebalancer for port usage among port pool with server as from client for startup stage via application restarts within many busy ports which are used before or without querying.
}
The error basically means that your port 8080 is occupied. If you are getting this error then go to your project and open application.properties and add the below line and it should work fine:
server.port = 8090
Your client application also spring boot application, whats why you have two spring boot application run in 8080 port.
Change port one of them or create a standalone java application with main class, put your web client in it and run.
As http client you can use Apache Http Client.
Today I was working in Spring Boot project and I got the same error in my project. So, what I did, I clicked on stop button beside the run last tool button and run again. Then, my project started working very well.
You can also write services.msc in your search bar in windows.Then you can find Apache Tomcat and then just stop this apache. I think its gonna be work.
It is a simple answer.If you are getting this error then go to your project then
src/main/resources and open application.properties file and mention there
server.port=8045 you can give your own number here instead of 8045
thanks
Open cmd and type "netstat -ano -p tcp."
Then, look for the port number and PID.
Open up Resource Monitor and search for the PID number
Right Click and "End Process."
Restarting my machine solved the issue although I was getting below issue:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.PortInUseException: Port 8081 is already in use
If you getting this error again and again , then make sure server.port=(your port no) is the first line in application.properties file.
The best answer to this is to always use the "Relaunch Application" button. That will stop the web server and restart the entire app on the same port as before.
It's the button with the red square and green play icon combined.
https://i.stack.imgur.com/ICGtX.png

Use port which is already in allocated to some process [duplicate]

When I run my Java project using Netbeans I get the following error:
Deployment error:
Starting of Tomcat failed, the server port 8080 is already in use.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor619.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: org.netbeans.modules.j2ee.deployment.impl.ServerException: Starting of Tomcat failed, the server port 8080 is already in use.
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance._start(ServerInstance.java:1297)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1251)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1062)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:939)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.startTargets(TargetServer.java:428)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:143)
... 16 more
BUILD FAILED (total time: 4 seconds)
I tried changing the server port to 8081 and shutdown port in tool->server. It runs fine but again if I do any operations and run the project it says "Deployment error:Starting of Tomcat failed, the server port 8081 is already in use"
What would be the problem?
goto command prompt
netstat -aon
for linux
netstat -tulpn | grep 'your_port_number'
it will show you something like
TCP 192.1.200.48:2053 24.43.246.60:443 ESTABLISHED 248
TCP 192.1.200.48:2055 24.43.246.60:443 ESTABLISHED 248
TCP 192.1.200.48:2126 213.146.189.201:12350 ESTABLISHED 1308
TCP 192.1.200.48:3918 192.1.200.2:8073 ESTABLISHED 1504
TCP 192.1.200.48:3975 192.1.200.11:49892 TIME_WAIT 0
TCP 192.1.200.48:3976 192.1.200.11:49892 TIME_WAIT 0
TCP 192.1.200.48:4039 209.85.153.100:80 ESTABLISHED 248
TCP 192.1.200.48:8080 209.85.153.100:80 ESTABLISHED 248
check which process has binded your port. here in above example its 248 now if you are sure that you need to kill that process fire
Linux:
kill -9 248
Windows:
taskkill /f /pid 248
it will kill that process
If you are behind a proxy server this issue could happen
i had the same issue and was solved by:
Preferences -> General -> Proxy Settings -> No Proxy.
"Maybe the tomcat ready-message was sent to the proxy - and never reached the IDE."
found #: https://netbeans.org/bugzilla/show_bug.cgi?id=231220
I had the same problem when trying to deploy, tomcat failed to restart as Tomcat instance was running. Close the IDE and check TASk Manager - kill any javaw process running, that solved the problem for me.
Take a look on your running processes, it seems like your current Tomcat instance did not stop. It's still running and NetBeans tries to start a second Tomcat-instance.
Thats the reason for your exception, you just have to stop the first instance, or deploy you code on the current running one
By changing proxy settings to "no proxy" in netbeans the tomcat prbolem got solved.Try this it's seriously working.
If on Linux you can kill existing Tomcats with this script
#/bin/bash
if [ `whoami` != root ]; then
echo "Please run this script as root or using sudo"
exit
fi
echo
echo "finding proceses that have name java and established connections status"
echo
echo "Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name"
netstat --tcp --programs | grep "ESTABLISHED" | grep "java"
echo
echo "finding proceses that use port 8080 or http-alt"
echo
netstat --tcp --programs | grep ':8080\|:http-alt'
echo -n "Do you wish to kill a process listed above?[Y/n]"
read choose
if [ "$choose" = "Y" ] || [ "$choose" = "y" ] || [ -z "$choose" ]
then
echo "enter pid to kill"
read procesId
kill -9 $procesId
fi
echo "done exiting"
exit 0
Kill the previous instance of tomcat or the process that's running on 8080.
Go to terminal and do this:
lsof -i :8080
The output will be something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 76746 YourName 57u IPv6 0xd2a83c9c1e75 0t0 TCP *:http-alt (LISTEN)
Kill this process using it's PID:
kill 76746
Select the project -> Right-Click -> clean and build and then run the project again simply solve the problem for me.
As, multiple process could bind the same port for example port 8086, In that case I have to kill all the processes involved with the port with PID. That might be cumbersome.
Change your default port in [tomcat_home_dir]/conf/server.xml
find
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
change it to
<Connector port="8090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Change your Tomcat port address to 8084 and Shut Down Port to 8025. This will resolve your problem.
In other cases antivirus programs may cause problems. I had this problem with K7 total security. In my case K7 Firewall was blocking the 8084 port. The simple solution is to add an exception to Netbeans in K7 Firewall list.
In order to do that, open K7 and goto Settings -> Firewall Settings -> select Applications tab and find Netbeans.
Select Netbeans and click on edit link. On next screen select Grant Full Network access radio button.
Now goto Netbeans and start the server.
I resolved it by replacing Tomcat 8.5.* with Tomcat 7.0.* version.
This error message can also be caused by SELinux. Check if SELinux is enabled with getenforce
You need to adjust SELinux to use your port and restart.
I.E.
semanage port -a -t http_port_t -p tcp 9080 2>/dev/null || semanage port -m -t http_port_t -p tcp 9080
I tried No Proxy Settings , killing the process id . Some times they do work, But unfortunately they did not this time. So I tried the following.
In the Services Tab in NetBeans - Right Click on Apache Server {Version} - Platform Tab - Uncheck "Use IDE Proxy Settings". This solved the issue in my case.
I also had this problem. I changed port and did other things, but they didn't help me. In my case, I connected Tomcat to IDE after installing Netbeans (before). I just uninstalled Netbeans and Tomcat after that I reinstall Netbeans along with Tomcat (NOT separately). And the problem was solved.

Not able to debug webservice code in IntelliJ

I have a window service that I have installed.I have the source code of the application opened in Intelli J.
I made configuration IntelliJ as following
I checked the PID of the service and port it is using.
While running Remote config in Intelli J it is giving following error
4:09:18 PM Error running Remote: Unable to open debugger port : java.net.ConnectException "Connection refused: connect"
Can someone please shed some light on how to debug window service in IntelliJ. It is a job schedule application.
The installService.cmd is as follows
set HOME_DIR=%~dp0
set SERVICE="Service_Name"
SET JAVA_OPTIONS=-Xms256m -Xmx256m
#echo Service name is Service_Name
"pathname\Service_Name.exe" -install %SERVICE% %JVM% %JAVA_OPTIONS% -Djava.class.path="pathname\Service_Name.jar" -Dorg.quartz.properties="pathname/Service_NameScheduler.properties" -start com.org.st.Service_Name -stop com.org.st.Service_Name -out "D:/core_log\Service_Name_service_out.log" -err "D:/core_log\Service_Name_service_error.log" -current "pathname\apps"
set JVM="C:/Program Files/Java/jdk1.6.0_29/jre/bin/server/jvm.dll"
Check the port number. It should be same as in JAVA_OPTIONS & Intellij Idea Debugger remote configuration under port no.
Please append the command line arguments from the IntelliJ debug configuration to the SET JAVA_OPTIONS line, it will be something like
SET JAVA_OPTIONS=-Xms256m -Xmx256m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=51211
And reinstall the service.
Make sure whatever port you're listening on isn't blocked by a firewall.

Running Single instance AppScale in a virtual machine

I was trying to run AppScale in a Single-instance node installed in a Vmware box and running the appscale-tools in the same server virtual machine and got this error:
root#appscale:~appscale-tools-bin# ./appscale-run-instances --ips ips.yaml
About to start AppScale over a non-cloud environment.
Head node successfully created at 127.0.0.1. It is now starting up cassandra via the command line arguments given.
Generating certificate and private key
Starting server at 127.0.0.1
Please wait for the controller to finish pre-processing tasks.
Warning: Permanently added '127.0.0.1' (RSA) t othe list of known host.
Error: Couldn't find me in the node map
The solution I was advised was to change a code in this source:
appscale/AppController/lib/helperfunctions.rb
And look for self.local_ip() and change to:
def self.local_ip()
return "127.0.0.1"
end
But when I run
./appscale-run-instances --ips ips.yaml
I am not sure, but it just keep on saying:
"Please wait for the controller to finish pre-processing tasks." for several minutes already.
So I decided to terminate it, and here is what I get:
"...common_functions.rb:399:in 'sleep_unti_port_is_open"
In this case, it seems I need to open a port, I am running AppScale from within Ubuntu, what port should I open in my server?
Here's the complete command line:
./appscale-run-instances --ips ips.yaml
About to start AppScale over a non-cloud environment.
Head node successfully created at 127.0.0.1.
It is now starting up cassandra via the command line arguments given.
Generating certificate and private key.
Starting server at 127.0.0.1
Please wait for the controller to finish pre-processing tasks.
^C./../lib/../lib/common_functions.rb:399:in sleep': Interrupt
from ./../lib/../lib/common_functions.rb:399:in 'sleep_until_port_is_open'
from ./../lib/../lib/common_functions.rb:397:in 'loop'
from ./../lib/../lib/common_functions.rb:397:in 'sleep_until_port_is_open'
from ./../lib/../lib/common_functions.rb:1359:in 'start_appcontroller'
from /usr/lib/ruby/1.8/timeout.rb:62:in ttimeout.
from ./../lib/../lib/common_functions.rb:1351:in 'start_appcontroller'
from ./../lib/../lib/common_functions.rb:548:in 'start_head_node'
from ./../lib/appscale_tools.rb:284:in trun_instances'
from ./appscale-run-instances:14
Using the pre-build Appscale images here or following the steps listed here https://github.com/AppScale/appscale/wiki/Virtualized-Cluster will solve this problem.
Also it has the build script:
$ sudo su
# cd /root
# wget -O - http://bootstrap.appscale.com | sh

Categories

Resources