Waffle and "encodedRequest cannot be empty" exception

702 views
Skip to first unread message

Samoth

unread,
Apr 24, 2012, 1:43:34 PM4/24/12
to waffle...@googlegroups.com
Hi all!

I try to use Waffle (waffle-filter from samples) in my GWT (also very simple) project and very often I had an error:


java.lang.IllegalArgumentException: encodedRequest cannot be empty
 

How can I fix it? Any ideas?


Thomas

Daniel Doubrovkine

unread,
Apr 28, 2012, 9:51:59 AM4/28/12
to waffle...@googlegroups.com
I don't think this comes from Waffle. What's the complete call stack? 

There's a thread in  http://code.google.com/p/google-web-toolkit/issues/detail?id=4072  that seems related. 

Samoth

unread,
Apr 28, 2012, 7:01:52 PM4/28/12
to waffle...@googlegroups.com
It's from Waffle. :<

Complete call stack:


2012-04-24 17:36:01 org.apache.catalina.core.ApplicationContext log
SEVERE: Exception while dispatching incoming RPC call

java.lang.IllegalArgumentException: encodedRequest cannot be empty
    at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:229)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)


When I delete Waffle filters in web.xml, I haven't this exceptions (but Waffle don't work of course...)


W dniu sobota, 28 kwietnia 2012 15:51:59 UTC+2 użytkownik Daniel Doubrovkine napisał:
I don't think this comes from Waffle. What's the complete call stack? 

There's a thread in  http://code.google.com/p/google-web-toolkit/issues/detail?id=4072  that seems related. 

Daniel Doubrovkine

unread,
Apr 29, 2012, 8:52:59 PM4/29/12
to waffle...@googlegroups.com
The problem is a combination of GWT and NTLM protocol. The details are described in  http://code.dblock.org/ntlm-please-show-id-with-every-post. The first post has an empty body, then auth is negotiated with the server and the client is supposed to repost the data. I would guess that GWT doesn't. Look at the network trace before this error, I think you'll see this.

I am not sure how to fix this, but I would get a clear network trace that demonstrates the problem and bring it up on a GWT list.
Message has been deleted

Samoth

unread,
Jun 21, 2012, 9:57:24 AM6/21/12
to waffle...@googlegroups.com
Problem resolved!

I added filter in web.xml to all files:

    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

instead: 

    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/onefile.html</url-pattern>
    </filter-mapping>

Additionaly I compiled again waffle sources and edited one class: AuthorizationHeader.java; method: isNtlmType1PostAuthorizationHeader(). Complete new version of this method:

    public boolean isNtlmType1PostAuthorizationHeader() {
        if (!_request.getMethod().equals("POST") && !_request.getMethod().equals("PUT")) {
            return false;
        }
        if (_request.getContentLength() != 0) {
            return false;
        }
        if (getSecurityPackage().equals("Negotiate")) {
            return true;
        }
        /**
         * checks 0-content-length POST for the Type 2 authentication message *
         */
        if (_request.getContentLength() == 0 && _request.getMethod().equals("POST")) {
            return true;
        }
        return isNtlmType1Message();
    }

gman

unread,
Oct 8, 2012, 3:19:05 PM10/8/12
to waffle...@googlegroups.com
Is the Code posted by Samoth a valid Workaround/Fix for the Problem? Do you plan to include it
in an coming 1.5-Release?

I had the same Problem and with the Code from Samoth the Problem is gone. But I am not sure
if it breaks something else, since I am not an NTLM/Auth-Expert.

Daniel Doubrovkine

unread,
Oct 8, 2012, 4:17:45 PM10/8/12
to waffle...@googlegroups.com
The code is *not* in 1.5. But I am open to a pull request into the 1.5 branch. We can discuss it there if someone (you?) does it and makes sure all tests pass (this needs new tests), I will do some further research.

Daniel Doubrovkine

unread,
Nov 23, 2012, 9:28:08 AM11/23/12
to waffle...@googlegroups.com
We had a similar issue in https://github.com/dblock/waffle/pull/40 where the message turned out to be a SPNEGO message instead of a NTLM type1 message. Can we maybe resurrect this thread? Do you still have a repro with waffle without any modifications? I'd like to look at a network trace.
Reply all
Reply to author
Forward
0 new messages