TOMCAT: quote < ' > in CATALINA_HOME environment variable causing load error? - windows

I'm trying to install tomcat as a service using service.bat in the following path :
C:\Program Files\text with' quote\Tomcat
but I keep getting the following error :
java.io.FileNotFoundException: C:\Program Files\text with quote\Tomcat\conf\logging.properties; (The system cannot find the path specified)
as you can see from the error message the ' is being ignored and thus keeping some files from being found/loaded properly.
If I switch to a path without a quote, everything works well. Is there a way around this as I need to include a ' in the path?

Your problem comes from the way Procrun parses its command line parameters. In those parameters which accept lists of values (++DependsOn, ++Environment, ++JvmOptions, ++JvmOptions9, ++StartParams and ++StopParams) single quotes ' are stripped after the parameter value has been split into single values. There is no way to quote them (cf. source code).
Therefore the ++JvmOptions parameter used in service.bat is interpreted as follows (one value per line):
-Dcatalina.home=C:\Scarlett oHara;-Dcatalina.base=C:\Scarlett oHara
-Dignore.endorsed.dirs=C:\Scarlett oHara\endorsed;-Djava.io.tmpdir=C:\Scarlett oHara\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Scarlett oHara\conf\logging.properties;
You might notice that some entries are joined by ;, due to the ' unintentional quoting.
The only way to fix this is to start Prunmgr (the executable renamed as tomcat*w.exe) and fix them in the "Java" tab:
-Dcatalina.home=C:\Scarlett o'Hara
-Dcatalina.base=C:\Scarlett o'Hara
-Dignore.endorsed.dirs=C:\Scarlett o'Hara\endorsed
-Djava.io.tmpdir=C:\Scarlett o'Hara\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Scarlett o'Hara\conf\logging.properties;
or work directly on the HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0 registry keys.
See also:
a similar problem due to quoting: Adding multiple values to an environment in registry and retrieving in Java application

Related

INFO: Could not find files for the given pattern(s) doing `where git`

I have git installed under C:\Program Files\Git\ I do the following from a setupenv.bat:
set PATH="C:\Program Files\Git\bin";%PATH%
So doing the following I can see it:
echo %PATH%
The following will then work:
git --version
>git version 2.21.0.windows.1
But this won't:
where git
>INFO: Could not find files for the given pattern(s)
The issue, is most likely that you have surrounded your location string with double-quotes.
The locations listed within the %Path% string value content are delimited with semi-colons, for that reason your intended addition to that value content should not be double-quoted.
If you take a look at the existing %Path% content, by typing Path at the Command Prompt, and pressing the ENTER key, you'll note the absence of double-quotes, and most likely that there are paths which include space characters.
The solution therefore is to change your set command from:
set PATH="C:\Program Files\Git\bin";%PATH%
to:
set PATH=C:\Program Files\Git\bin;%PATH%
However, I will add that the recommended syntax for the Set command is:
Set "VariableName=Variable Value"
So you should really write it thus:
Set "PATH=C:\Program Files\Git\bin;%PATH%"
It should be noted too that the locations listed within the value of Path are searched in order, which means that you should consider carefully whether your new location should be located and therefore searched first, or last. The precedence could be important depending upon what else is being done within that script.As the Path value string should already be semi-colon terminated, you could just as easily locate it at the end:
Set "Path=%Path%C:\Program Files\Git\bin;"
Also note that there is already an environment variable available for the normal \Program Files\ directory, so you could additionally incorporate that instead:
Set "Path=%ProgramFiles%\Git\bin;%Path%"

Set spark.local.dir to different drive

I'm trying to setup standalone Spark on Windows 10. I would like to set spark.local.dir to D:\spark-tmp\tmp, as currently it appears to be using C:\Users\<me>\AppData\Local\Temp, which in my case is on an SSD drive which might not have enough space given the size of some datasets.
So I changed the file %SPARK_HOME%\conf\spark-defaults.conf to the following, without success
spark.eventLog.enabled true
spark.eventLog.dir file:/D:/spark-tmp/log
spark.local.dir file:/D:/spark-tmp/tmp
I also tried to run %HADOOP_HOME\bin\winutils.exe chmod -R 777 D:/spark-tmp, but it didn't change anything.
The error that I get is the following:
java.io.IOException: Failed to create a temp directory (under file:/D:/spark-tmp/tmp) after 10 attempts!
If I start the path with file://D:/... (note the double slash) nothing changes. If I remove the scheme at all, a different exception says that the scheme D: is not recognized.
I also noticed this warning:
WARN SparkConf:66 - In Spark 1.0 and later spark.local.dir will be overridden by the value set by the cluster manager (via SPARK_LOCAL_DIRS in mesos/standalone and LOCAL_DIRS in YARN).
So I tried to put the following line in %SPARK_HOME%\conf\spark-env.sh:
SPARK_LOCAL_DIRS=file:/D:/spark-tmp/tmp
If I put this line and comment the spark.local.dir line in the .conf file, Spark works perfectly, but the temporary files are still saved in my AppData\Local\Temp folder. So the SPARK_LOCAL_DIRS line is not read.
What's strange is that, if I let it run, it actually puts logs in D:/spark-tmp/log, which means that it's not a problem of syntax or permissions.
On windows you will have to make those environment variables
Add the key value pair
SPARK_LOCAL_DIRS -> d:\spark-tmp\tmp
to your systems environment variables

Atom editor & Processing - 'processing-java' not recognised

I am trying to use bleikamp's Processing package to run Processing sketches from the Atom editor. The package has installed correctly, but running a sketch produces the below error:
'processing-java' is not recognized as an internal or external command, operable program or batch file.
I have added the path to my Processing directory to the PATH environment variable. Can anyone suggest why this is not working?
The problem is almost certainly to do with your PATH. As you've checked the Processing path is correct, there may be something preventing it from being recognised (there are some known issues, such as the PATH variable being too long or having invalid characters).
Solution 1:
Try using FixPath to fix some of the more common problems.
Solution 2:
Try modifying the processing package itself to point directly to processing-java.exe (it points to the PATH variable by default).
In Atom's Settings > Packages, select the processing package and click on 'View Code'.
Make a backup of \lib\processing.coffee to be safe.
In \lib\processing.coffee, search for the following code (probably near the top):
module.exports = Processing =
config:
'processing-executable':
type:"string",
default:"processing-java"
Modify the value of default to point to the exact Processing directory and processing-java.exe, for example:
module.exports = Processing =
config:
'processing-executable':
type:"string",
default:"c:\\program files\\processing\\processing-java.exe"
As Chris rightly points out in the comments below, backslash \ is an escape character in JavaScript and CoffeeScript, so itself needs to be escaped in the file path (hence the double-backslashes \\).
You have to install processing-java command line tool.
In processing, go to Tools -> Install "processing-java"

MSDOS - "The system could not find the file specified"

I am trying to copy the contents of a log file to another log file using this command:
type \\server\f$\Test path\Test.log >> \\server2\f$\Logs\Testpath\Test.log
This has always worked in the path, but recently I have changed the location (path) to Test.log. The path is slightly longer. I now get an error:
The system could not find the file specified
I have googled this statement and the common responses are: 1) check the filename exists, 2) check the filename is not corrupt 3) Check the server is online.
I have done all of this. Is there a restriction on the number of characters a path can have? If there is then is there a workaround?
UPDATE 12/07/2012 09:49 GMT
Adding quotes around the path seems to resolve the problem. Why does adding quotes resolve the problem?
The problem was that the source path had a space in it. Adding quotes around the path resolved the problem.
Type is to examine a file, not to copy.
Also, if server is an actual server and not a folder, then you should be using two slashes (\server\share)
Example:
copy \\server\f$\Sourcepath\Test.log \\server2\f$\Logs\Destpath\Test.log /y
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true

How to install tomcat with a specific PATH under Windows?

I have the following Code:
tomcat5.exe //IS//%SERVICE_NAME% --StartPath "%BASE_DIR%\bin" --Jvm "%JAVA_HOME%\bin\%JAVA_MODE%\jvm.dll" --StartClass org.apache.catalina.startup.Bootstrap --StopClass org.apache.catalina.startup.Bootstrap --StartParams "-config;%CONFIG%;start" --StopParams stop --Startup auto
tomcat5.exe //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%#-Dcatalina.home=%CATALINA_HOME%#-Djava.endorsed.dirs=%CATALINA_HOME%\common\endorsed#-Xrs#-Djava.library.path=%DLL_DIR%#-DimageservicePath=%imageservicePath%" --StartMode jvm --StopMode jvm
tomcat5.exe //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp"
tomcat5.exe //US//%SERVICE_NAME% --JvmMx %MEMORY% --JvmMs %MIN_MEMORY%
tomcat5.exe //US//%SERVICE_NAME% --Environment "PATH=.\;c:\path\bin"
I need to specify a special PATH, because some native-code loading issues.
My problem is, that the service-installer will change provided PATH:
http://tomcat.apache.org/tomcat-5.5-doc/windows-service-howto.html
--Environment
List of environment variables that will be provided to the service in the form key=value. They are separated using either # or ; characters
I need to specify a Windowes PATH with two locations: PATH=.;c:\path\bin
The path will be stored within the registry:
PATH=.
c:\path\bin
it should be:
PATH=.;c:\path\bin
It works as described, so I think I missed something, but I did not find anything about how to set the PATH and solve this issue...
PS:
I know I'm using an outdated version of tomcat.
Well, after I downloaded the source and figured out, that the apache-commons procrun deamon is used and I finally found the solution. The documentation at the tomcat project wasn't complete:
http://commons.apache.org/daemon/procrun.html
++Environment
List of environment variables that will be provided to the service in the form key=value. They are separated using either # or ; characters. If you need to embed either # or ; character within a value put them inside single quotes.
The last sentence lead to the solution:
"%EXECUTABLE%" //US//%SERVICE_NAME% --Environment "PATH='%PATH%'"

Resources