java.net.BindException: Cannot assign requested address on cloud foundry

36 views
Skip to first unread message

ashok kumar

unread,
Oct 14, 2020, 4:44:34 PM10/14/20
to JaCoCo and EclEmma Users
Hi All,

I have SpringBoot application running on PCF and I set output="tcpserver", port="6335" and address="<IP Address of VM>" and while starting the application, seeinb below exception. Appreciate your help on this.

2020-10-14T15:36:01.308-05:00 [APP/PROC/WEB/0] [ERR] java.net.BindException: Cannot assign requested address (Bind failed)
2020-10-14T15:36:01.308-05:00 [APP/PROC/WEB/0] [ERR] at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
2020-10-14T15:36:01.308-05:00 [APP/PROC/WEB/0] [ERR] at java.net.ServerSocket.bind(ServerSocket.java:390)
2020-10-14T15:36:01.308-05:00 [APP/PROC/WEB/0] [ERR] at org.jacoco.agent.rt.internal_43f5073.Agent.getInstance(Agent.java:54)
2020-10-14T15:36:01.308-05:00 [APP/PROC/WEB/0] [ERR] at org.jacoco.agent.rt.internal_43f5073.PreMain.premain(PreMain.java:50)
2020-10-14T15:36:01.309-05:00 [APP/PROC/WEB/0] [ERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2020-10-14T15:36:01.309-05:00 [APP/PROC/WEB/0] [ERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2020-10-14T15:36:01.309-05:00 [APP/PROC/WEB/0] [ERR] at java.lang.reflect.Method.invoke(Method.java:498)
2020-10-14T15:36:01.309-05:00 [APP/PROC/WEB/0] [ERR] at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
2020-10-14T15:36:01.309-05:00 [APP/PROC/WEB/0] [ERR] at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
2020-10-14T15:36:01.309-05:00 [APP/PROC/WEB/0] [ERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2020-10-14T15:36:01.310-05:00 [APP/PROC/WEB/0] [ERR] at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
2020-10-14T15:36:01.310-05:00 [APP/PROC/WEB/0] [ERR] Caused by: java.net.BindException: Cannot assign requested address (Bind failed)
2020-10-14T15:36:01.310-05:00 [APP/PROC/WEB/0] [ERR] at java.net.ServerSocket.bind(ServerSocket.java:390)
2020-10-14T15:36:01.310-05:00 [APP/PROC/WEB/0] [ERR] at org.jacoco.agent.rt.internal_43f5073.output.TcpServerOutput.startup(TcpServerOutput.java:54)
2020-10-14T15:36:01.310-05:00 [APP/PROC/WEB/0] [ERR] at org.jacoco.agent.rt.internal_43f5073.Agent.startup(Agent.java:129)
2020-10-14T15:36:01.311-05:00 [APP/PROC/WEB/0] [ERR] at org.jacoco.agent.rt.internal_43f5073.Agent.getInstance(Agent.java:54)

Regards,
Ashok

Marc Hoffmann

unread,
Oct 14, 2020, 4:49:18 PM10/14/20
to JaCoCo and EclEmma Users
Hi,

I don’t know how PCF works. But probably the “IP Adress of VM” is not available where the application is installed (container?).

You can simply specify address=* to bind to any available address.

Regards,
-marc



--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/bae7028a-17dd-4eee-a4ef-a94d782943a4o%40googlegroups.com.

ashok kumar

unread,
Oct 14, 2020, 5:01:14 PM10/14/20
to jac...@googlegroups.com
Thanks Marc for quick response. 
The VM is accessible if I set output as "tcpclient" and able to capture the coverage data and would like to try with tcpserver too. I think if I try to use "address=*" agent is going to write to the VM where PCF is running and we dont want to try * because no ports on VM where PCF container is running is not allowed.

I have couple of questions - 
1. I dont see much difference between tcpserver and tcpclient modes because we are going to supply same values. May be I am missing something.


Regards,
Ashok

Marc Hoffmann

unread,
Oct 15, 2020, 1:41:31 AM10/15/20
to jac...@googlegroups.com
There is a big difference in the semantic of the address attribute:

* tcpclient: address is the IP address to connect to. This could be on any machine, as long as it is reachable
* tcpserver: address is the local IP address the agent binds to. This address must be configured on a accessible local interface, local process must have permission to open that server port

So if “because no ports on VM where PCF container is running is not allowed” is correct, you cannot use tcpserver on PCF.

Regards,
-marc





ashok kumar

unread,
Oct 15, 2020, 9:49:45 AM10/15/20
to jac...@googlegroups.com
Thanks Marc for the detailed explanation.
I thought we can provide any remote IP address tcpserver which is not true. If only local addresses are allowed, why need to make it as a parameter rather than hard code to the local address?

Regards,
Ashok

Marc Hoffmann

unread,
Oct 15, 2020, 9:51:59 AM10/15/20
to jac...@googlegroups.com
You don’t have to specify it. Loopback is default. Please have a look at the documentation:



ashok kumar

unread,
Oct 15, 2020, 9:53:46 AM10/15/20
to jac...@googlegroups.com
Thanks Marc for quick response. It's pretty much clear now.

Regards,
Ashok

Evgeny Mandrikov

unread,
Oct 15, 2020, 9:55:31 AM10/15/20
to JaCoCo and EclEmma Users
On Thursday, October 15, 2020 at 3:49:45 PM UTC+2 ashok.ob...@gmail.com wrote:
Thanks Marc for the detailed explanation.
I thought we can provide any remote IP address tcpserver which is not true. If only local addresses are allowed, why need to make it as a parameter rather than hard code to the local address?

Because one machine can have multiple IP addresses.
By default tcpserver binds to loopback ( 127.0.0.1 ) and configurable option exists to bind to other addresses.

ashok kumar

unread,
Oct 15, 2020, 10:00:43 AM10/15/20
to jac...@googlegroups.com
Thanks Evgeny Mandrikov.

Regards,
Ashok

Reply all
Reply to author
Forward
0 new messages