0

I have a Swing-App which starts an embedded tomcat7 server without web.xml. I load a jsp, which uses jstl. When I access the jsp I get this error in my Swing-App:

18.02.2014 22:32:54 org.apache.jasper.compiler.WebXml <init>
WARNUNG: Internal Error: File /WEB-INF/web.xml not found
18.02.2014 22:32:54 org.apache.jasper.compiler.WebXml <init>
WARNUNG: Internal Error: File /WEB-INF/web.xml not found
18.02.2014 22:32:54 org.apache.catalina.core.ApplicationDispatcher invoke
SCHWERWIEGEND: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: The absolute uri: http://www.irquest.com/irq cannot be resolved in either web.xml or the jar files deployed with this application

Within the jsp I use these taglibs:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

I use jstl 1.1.2 and standard 1.1.2. These libs are included in my pom:

<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.1.2</version>
</dependency>
<dependency>
    <groupId>taglibs</groupId>
    <artifactId>standard</artifactId>
    <version>1.1.2</version>
</dependency>

This is how I configure the context:

Context jqs3context = null;
        try {
            jqs3context = tomcat.addWebapp("/" + servletContainerSettings.getServletContext(), servletContainerSettings.getHtdocsHome());
        } catch (ServletException e) {
            e.printStackTrace();
        }
        Wrapper wrapper = Tomcat.addServlet(jqs3context, "JQS3", servletContainerSettings.getServletClass());

        //[..] wrapper init params here [..]

        jqs3context.addServletMapping("/" + servletContainerSettings.getServletName() + "/*", "JQS3");
        jqs3context.setCrossContext(true);
        jqs3context.setLoader(new WebappLoader());
        jqs3context.setResources(new FileDirContext());
        jqs3context.getNamingResources().addResource(createDatabaseResource("jdbc/iradmindb"));

This happened after I upgraded embedded tomcat5.5 to tomcat7. I can't figure out why I'm getting that error. What am I missing?

4

1 回答 1

0

Answering my own question:

After fiddling with JarScanner and reading the docs (https://tomcat.apache.org/tomcat-7.0-doc/config/jar-scanner.html) this works for me:

StandardJarScanner jarScanner = new StandardJarScanner();
jarScanner.setScanBootstrapClassPath(true);
jarScanner.setScanClassPath(true);
jqs3Context.setJarScanner(jarScanner);
于 2014-02-19T08:53:29.587 回答