4

我正在将使用 Jawr 的 Hybris 应用程序部署到 Tomcat 服务器。在启动时,JawrServlet 会引发 StackOverflow 错误。

这个错误很难重现,但在处理 CSSServlet 的过程中总是会发生。记录后不久:

[JawrRequestHandler] Initializing jawr config for request handler named CSSServlet

这就是在我的 web.xml 中配置 Servlet 的方式:

     <servlet>
        <servlet-name>CSSServlet</servlet-name>
        <servlet-class>net.jawr.web.servlet.JawrServlet</servlet-class>

        <!-- Location in classpath of the config file -->
        <init-param>
            <param-name>configLocation</param-name>
            <param-value>/jawrsetup.properties</param-value>
            <!--<param-value>/jawrTEST.properties</param-value>-->
        </init-param>
        <init-param>
            <param-name>type</param-name>
            <param-value>css</param-value>
        </init-param>
        <init-param>
            <param-name>mapping</param-name>
            <param-value>/jawr-css</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

这是发生错误的控制台日志的一部分:

INFO   | jvm 1    | main    | 2013/01/29 11:20:16.081 | 11:20:16,036 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/pause.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.082 | 11:20:16,036 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/pause-ie.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.082 | 11:20:16,036 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/left-hover.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.087 | 11:20:16,036 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/left-hover-ie.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.087 | 11:20:16,036 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/right-hover.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.087 | 11:20:16,045 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/right-hover-ie.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.092 | 11:20:16,045 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/play-hover.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.092 | 11:20:16,045 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/play-hover-ie.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.092 | 11:20:16,045 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/pause-hover.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.093 | 11:20:16,045 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bk-ruby/pause-hover-ie.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.097 | 11:20:16,045 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url('/images/bg.png')
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.098 | 11:20:16,046 [WrapperSimpleAppMain] DEBUG [Base64PostProcessorCssImageUrlRewriter] Skip encoding image resource : url("/images/content-bg.png")
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.098 | 11:20:16,057 [WrapperSimpleAppMain] INFO  [Base64ImageEncoderPostProcessor] Base64 Postprocessing done
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.098 | 11:20:16,058 [WrapperSimpleAppMain] DEBUG [AbstractChainedResourceBundlePostProcessor] postprocessing bundle:/bundles/dmlights.css
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 | Jan 29, 2013 11:20:16 AM org.apache.catalina.core.ApplicationContext log
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 | SEVERE: StandardWrapper.Throwable
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 | java.lang.StackOverflowError
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 |     at java.util.regex.Pattern$LazyLoop.match(Unknown Source)
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 |     at java.util.regex.Pattern$GroupTail.match(Unknown Source)
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 |     at java.util.regex.Pattern$CharProperty.match(Unknown Source)
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 |     at java.util.regex.Pattern$Ques.match(Unknown Source)
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 |     at java.util.regex.Pattern$GroupHead.match(Unknown Source)
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 |     at java.util.regex.Pattern$LazyLoop.match(Unknown Source)
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 |     at java.util.regex.Pattern$GroupTail.match(Unknown Source)
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 |     at java.util.regex.Pattern$CharProperty.match(Unknown Source)
INFO   | jvm 1    | main    | 2013/01/29 11:20:16.198 |     at java.util.regex.Pattern$Ques.match(Unknown Source)
4

2 回答 2

2

我正在使用 Jawr 3.3.3 和 Bootstrap 3.1.0 并且遇到了同样的问题。解决方案是在bootstrap.css中做一个小的“更正”,即。改变:

a[href]:after {
    content: " (" attr(href) ")";
}
abbr[title]:after {
    content: " (" attr(title) ")";
}

到:

a[href]:after {
    content: " \0028" attr(href) "\0029";
}
abbr[title]:after {
    content: " \0028" attr(title) "\0029";
}

请注意,唯一改变的是左括号和右括号(及其对应的 css 代码)。

这种方式语义保持不变,但颚不会失败。:) (我很确定这是导致这种情况的正则表达式的事情..)

于 2014-02-01T18:40:34.257 回答
1

在我的 CSS 中,我有一个可能导致问题的类定义:

.our-price-indicated-pdp-acessories,
.our-price-indicated-cart-dropdown
{
    color: #6E6E6E;
    font-size: 11px;
    line-height: 15px;
    font-weight: bold;
    text-align: center;
}

所以我把它改成:

.our-priceind-pdpa,
.our-priceind-cartdrop{
    color: #6E6E6E;
    font-size: 11px;
    line-height: 15px;
    font-weight: bold;
    text-align: center;
}

它再次起作用。

但很难绝对确定。当类的名称很长时,错误并不总是发生。如果你问我,整个问题是一个奇妙的思维扭曲。

我的建议是,看看你的 CSS,看看你是否有长的类名,并尝试在没有这些 CSS 类的情况下重新部署应用程序。

于 2013-01-30T12:58:32.900 回答