Tomcat 7 - where do I set 'system properties'? - apache

My webapp is having an issue since upgrading to Tomcat 7. My session will go null after I login and try to do anything (submitting a request). I've read that setting the following may help:
org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR=false
Does anyone know where to set this? Should this be set in web.xml, context.xml or somewhere else?
The other thing I want to check is the following:
org.apache.catalina.STRICT_SERVLET_COMPLIANCE

You can set any of the system properties in
apache-tomcat-7.0.33\conf\catalina.properties
file. Adding your entry in this file should resolve your problem.
E.g.
environment=local

You can set system properties in Tomcat by creating a setenv.sh file in /bin directory.
I did the following to set the system properties.
export JAVA_OPTS="-Dmyprojectvar.subname=value -Danothervariable=value -Danother.variable=value"
Remember:
There is no space between the export JAVA_OPTS and =. Also: the symbol & is different, use ..
Now, run your catalina.sh to start tomcat.

You can set these system properties in command line that starts Tomcat. For example, you can have file setenv.bat (on setenv.sh if you are on linux) in Tomcats bin folder with following content:
set "CATALINA_OPTS=%CATALINA_OPTS% -Dfile.encoding=UTF8 -Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=true -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"
This file is preferred way of setting properties for Tomcat.
Now, FWD_SLASH_IS_SEPARATOR is by default set to false. If you set STRICT_SERVLET_COMPLIANCE to true, the value of FWD_SLASH_IS_SEPARATOR will be also set to true (and values of some other properties). However, you can set it explicitly to false, e.g. using the following in your setenv file is fine:
-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
-Dorg.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR=false
This is also what I suggest when someone sets STRICT_SERVLET_COMPLIANCE to true, to always disable the FWD_SLASH_IS_SEPARATOR. Otherwise, the cookie Path value will be sent quoted (e.g. "\") and all browsers as of today, except Opera, do not recognize this and would e.g. fail to track the session.

THE SOLUTION:
sessionCookiePathUsesTrailingSlash="false"
We actually figured out how to solve this. It was a Tomcat 7 setting we needed to set. We placed it in server.xml, under the tag as follows:
<Context path="/test" reloadable="true" docBase="c:\webapp\test"
workDir="c:\webapp\test" sessionCookiePathUsesTrailingSlash="false"/>
When we were debugging the problem and looking at the cookies path we noticed it was putting a \ backslash after the webapp name, so for our test webapp it was setting the path to /test/ instead of /test. This caused a bunch of problems.
Has anyone else had to deal with this setting in Tomcat 7? Or have a similar problem?

If you are trying to set variables for a server running in eclipse:
Select Run > Run Configurations
Make sure your server is selected
Select Environment Tab
Click 'New' to add a new variable

Related

Error: No configuration set for [aws] s3_shard_formatter. This is a required configuration

I started seeing this error in flyte:
No configuration set for [aws] s3_shard_formatter. This is a required configuration.
What does it mean? AFAIK we set S3_SHARD_FORMATTER env variable in the image and also when registering the workflow.
It means the configuration object is not set. There are multiple ways to set it.
You can add it to the config file like so
[aws]
s3_shard_formatter=s3://bucket-name/{}/
s3_shard_string_length=2
You can set the environment variable FLYTE_AWS_S3_SHARD_FORMATTER to the value in the config example in 1. (or whatever your bucket name/path is).
However, usually when you see this error, what's actually happening is that the configuration option for where to look for the configuration file itself, is not being set correctly.
If you can get yourself into a Python repl, take a look at the following.
from flytekit.configuration.internal import CONFIGURATION_PATH
CONFIGURATION_PATH.get()
That path should be a /full/path/from/root. cat it too just to check that it's what you expect.
If that config option returns an empty string, then your registration step must be in error. Confirm which file is being used during registration.

What does this option do HTTPD_MODULES_STRIP for HTTPD?

Im using PHP buildpack https://github.com/cloudfoundry/php-buildpack for CloudFoundry. The app bring up a dummy HTTPD webserver directing traffic to defined endpoint.
In .bp-config/options.json, i could see HTTPD_MODULES_STRIP.
What does this option accomplish? Setting true or false, resulted in the same outcome. So curious, how is it being used?
If the extension has to be written to consume that option, how do i do that?
version of HTTPD 2.4.12
When modules specified in your build manifest are zipped, setting HTTPD_MODULES_STRIP to true will cause the first element of the archived file's path to be stripped before placing it in the destination directory.
Example when HTTPD_MODULES_STRIP = true: When extracting file archive.txt into destination directory intoDir, directory "some" is removed from the resulting pathname.
some/file/in/archive.txt -> intoDir/file/in/archive.txt
See ./lib/build_pack_utils/builder.py line 312 and ./lib/build_pack_utils/zips.py for more info.

Lucee Express on local Dev

I’m currently running window 7, ACF 11, and IIS 7 and would like to install Lucee express to try.
I’m having the hardest time getting Lucee to work on my local desktop. I followed this article http://www.gpickin.com/index.cfm/blog/setting-up-lucee-in-my-dev-environment-changing-ports I can’t get the Lucee welcome page to work.
I download the Lucee Express from here http://lucee.org/downloads.html
I extract the file to C:\lucee
Ran the C:\lucee\bin\startup.bat
Navigated to 127.0.0.1:8888
I get the follow message: Firefox can't establish a connection to the server at 127.0.0.1:8888
Can someone tell me what am I doing wrong? Thank you in advance for your insights.
As identified in the comments on the question: you are missing the environment variable pointing to your Java runtime (you need one of JAVA_HOME or JRE_HOME.
This can be achieved in one of a coupla ways.
Set it globally:
Control Panel > System > Advanced system settings > Environment Variables > System Variables > New...
Or set it for just that environment by editing the startup.bat file you've already been using:
SET JAVA_HOME=[path]
In both situations you need a path to either a JRE or a JDK. You say you have CF11 already installed, so you can simply point to its one, which will be a subdirectory of your CF install, as Leigh points out above. So something like:
SET JRE_HOME=D:\apps\Adobe\ColdFusion\11\express\jre
If you have a Java JDK installed instead and want to use that, use JAVA_HOME instead of JRE_HOME, eg:
SET JAVA_HOME=D:\apps\Oracle\Java\jdk\1.8.0_60
As these things can be installed anywhere, you'll just need to locate 'em and use the path accordingly. You want to point it to the top level directory of your JRE or JDK, which contains the bin subdirectory.

How to run WildFly with standalone-full.xml from IntelliJ IDEA?

I'm trying to run Wildfly 8.0 from Intellij IDEA. When starting WildFly through commmand-line I can use the -c standalone-full.xml parameter to use the standalone-full.xml configuration file. How can I specify this when running WildFly from Intellij IDEA?
In my opinion switch -c standalone-full.xml is not a VM Option so I will post a little bit different solution:
In the Run/Debug configuration for your server in the tab Startup/Connection you have the ability to set Startup script: On the end of line there is checkbox Use default. Please unselect it and paste on the end of the input -c standalone-full.xml
Adding -Djboss.server.default.config=standalone-full.xml to VM_OPTIONS is the equivalent of running standalone -c standalone-full.xml from a shell
As said by Mike Holdsworth -Djboss.server.default.config=standalone-full.xml works perfectly.
But there is another advantage over the -c standalone-full.xml method.
When you rename your standalone.xml file to create custom configuration files for multiple environments. Like env1.xml, env2.xml, etc.
If you use -c env1.xml, Intellij will give you the following message:
Error: HTTP management port configuration not found.
So you have to put a basic standalone.xml who will be overriden at the startup by the one you give with the -c option.
The -Djboss.server.default.config=env1.xml will prevent it.
Look out for different startup scripts for "Run" and "Debug" in Intellij IDEA. If you don't uncheck "Use default" in both of them then you can end up with two different profiles on "Run" and "Debug". It is easy to forget and annoying to figure it out.
If you want to run it by default w/o passing any command line parameters than go
to standalone.(bat|sh)
Append to the SERVER_OPTS variable: --server-config=standalone-full.xml
At least now you'll run it in full mode from any place (ide, service, command line)
I'm on a cross-platform team and we share our run configs. Modifying the startup script could cause problems (other teammate's paths and startup scripts are different), so my solution was:
Made a backup of standalone.xml
Renamed standalone-full.xml to standalone.xml
This doesn't answer the OP's question directly, but may be helpful for folks.
In the Run/Debug configuration for your server you have the ability to set VM options. You can put your switch in there. You may have problems however with jboss identifying the correct path for the file, so you may have to play with that a little bit before it works for you.
Run -> Edit configurations -> Click '+' in the top left corner -> JBoss Server -> Local
There you can configure your JBoss instance and set VM options and so on.

How to specify JAVA_OPTS for solr?

I am using on apache solr3.6 (naive user) and have data in the multicore of solr folder.
D:\setup\apache-solr-3.6.0\example\multicore
The current version of tomcat I am using has startup.bat in its bin folder so I specified JAVA_OPTS in it as below:
rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs
set "JAVA_OPTS=%JAVA_OPTS% -Dsolr.solr.home=D:\setup\apache-solr-3.6.0\example\multicore"
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
:end
However I recently downloaded a new version of tomcat which contains no startup.bat in it but some .exe file (may be tomcat.exe) instead, double clicking which will start the tomcat server.
So how do I specify JAVA_OPTS and -Dsolr now?
As #Bhanu said...
Go to tomcat istallation folder, inside Apache Software Foundation\Tomcat 6.0\bin you'll find tomcat6w.exe run it. It will open tomcat configuration window
Open java tab and specify the multicore path inside java options as -Dsolr.solr.home=D:\setup\apache-solr-3.6.0\example\multicore
For setting up Solr Home option with Tomcat refer to details.
Also, more information would be available at SolrTomcat
In newer versions of tomcat say tomcat7, you will find tomcat7w.exe in tomcat/bin. Run it select Java tab and in Java Options pane write your path.
It is quite easy compared to JNDI way.