0
votes

I am unpacking the application war manually in tomcat as I am specifying the context for the application in $CATALINA/conf/Catalina/host/ROOT.xml. The docBase is specified in here,

    <?xml version="1.0"?>
    <Context 
    path="" 
    docBase="/opt/tomcat/tc3/webapps/TC3"
    reloadable="true"
    />

When the same war is unpacked by tomcat, i don't see any issues but when I unpack it manually using unzip command, i run into below jasper issue,

    org.apache.jasper.JasperException: Unable to find taglib "html" for URI: /WEB-INF/struts-html.tld
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:80)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:176)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:434)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1448)
at org.apache.jasper.compiler.Parser.parse(Parser.java:145)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:105)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:201)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:333)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:600)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

So clearly the issue is because of manual unpacking of war VS the way tomcat unpacks the war. How are WARs unpacked manually or is there a way to make tomcat unpack while specifying the docBase and the context path ?

2
The above usually will happen if there is a problem in the appBase/docBase properties relative/absolute to the default values. First remove the context declaration and then directly unzip the war file under webapps/<yourAppName> directory and see if you are still getting the error, it would be best to take a fresh installation of Tomcat.Ironluca
I have tried fresh installations to rule out this, but that didn't workout. Between below is my entry in the server.xml ,<Host name="test.com" appBase="webapps/TC3" unpackWARs="true" autoDeploy="true">Ashwin Sridhar
When I said clean, please take a stock installation of Tomcat, without modification of any configuration files, in your case the sever.xml is modified.Ironluca
The default configuration works out. But my goal is to specify the context path. Either I need to rename the war as ROOT in order to have a default context path or explicitly specify in the conf/Catalina/host/ROOT.xml file. But i want to stay away from ROOT as my apps name.Ashwin Sridhar
If the manual WAR unpacking under default configuration worksk out, therefore the issue must be the way the appBase/docBase properties are getting configured, take a look at the Tomcat documentation, that would solve the problem tomcat.apache.org/tomcat-9.0-doc/config/context.htmlIronluca

2 Answers

0
votes

I have externalized the manually exploded application. I had kept it in a location /opt/test/TC3 and made the changes in CONFIG_BASE to point the docBase to this location.

But that seems to not solve the issue. Is there a way to autoDeploy while specifying the context ?

0
votes

I had this working by having different paths for appBase & docBase. docBase contained the path of the directory where my application is manually exploded.

Hopefully it helps someone.