James,

On 9/1/2016 11:36 AM, James H. H. Lampert wrote:
> Ladies and Gentlemen:
> 
> One of our Tomcat servers (refreshed from
> apache-tomcat-7.0.67-windows-x86.zip) is running AS A SERVICE on a
> Windows box.
> 
> And we need to set JVM Options of
>  -Djavax.servlet.request.encoding=UTF-8
>  -Dfile.encoding=UTF-8
>  -Djava.awt.headless=true
> 
> Unlike IBM Midrange boxes, on which I can, with a simple OS command,
> list all the JVMs currently running on the system, and look up the
> arguments, environment variables, system properties, &c, I can't find
> any way to verify the JVM arguments (this box has only a JRE, not a
> JDK), other than what gets sent to the log file. I even tried installing
> a trial of JProfiler, but if checking arguments is in there, it's
> well-hidden!
> 
> I just tried adding a "setenv.bat" to the "bin" directory, containing
> 
>> SET CATALINA_OPTS=-Djava.awt.headless=true
>> -Djavax.servlet.request.encoding=UTF-8 -Dfile.encoding=UTF-8
> 
> and after stopping and starting the service, even after rebooting the
> Windows box, "headless" cannot be found in the log file, and neither can
> I find "UTF."
> 
> WHAT COULD BE GOING WRONG HERE?
> 
> -- 
> JHHL

I'm not a Windows person, but here's how I did it:

1. Do a normal installation of Tomcat with service.bat
   service.bat install
2. Start up the Windows monitor service
   tomcat7w.exe
3. Navigate to the Java tab
4. Select the Java Options: window
5. Add your additional requirements 1 per line:
   -Djavax.servlet.request.encoding=UTF-8
   -Dfile.encoding=UTF-8
   -Djava.awt.headless=true
6. Start Tomcat
7. Observe logs in %CATALINA_BASE%\logs
   tomcat7-stderr.2016-09-01.log

INFO: Command line argument: -Djavax.servlet.request.encoding=UTF-8
INFO: Command line argument: -Dfile.encoding=UTF-8
INFO: Command line argument: -Djava.awt.headless=true

Now you could probably add these with tomcat7 //US//Tomcat7 with the
suitable ++JvmOptions arguments, but it looks like it replaces the
original ++JvmOptions. That means you'd have to duplicate the original
options (see service.bat) as well as add the above three options.

tomcat7w.exe seems easier, but if you're doing unattended installations
modifying service.bat (or creating your own tomcat7.exe command line)
might be easier.

See the following:

https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html

as a reference.

. . . just my two cents
/mde/


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to