Hello, I've been struggling with use case which I could use some advice. I'm migrating a multi domain, CDS published static file instance.
In short, Tomcat is deployed with a bare minimum war containing the jar dependencies for the JSP and the web.xml. All the other content, we used a CMS do deploy inside the unpacked war webapps folder of a particular site. The drawback of that approach was that, if I needed to redeploy a new war, I had to unpack it manually (as an automatic unpack would delete the files deployed through the CMS along with the file from the previously unpacked WAR). With Tomcat 8, I was hoping to use the new PreResources and PostResource to move the static content away from the webapps, into it's own droppath. On my first attempt, I had this setup for my context ---------- <Host name="www.example1.com<http://www.example1.com>" appBase="webapps/example1" unpackWARs="true" autoDeploy="false"> <Context path="" reloadable="false" workDir="work/example1"> <JarScanner scanBootstrapClassPath="false"/> <Resources> <PreResources className="org.apache.catalina.webresources.DirResourceSet" readOnly="true" webAppMount="/" base="/home/tomcat/CMS/example1.com" /> </Resources> </Context> </Host> ------------------- This worked fine to access static resources (images, css, js) deployed into "/home/tomcat/CMS/example1.com" . However, for some reason, any JSP file deployed inside that folder would crash, unable to access the dependencies Jar unpacked inside the appBase. I thought, from reading the documentation, that the classpath from WEB-INF/lib and WEB-INF/class was always available. But from the NoClassDefFound errors, I got, it doesn't seem to be the case. ------------------- SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deploy ed with this application] with root cause org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application ------------------- So I tried adding the folder of my appBase manually as a PostResources. ------------------- <Host name="www.example1.com<http://www.example1.com>" appBase="webapps/example1" unpackWARs="true" autoDeploy="false"> <Context path="" reloadable="false" workDir="work/example1"> <JarScanner scanBootstrapClassPath="false"/> <Resources> <PreResources className="org.apache.catalina.webresources.DirResourceSet" readOnly="true" webAppMount="/" base="/home/tomcat/CMS/example1.com" /> <PostResources className="org.apache.catalina.webresources.DirResourceSet" readOnly="true" webAppMount="/" base="${catalina.base}/webapps/example1" /> </Resources> </Context> </Host> ------------------- With this setup, the JSP deployed inside /home/tomcat/CMS/example1.com are able to access the web.xml and library from the appBase, I would no longer receive the error and the pages would display. However, Tomcat is validating the Resources *BEFORE* unpacking the War file into the appBase. As a result, if I start Tomcat from an undeployed state (example1.war exists under ${catalina.base}/webapps/), tomcat crash saying that the folder "${catalina.base}/webapps/example1" does not exist. If I create the folder and deploy the war manually, tomcat work. But that leave me to the same point as I was with Tomcat 7: I need to manually unpack my war. ------------------- SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [StandardEngine[Catalina].StandardHost[www.example1.com<http://www.example1.com>].StandardContext[]] .... Caused by: java.lang.IllegalArgumentException: The directory specified by base and internal path [/home/tomcat/apache-tomcat-8.0.32/webapps/example1]/[] does not exist. at org.apache.catalina.webresources.DirResourceSet.checkType(DirResourceSet.java:253) at org.apache.catalina.webresources.AbstractFileResourceSet.initInternal(AbstractFileResourceSet.java:145) at org.apache.catalina.webresources.DirResourceSet.initInternal(DirResourceSet.java:261) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) ... 12 more ------------------- At this point, I'm not sure where to look. I don't know why my PreResources JSP are not seeing the lib from my appBase, nor how to configure Tomcat to set them without a manual intervention,. Tomcat Version 8.0.32 OS: Red Had 6.5 Java 1.8.0_65 Thanks -- Philippe Busque 1111, rue St-Charles Ouest, Tour Est, bureau 255 Longueuil (Québec) Canada J4K 5G4 Tél. : 450-449-0102 ext. 3017 Télec. : 450-449-8725 Ce message et les fichiers d’accompagnement transmis avec celui-ci s’adressent expressément au(x) destinataire(s) et peuvent contenir des renseignements confidentiels et privilégiés. Si vous recevez ce message par erreur, veuillez en aviser immédiatement l’expéditeur par courrier électronique. Veuillez également ne pas en prendre connaissance et en supprimer toutes les copies immédiatement. Technologies Interactives Mediagrif Inc. et ses filiales n’acceptent aucune responsabilité à l’égard des opinions exprimées dans le message ou des conséquences de tout virus informatique qui pourrait être transmis avec ce message. Ce message fait également l’objet d’un copyright. Il est interdit d’en reproduire, adapter ou transmettre quelque partie que ce soit sans le consentement écrit du détenteur du copyright. This email and any files transmitted with it are solely intended for the use of the addressee(s) and may contain information that is confidential and privileged. If you receive this email in error, please advise us by return email immediately. Please also disregard the contents of the email, delete it and destroy any copies immediately. Mediagrif Interactive Technologies Inc. and its subsidiaries do not accept liability for the views expressed in the email or for the consequences of any computer viruses that may be transmitted with this email. This email is also subject to copyright. No part of it should be reproduced, adapted or transmitted without the written consent of the copyright owner.