Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    I'm passing the JSON in the body of the http POST. The request is being sent using Mule ESB. Here is a log from the sending end.
    Code:
    httpclient.wire.header: >> "POST /restapi?gwt.codesvr=127.0.0.1:9997 HTTP/1.1[\r][\n]"
    httpclient.wire.header: >> "Content-Type: application/x-www-form-urlencoded[\r][\n]"
    httpclient.wire.header: >> "X-MULE_ENDPOINT: http://127.0.0.1:8888/restapi?gwt.codesvr=127.0.0.1:9997[\r][\n]"
    httpclient.wire.header: >> "Content-Type: application/json;charset=UTF-8[\r][\n]"
    httpclient.wire.header: >> "X-MULE_ENCODING: UTF-8[\r][\n]"
    httpclient.wire.header: >> "X-MULE_ROOT_MESSAGE_ID: 4d39c03e-aa07-11e3-9367-7da4ed667d7b[\r][\n]"
    httpclient.wire.header: >> "X-MULE_SESSION: rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACQ0ZDNkZGVlZi1hYTA3LTExZTMtOTM2Ny03ZGE0ZWQ2NjdkN2Jwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAAXQACkpTRVNTSU9OSUR0AAx6eWJuMmdmMzZ5Njh4cQB+AAl4eA==[\r][\n]"
    httpclient.wire.header: >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
    httpclient.wire.header: >> "Host: 127.0.0.1:8888[\r][\n]"
    httpclient.wire.header: >> "Cookie: $Version=0; JSESSIONID=zybn2gf36y68[\r][\n]"
    httpclient.wire.header: >> "Content-Length: 231[\r][\n]"
    httpclient.wire.header: >> "[\r][\n]"
    httpclient.wire.content: >> "{data:{_constructor:"AdvancedCriteria",operator:"and",criteria:[{fieldName:"description",operator:"iContains",value:"TUNIC"},{fieldName:"showNoteCategory",operator:"equals",value:"WEB"}]},dataSource:"Product",operationType:"fetch"}"
    I've configured the servlet param defaultDataFormat for json. Here is the config from web.xml
    Code:
    <servlet>
        <servlet-name>IpRESTHandler</servlet-name>
        <servlet-class>com.islandpacific.gui.server.IpRESTHandler</servlet-class>
        <init-param>
            <param-name>defaultDataFormat</param-name>
            <param-value>json</param-value>
        </init-param>
        <init-param>
            <param-name>dynamicDataFormatParamName</param-name>
            <param-value>format</param-value>
        </init-param>
        <init-param>
            <param-name>wrapJSONResponses</param-name>
            <param-value>false</param-value>
        </init-param>
    </servlet>

    Comment


      #17
      We are drawing a complete blank on reproducing this. I was going to post my test code to see if you can repro with that, but in fact that seems unnecessary. Do we understand correctly that you see this problem even if you hit the Isomorphic RESTHandler servlet directly from the client, with no intervening code on the server side, and thus with no DynamicDSGenerator in play? If not, please clarify.

      If that is the case, it is extremely easy to strip this down to its essence. Download yesterday's SmartGWT 9.0p Eval build, pull the showcase.war out of it and plop that in the webapps directory of a local Tomcat installation. Start Tomcat and then use the Firefox RESTClient add-on (or some equivalent general REST client tool) to send your exact JSON text as a POST message to

      http://localhost:8080/showcase/showcase/sc/RESTHandler?isc_dataFormat=json

      (the isc_dataFormat param is just so you don't have to start tinkering with web.xml to get it to accept JSON rather than XML, but you could do that instead if you want to prove it. Or, just leave the param off and observe that what you get is a parse error, not an NPE).

      This will return a complaint that dataSource "Product" doesn't exist - but that is getting further than the NPE you report. To prove that conclusively, modify your JSON slightly to refer to a dataSource the Showcase knows about:
      Code:
      {data:{_constructor:"AdvancedCriteria",operator:"and",criteria:[{fieldName:[b]"countryName"[/b],operator:"iContains",value:[b]"a"[/b]},{fieldName:[b]"continent"[/b],operator:"equals",value:[b]"Europe"[/b]}]},dataSource:[b]"worldDS"[/b],operationType:"fetch"}
      And it does indeed return all European countries with an "a" in the name.

      So what we need to investigate this further is a way to reproduce it in a clean environment.

      Comment


        #18
        I'm sure it does work in a clean environment. Just not sure where to look to see what we might be doing to prevent it from working in our environment. When you say "one of them cannot possibly be null" can you tell me what that is so I can investigate to see if there is any way we could be inadvertently making it null?

        I can confirm that it happens even when using the standard RESTHandler and bypassing our dynamic DS generator entirely. With the dynamic DS generator in place the error occurs before the dynamic DS generator is even called.

        Is there any additional logging I could turn on that might help?
        Last edited by jay.l.fisher; 13 Mar 2014, 07:43.

        Comment


          #19
          We would actually like to know whether you see the problem in a clean environment - that wasn't a "go away" response, we do want to help you get to the bottom of this. It's possible that the JDK and/or servlet container you're using are at the root of the problem. These may seem unlikely causes, but we have a mysterious issue here: you see the problem every time, even when hitting RESTHandler directly; we never see the problem, and from considering the code involved with fair degree of familiarity, we cannot posit how the problem could arise. So we need to consider unlikely-seeming causes.

          The value that we say could not be null is an internal ThreadLocal variable that is assigned during initialization and is never changed. We see no scope for your code or config to alter this. More likely is that the dataSource name is arriving in that part of the code set to null - but that also seems pretty unlikely, given the JSON you posted.

          Please try the clean check suggested. If that works for you, you could maybe try eliminating Spring from your use case as a next step.

          Thanks,
          Isomorphic Software Support

          Comment


            #20
            It happens running under Jetty (in Eclipse) and also when deployed to Tomcat so I doubt the container or JDK are going to be the culprit, but you are probably on to something when you suggest removing Spring.

            I'm first doing a POST to log in via spring security as if the user had submitted the login form. I take the JSESSIONID cookie that comes back from that and sending it back on the subsequent POSTs to the rest handler. But I notice that I'm getting back *two* JSESSIONID cookies in the response to the login request, and only sending back the value from the 2nd one.

            I have to admit I don't fully understand Spring security or why I would get back two identical cookies. I suspect I'm not doing this right and somehow that is creating the problem. I'll have another look through the Spring documentation and see what I can learn. If you have any advice that might point me in the right direction I'd appreciate it. Thanks.

            Comment


              #21
              jay.l.fisher I was wondering if you found a fix to this NPE. I am seeing something similar but intermittently:

              16:17:14,984 ERROR [myapp.server.servlet.MyRESTHandler] (http-/0.0.0.0:8443-5) myapp.server.servlet.MyRESTHandler top-level exception: java.lang.NullPointerException
              at com.isomorphic.datasource.PoolableDataSourceFactory.makeUnpooledObject(PoolableDataSourceFactory.java:132) [isomorphic_core_rpc-5.0p.jar:]
              at com.isomorphic.datasource.PoolableDataSourceFactory.makeObject(PoolableDataSourceFactory.java:148) [isomorphic_core_rpc-5.0p.jar:]
              at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:964) [commons-pool-1.4.jar:1.4]
              at com.isomorphic.pool.ISCKeyedObjectPool.borrowObject(ISCKeyedObjectPool.java:106) [isomorphic_core_rpc-5.0p.jar:]
              at com.isomorphic.pool.PoolManager.borrowObject(PoolManager.java:90) [isomorphic_core_rpc-5.0p.jar:]
              at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:135) [isomorphic_core_rpc-5.0p.jar:]
              at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:86) [isomorphic_core_rpc-5.0p.jar:]
              at com.isomorphic.datasource.DataSourceManager.get(DataSourceManager.java:173) [isomorphic_core_rpc-5.0p.jar:]
              at com.isomorphic.rpc.RestRequestParser.parseRequest(RestRequestParser.java:391) [isomorphic_core_rpc-5.0p.jar:]
              at com.isomorphic.rpc.RPCManager.<init>(RPCManager.java:335) [isomorphic_core_rpc-5.0p.jar:]
              at com.isomorphic.servlet.RESTHandler.processRequest(RESTHandler.java:302) [isomorphic_core_rpc-5.0p.jar:]
              at myapp.server.servlet.MyRESTHandler.processRequest(MyRESTHandler.java:51) [classes:]
              at com.isomorphic.servlet.RESTHandler.doGet(RESTHandler.java:261) [isomorphic_core_rpc-5.0p.jar:]
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
              at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:156) [isomorphic_core_rpc-5.0p.jar:]
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
              at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.8.0_73]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.8.0_73]
              at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.8.0_73]
              at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:264) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:262) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_73]
              at javax.security.auth.Subject.doAsPrivileged(Unknown Source) [rt.jar:1.8.0_73]
              at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:296) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:156) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:288) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:59) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:197) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_73]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
              at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:512) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:400) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:400) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.4.10.Final-redhat-1.jar:7.4.10.Final-redhat-1]
              at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_73]

              Comment

              Working...
              X