java - How do I make JVM use the IPv4 stack in isolated scope? -
i have application runs on jvm/tomcat , machine(s) runs on have ipv6 stack enabled. i'm trying make request machine supports ipv4 , jvm prefer ipv6 stack make request (i'm using apache httpclient
class make request).
i know -djava.net.preferipv4stack=true
property reasons won't go here, can not pass when jvm starts. can't set programatically (for short period of time) so:
system.setproperty("java.net.preferipv4stack", "true");
...since potentially affect other threads running on jvm/tomcat instance (as understood this question , others).
so question is, how make single request go through ipv4 stack (meaning use ipv4 interface, not connect ipv4 endpoint)?
i thought using curl (via exec or via libcurl binding) since curl doesn't use jvm @ all.
any other ideas?
flexo's mention valid!
eventually realized real problem not jvm make request form ipv6 interface, impossible since proxy have dns entry (as flexo pointed out).
the real problem typo in proxy url, made jvm fail resolve proxy host; threw me off fact exception thrown inet6address class (probably because jvm did not yet know fact proxy ipv4 only).
i fixed typo! proxy resolved , request made via ipv4. thank you!
Comments
Post a Comment