문제

I'm deploying a Hybris application, which uses Jawr, to a Tomcat server. At start-up, JawrServlet throws a StackOverflow error.

It's hard to reproduce the error, but it always happens during the processing of CSSServlet. Shortly after this is logged:

[JawrRequestHandler] Initializing jawr config for request handler named CSSServlet

This is how that Servlet is configured in my web.xml:

     <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>

And here's a part of my console's log where the error happens:

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)
도움이 되었습니까?

해결책 2

In my CSS I had this class definition that might have been causing the problem:

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

So I changed it to:

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

And it worked again.

But it's hard to be absolutely sure. When the name of the class is really long, the error doesn't Always happen. The whole problem is a fantastic mind twist if you ask me.

My advice is, have a look in your CSS and see if you have long class names and try to redeploy the application without those CSS classes.

다른 팁

I'm using Jawr 3.3.3 and Bootstrap 3.1.0 and have experienced the same problem. The solution is to make a small "correction" in bootstrap.css ie. change:

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

to:

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

Notice that the only things changed are the opening and closing brackets (with their css code counterparts).

This way semantics remain the same but jawr doesn't fails. :) (I'm quite certain it's a regular expression things that's causing this..)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top