top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why Apache/Tomcat (by default) does not allow symbolic linking except in top apache/lib directory?

+1 vote
5,517 views

Apache/Tomcat (by default) does not allow symbolic linking (nice as it can cross mounted file systems) except in the top apache/lib directory. I use hard links in the Application/WEB-INF/lib directories to reduce copying and help me manage things.

HOWEVER, some applications have special needs - e.g. pictures. You don't want to always distribute these with the release of the application (Application.war file), so symbolic links are the way to go (except for MS land, sorry). The nice solution to this is:

.../webapps/Application/WEB-INF/context.xml
which must contain at least the two below lines:

However this allows ALL symbolic linking in the Application directory. I agree with the developers that this is dangerous.

Is there some way to allow linking in just ONE sub-directory of the Application?
- e.g. .../webapps/Application/images

This would allow all I need to have local images for the application without endangering other things using a symbolic link.

posted Dec 15, 2013 by Sheetal Chauhan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Hmmm - I use JNDI for connections and you lost me with extra paths - although it appears this is exactly what I want.

extraResourcePaths="/WEB-INF/classes=/Users/theuser/mywebapp/target/classes,/pictures=/Users/theuser/mypictures,/movies=/Users/theuser/mymovies"/>
extraResourcePaths="/WEB-INF/classes=/Users/theuser/mywebapp/target/classes,/pictures=/Users/theuser/mypictures,/movies=/Users/theuser/mymovies"/>

This is exactly what I was thinking, I will start digging to learn how to use properly.

1 Answer

+1 vote

If you're deploying in the appBase directory, then this should work:

Place this in either META-INF/context.xml of your web application, or in $CATALINA_BASE/conf/[hostname]/[appname].xml

Modify the above to fit your requirements. Note that the META-INF/context.xml file is no longer copied to $CATALINA_BASE/conf/[hostname]/[appname].xml by default.

Read the following to understand how these two interact. http://tomcat.apache.org/tomcat-7.0-doc/config/host.html

(search for copyXML on the above page).

answer Dec 15, 2013 by anonymous
Similar Questions
0 votes

I am trying to find out through registry checking whether or not Apache Tomcat 9.0.8 is already installed or not. If the below registry is not there, then my program installs Apache Tomcat 9.0.8 installer otherwise it moves on to other installation and completes. It's kind of prerequisite check program.

HKEY_LOCAL_MACHINESOFTWAREApache Software FoundationTomcat9.0Tomcat9

However, everytime program just proceeds to install Tomcat despite it is already installed? Am I checking wrong registry?

+2 votes

I have a domain domain.com that points to a server. Now I have a subdomain sub.domain.com that points to another server that has Apache running and Tomcat. I want this subdomain to point to a application deployed on the Tomcat instance through ajp.

I have configured the following in httpd.conf:

   ServerName sub.domain.com 
   ProxyRequests Off
   ProxyPreserveHost On  
   Order deny,allow Allow from all  
   ProxyPass / ajp://localhost:8009/ 
   ProxyPassReverse / ajp://localhost:8009/   

and in Tomcats server.xml:

But when I go to sub.domain.com the url changes to otherdomain.com and shows me a php website running in Apache and declared as following in httpd.conf:

 DocumentRoot /var/www/html/otherdomain.com 
 ServerName otherdomain.com 
 ServerAlias www.otherdomain.com 

I only get it to work when I change the port in the sub.domain.com virtual host declaration to for example 8001. Then when I go to sub.domain.com:8001 it shows my tomcat application (ROOT.war) as expected.

So my question is: what could be going wrong that it doesn't work with the default port 80? I can't find any configuration that is causing this, but I'm probably missing something or is my virtual host configuration wrong?

+3 votes

We are using Apache Tomcat6 as application server for the website. Two virtual servers are configured for this and each one of the servers had 2 CPUs and 4 GB RAM until 26 JAN 2015 when both Tomcat servers crashed. So we added some resources to the virtual servers (Now it is 8CPUs and 8GB RAM each box) and increased maxThread parameter of tomcat from default (which is 200) to 300 and restarted Tomcat servers. OS of the systems are Linux6.5 .

We need to know what the relationship between thread and memory is. If N numbers of requests coming to the server how many threads can process that and how much memory is required for that. Actually we are targeting to increase the maxThread count upto 500 but we need to calculate that, to process this much of threads what will be the best Hardware configuration?

Please let us know if any more information is required for the same.

+1 vote

We have a set up like Apahce (80,443) redirects the request to Tomcat (8080) using mod_jk.

The new requirement is to route the request from the same apache to another tomcat (8090). Hence I made the different config file for apache with different ports (86,4444) and different worker for mod_jk which routes the request to tomcat.

Now the issue is when I hit the url http://:86 and after providing the credentials, it is redirecting to https://:86 and throwing the below error.

Error in browser:

Secure Connection Failed

An error occurred during a connection to x.x.x.x:86. SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)

Error in logs:

"x16x03x01" 501

[Thu Jan 08 08:22:46 2015] [debug] ssl_engine_io.c(1523): OpenSSL: I/O error, 11 bytes expected to read on BIO#1bf568 [mem: 1f3930]
[Thu Jan 08 08:22:46 2015] [debug] ssl_engine_kernel.c(1806): OpenSSL: Exit: error in SSLv2/v3 read client hello A
[Thu Jan 08 08:22:46 2015] [info] (70014)End of file found: SSL handshake interrupted by system [Hint: Stop button pressed in browser?!]
[Thu Jan 08 08:22:46 2015] [info] Connection to child 3 closed with abortive shutdown(server pritoolvca1.sw.ericsson.se:443 [2], client 153.88.164.216)
[Thu Jan 08 08:23:53 2015] [error] [client 172.17.136.153] Invalid method in request x16x03x01

Could you please suggest where it might went wrong and the way forward..

...