How to Setup Tomcat Application+JSP in Different Path Outside Root?

I recently installed Bitnami Tomcat Stack and it runs fine.

However, I have Tomcat application that needs to run outside of the Tomcat ../webapp/ROOT folder. The folder I would like to put my application is in the path ../webapp/MYAPP instead.

I have set my application's docBase and work folders correctly so the Tomcat application can run fine. However, when I try to access .jsp files of my webapp using my web browser, I get a 404 not found error.

Is there a way to specify that the JSP files run from ../webapp/MYAPP instead?

Also, how would I access the JSP files? with ajp proxy? Or

BTW -- I am also running PHP on the same server.

Thanks for any help you can give me.

Hi, I think this guide could helps for you: How to connect Apache server with Tomcat

If you have your application in apache-tomcat/webapps/myapp, the application will be available at http://domain:8080/myapp. If you have an Apache server already running, you can use the AJP protocol to publish your application at http://domain/myapp.

Thanks Beltran for the help. I really appreciate it.

What is strange (and I've struggled with it on the Bitnami stack) is that if I custom install Tomcat, then my app runs just fine. On Ubuntu and on CentOS-- even on Windows.

But over on the Bitnami Stack, JSP files don't run properly with the application configuration I have.

Maybe these details can help:

My Stack and Application Folder Structure:

  1. I installed Tomcat stack into /opt/bitnami.
  2. The Tomcat folder is in /opt/bitnami/apache-tomcat.
  3. My application is in: /opt/bitnami/apache-tomcat/webapps/MyApp
  4. I have some test JSP files in: /opt/bitnami/apache-tomcat/webapps/MyApp/WEB-INF/jsp/test/

I have put a MyApp.xml into /opt/bitnami/apache-tomcat/conf/Catalina/localhost with the following:

<Context path="/MyApp" reloadable="true" docBase="/opt/bitnami/apache-tomcat/webapps/MyApp" workDir="/opt/bitnami/apache-tomcat/webapps/MyApp/work">

In my ../MyApp/WEB-INF folder, there is an applicationContext.xml that uses spring framework and I have the following in the file:

<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
    <property name="prefix" value="/WEB-INF/jsp/"/>
    <property name="suffix" value=".jsp"/>

All JSP files can be loaded from these folders:


And for my own app within MyApp folder, JSP can be loaded from these folders:


But JSP files won't run from:

or any subfolder under WEB-INF

Any help would be greatly appreciated. I tried a lot of different combinations, but still stuck here.

Have you checked that the exact same configuration works on other Tomcat installation? The difference with the BitNami Tomcat stack is that is uses Apache as a front end. It is likely a configuration issue, have you check the Apache and Tomcat log files?

It was a user/permission issue. Sorry to bother you with this. Always something simple :-)

Hi you said that it is a user/permission issue. I am facing the same problem. Would you let me know the solution to the issue?. Regards.

Hello @rrdesai64,

Could you provide us with more details about the issue? Where are you placing your app? What SO are you using? Are you getting a 404 error too?

Also, have you checked that the exact same configuration works on other Tomcat installation? Bitnami Tomcat stack uses Apache as a front end, but you should not find another difference. Have you checked Apache and Tomcat log files?