Debug Tomcat 首页:ClassNotFoundException: org.apache.jsp.index_jsp

版本:tomcat 8.5.81 tomcat-9.0.64 都是这个问题

网上说权限问题和jar包问题的都不对

解决方案:

在 org.apache.catalina.startup.ContextConfig类中,新增以下代码初始化jsp解析服务

 /**
     * Process a "contextConfig" event for this Context.
     */
    protected synchronized void configureStart() {
        // Called from StandardContext.start()

        if (log.isDebugEnabled()) {
            log.debug(sm.getString("contextConfig.start"));
        }

        if (log.isDebugEnabled()) {
            log.debug(sm.getString("contextConfig.xmlSettings",
                    context.getName(),
                    Boolean.valueOf(context.getXmlValidation()),
                    Boolean.valueOf(context.getXmlNamespaceAware())));
        }

        webConfig();
        
        //插入这行代码
        context.addServletContainerInitializer(new JasperInitializer(), null);

        if (!context.getIgnoreAnnotations()) {
            applicationAnnotationsConfig();
        }
        if (ok) {
            validateSecurityRoles();
        }

.......

 

posted @ 2022-07-01 15:49  抽象工作室upup  阅读(27)  评论(0编辑  收藏  举报