• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Apache 2.5 with tomcat 8 setup problem  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an apache 2.4 on Debian Jessie and I host several sites as virtual hosts.
On of these sites is running on jsp so I hav installed tomcat 8 and I use mod_jk.

My virtual host configuration file for apache is:

 

On tomcat's server.xml I have a host record as:

   


Site is running here http://www.dimitros-apartments.gr and I get a "permission denied" error where I access http://www.dimitros-apartments.gr.

I use ispconfig and for each domain, I must have a directory where apache's domains directories resides, regardless if this domain is served from apache or in my case from tomcat. So for this domain I have a corresponding directory on both apache and tomcat. I also have an index.jsp on both tomcat domain root directory and apache's domain root directory.

When I access http://www.dimitros-apartments.gr/index.jsp I get an uncompiled jsp page ( I see the source code ) on my browser.
A strange think is that this uncompiled page, is not from tomcat's directory but from apache's domain directory.

any help is appreciated.

Thanks in advance,
Christoforos


 
Christoforos Korifidis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this was resolved with the help of AndrĂ© Warnier  from tomcat mailing list.
For anyone having the same problem the solutin is to change

to

 
Bartender
Posts: 20124
103
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason for this is that "dimitros-apartments.gr" is the domain name. A URL in the Tomcat world consists of a domain part (domain name and optionally port number), a context part - which in this case identifieds which webapp within the target Tomcat server to send the request to, a servlet part, which tells Tomcat which servlet or JSP to send the request to, and a resource ID which can be used as an unnamed argument to the servlet or JSP.

Technically the servlet part is optional. If the URL, once domain and context parts are removed, matches a URL pattern defined for a servlet in the web.xml, then that's the servlet that gets the request. If it does not, there's an invisible "default servlet" that attempts to match the remaining URL path to a WAR-relative resource path of a JSP. And if neither of those attempts match, then the default servlet looks for a resource whose path matches the remaining URL and attempts to resolve it. If the resource is a directory, Tomcat generates a directory listing (unless told not to), if it's a regular "file" resource like CSS, javascript or an image, it generates suitable response headers to the response stream and copies the resource out as a response.

In your case, dimitros-apartments.gr domain name was defined to Apache as a VirtualHost, so that part is taken care of by Apache. Then the JkMount defines what the remaining parts of the URL are that will route to Tomcat. You can actually get very creative and make Apache-relative contexts that send requests to different backends. For example, ajp13_worker1 might receive all requests targeting dimitros-apartments.gr/tenants/ and send them to Tomcat Server1 and dimitros-apartments.gr/landlords/ might be JkMount'ed to be sent to Tomcat Server2. Or even to a non-Java backend server.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!