You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2023/03/02 15:29:36 UTC

[Bug 66507] New: Catalina version command not honoring JAVA_OPTS variable

https://bz.apache.org/bugzilla/show_bug.cgi?id=66507

            Bug ID: 66507
           Summary: Catalina version command not honoring JAVA_OPTS
                    variable
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: eric.hamilton@ngc.com
  Target Milestone: -----

The catalina version command is ignoring the JAVA_OPTS variable, in contrast to
the variable documentation.  This is observed in both the .sh and .bat scripts.


Documentation of JAVA_OPTS:
"... Include here and not in CATALINA_OPTS all options, that should be used by
Tomcat and also by the stop process, the version command etc. ..."


Linux use case:
export JAVA_OPTS=-XshowSettings
catalina.sh version

Windows use case:
SET JAVA_OPTS=-XshowSettings
catalina.bat version

Observed the catalina version command did not output additional JVM settings
information.

Expected the catalina version command to honor the configured JAVA_OPTS
variable.


Suggested catalina.sh fix:
elif [ "$1" = "version" ] ; then

    "$_RUNJAVA" "$JAVA_OPTS" \
      -classpath "$CATALINA_HOME/lib/catalina.jar" \
      org.apache.catalina.util.ServerInfo

else


Suggested catalina.bat fix:
:doVersion
%_EXECJAVA% %JAVA_OPTS% -classpath "%CATALINA_HOME%\lib\catalina.jar"
org.apache.catalina.util.ServerInfo
goto end

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66507] Catalina version command not honoring JAVA_OPTS variable

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507

--- Comment #4 from Eric Hamilton <er...@ngc.com> ---
Thomas,
Can you try moving the agent configuration to the CATALINA_OPTS variable?

The CATALINA_OPTS variable is only used by the commands that start the Tomcat
server, while the JAVA_OPTS variable is used for all Java commands.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66507] Catalina version command not honoring JAVA_OPTS variable

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507

--- Comment #3 from Thomas Starlinger <Th...@clarivate.com> ---
Hi.

We're using an RMI agent to let JConsole connect to the Tomcat JVM. The agent
is configured via JAVA_OPTS. Now, if I try to start version.sh resp.
catalina.sh the system tries to start the agent which in turn tries to open a
port and that fails because the port is already in use.

-------------8<-------------8<-------------8<-------------
Create RMI registry on port 8112
Exception in thread "main" java.lang.reflect.InvocationTargetException
 :
Caused by: java.rmi.server.ExportException: Port already in use: 8112; nested
exception is:
        java.net.BindException: Address already in use
 :
-------------8<-------------8<-------------8<-------------

Is there any method to do this without triggering the BindException?

Regards

Thomas

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66507] Catalina version command not honoring JAVA_OPTS variable

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507

--- Comment #1 from Eric Hamilton <er...@ngc.com> ---
Updated suggested catalina.sh fix to conform with execution style of other
commands:
elif [ "$1" = "version" ] ; then

    eval "\"$_RUNJAVA\"" "$JAVA_OPTS" \
      -classpath "\"$CATALINA_HOME/lib/catalina.jar\"" \
      org.apache.catalina.util.ServerInfo

else

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66507] Catalina version command not honoring JAVA_OPTS variable

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507

Han Li <li...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Han Li <li...@apache.org> ---
Thanks for reporting this.

Fixed in:
- 11.0.x for 11.0.0-M5 onwards
- 10.1.x for 10.1.8 onwards
- 9.0.x for 9.0.74 onwards
- 8.5.x for 8.5.88 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66507] Catalina version command not honoring JAVA_OPTS variable

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66507

--- Comment #5 from Thomas Starlinger <Th...@clarivate.com> ---
(In reply to Eric Hamilton from comment #4)
> Thomas,
> Can you try moving the agent configuration to the CATALINA_OPTS variable?
> 
> The CATALINA_OPTS variable is only used by the commands that start the
> Tomcat server, while the JAVA_OPTS variable is used for all Java commands.

That seems to work. Thank you very much for the pointer

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org