Escape characters in VM Option

Answered

Hello,

I have a Java app to run in a Tomcat server. I have to pass some arguments to the VM of Tomcat. One of them is:

-Dhttp.nonProxyHosts=127.0.0.1|localhost|*.my.fqdn.com

(Notice the "|" characters").

 

Sadly this parameter prevent the Tomcat startup and I got an error saying "localhost is not recognized as a command (...)"

I've tried multiple versions of this line but none of them are working. Eg:

"-Dhttp.nonProxyHosts=127.0.0.1|localhost|*.my.fqdn.com"
-Dhttp.nonProxyHosts="127.0.0.1|localhost|*.my.fqdn.com"
-Dhttp.nonProxyHosts=127.0.0.1\|localhost\|*.my.fqdn.com
-Dhttp.nonProxyHosts="127.0.0.1\|localhost\|*.my.fqdn.com"
...

Thank you for the help

0
8 comments

Hello,

Try escaping pipes with a cap like this:

-Dhttp.nonProxyHosts=\"127.0.0.1^|localhost^|*.my.fqdn.com\"

See also IDEA-159955.

1
Avatar
Permanently deleted user

It's working with the caps, thank you.

0
Avatar
Permanently deleted user

@...

In the end, with the line you provided Tomcat is able to start without error but the value of the option (nonProxyHosts) is not used by the VM !

I tested by removing the 127.0.0.1 and localhost values, leaving only the *.my.fqdn.com without caps & pipes and in this case the VM uses the option.

 

Do you have any idea ?

 

VM used is:

java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) Client VM (build 25.191-b12, mixed mode, sharing)

 

 

0

What if you try the following syntax:

-Dhttp.nonProxyHosts=127.0.0.1^|localhost^|*.my.fqdn.com
0
Avatar
Permanently deleted user

Nope, this one is not working. I'm wondering if on windows the double quotes should also take in the param key but I'm unable to find the right syntax :(

0

As a workaround, you can try adding the option directly to the <server-home>/conf/catalina.properties file like this:

http.nonProxyHosts=127.0.0.1|localhost|*.my.fqdn.com

Or adding the following line to the <server-home>/bin/catalina.bat file:

set "JAVA_OPTS=%JAVA_OPTS% -Dhttp.nonProxyHosts=127.0.0.1^|localhost^|*.my.fqdn.com"
0
Avatar
Permanently deleted user

Yes it's what I did. I created a setenv.bat in <server-home>/bin/setenv.bat

set "CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.nonProxyHosts=127.0.0.1^|localhost^|*.my.fqdn.com"

But I would like to find the right spelling for this option in Intellij.

0

Thanks for confirming.

I created a new bug report for this on our issue tracker: IDEA-250881, and asked the responsible developer to take a look.

Feel free to subscribe to the ticket for updates. See this article if you are not familiar with YouTrack.

0

Please sign in to leave a comment.