Hi everyone,
I have an issue at JSONInterceptor/ParameterInterceptor (i think),
parameteres are being lost (becoming null), im using:

 * Struts2 2.3.16.3
 * Spring AOP 4.0.2
 * Tomcat 7.0.34
 * Dojo 1.8

After many debugging i've concluded that the issue it's inside one of
those two interceptors, this is the issue:

At client side i send the following json-rpc/stuff, please pay special
attention to POST-DATA and the red parameter

      characterEncoding = UTF-8
          contentLength = 872
            contentType = application/json-rpc
                 locale = es_MX
                locales = es_MX
               protocol = HTTP/1.1
             remoteAddr = 192.168.0.183
             remoteHost = 192.168.0.183
                 scheme = http
             serverName = 192.168.0.90
             serverPort = 8080
               isSecure = false
     --------------------------------------------- HttpServletRequest
            contextPath = /MyApplication
                 cookie = JSESSIONID = CA8C2ACD2FE5F2259FFCDD76BE07A247
                 header = accept = */*
                 header = x-newrelic-id = UgAOVF9TGwAAU1NaBgA=
                 header = content-type = application/json-rpc
                 header = x-requested-with = XMLHttpRequest
                 header = referer =
   http://192.168.0.90:8080/MyApplication/view/v.verification.view
                 header = accept-language = es-mx
                 header = accept-encoding = gzip, deflate
                 header = user-agent = Mozilla/4.0 (compatible; MSIE
   7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727;
   .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0;
   .NET4.0C; .NET4.0E; InfoPath.3)
                 header = host = 192.168.0.90:8080
                 header = content-length = 872
                 header = connection = Keep-Alive
                 header = cache-control = no-cache
                 header = cookie =
   JSESSIONID=CA8C2ACD2FE5F2259FFCDD76BE07A247
                 method = POST
               pathInfo = null
            queryString = null
             remoteUser = null
     requestedSessionId = CA8C2ACD2FE5F2259FFCDD76BE07A247
             requestURI = /MyApplication/view/Request.action
            servletPath = /view/Request.action
     =============================================
     POST-DATA:
     =============================================
   
{"params":[*{"author":{"id":302},"autoProm":0,"autorizationPool":null,"blockedBy":null,"blockedByName":null,"businessUnit":null,"code":"","creationDate":"2014-07-30T12:36:37","deleted":0,"department":{"id":"13"},"description":"BITACORA
   DE REVISION SEMANAL DE MOLINOS GLENN
   
MILL","document":null,"documentCode":"FFQ-043","documentType":{"code":"FORMATOS","deleted":0,"description":"FORMATOS","id":11,"isRetainable":1,"moduleId":0,"saveHandle":null,"status":4,"value":"11"},"fileId":12820,"flujo":{"id":"24"},"id":_41201_,"isBusy":null,"nodo":{"id":3575},"organizationalUnit":null,"reazon":"FORMALIDAD
   DE LA BITACORA EN UN REGISTRO
   
CONTROLADO","requestLogList":[],"retentionText":"3","retentionTime":1,"saveHandle":null,"status":3,"storagePlaceId":"1","timeToFreeMinutes":null,"type":1,"verificationList":[],"version":"1","tipoSolicitud":1}*],"method":"verifyRequestSMD","id":3}
     =============================================


Previews data was printed at a Filter i've made for debugging purposes,
it runs before any struts interceptor (RequestBuffer.java) (the failure
happens with and without my filter)

The stack trace shows an error inside my application because the red-id
parameter didn't made it to my function called "HQLT_findById", actually
a null was sent there

   java.lang.IllegalArgumentException: id to load is required for loading
        at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:89)
        at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:57)
        at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1080)
        at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1070)
        at
   Framework.DAO.GenericDAOImpl.HQLT_findById(GenericDAOImpl.java:1885)
        at
   Framework.DAO.GenericDAOImpl.*HQLT_findById*(GenericDAOImpl.java:1837)
        at sun.reflect.GeneratedMethodAccessor1386.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
   
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at
   
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at
   
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at
   
org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
        at
   
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at
   
org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
        at
   
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
        at
   
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
        at
   
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at
   
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy117.HQLT_findById(Unknown Source)
        at DPMS.Document.CRUD_Request.verifyRequest(CRUD_Request.java:148)
        at
   DPMS.Document.CRUD_Request.verifyRequestSMD(CRUD_Request.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
   org.apache.struts2.json.JSONInterceptor.invoke(JSONInterceptor.java:246)
        at
   org.apache.struts2.json.JSONInterceptor.intercept(JSONInterceptor.java:133)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
        at
   
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
        at
   
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
        at
   
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)
        at
   
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)
        at
   
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
        at
   
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)
        at
   
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at
   org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
        at
   org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562)
        at
   
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
        at
   
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
        at
   
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at
   
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at
   
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:232)
        at
   
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
        at
   
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at
   
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   **_*at Framework.Config.RequestBuffer.doFilter(RequestBuffer.java:47)*_
        at
   
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at
   
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at Framework.Config.LogFilter.doFilter(LogFilter.java:59)
        at
   
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at
   
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at Framework.Config.LoginFilter.doFilter(LoginFilter.java:52)
        at
   
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at
   
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at
   
org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
        at
   
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at
   
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at
   
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at
   
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at
   
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at
   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at
   com.googlecode.psiprobe.Tomcat70AgentValve.invoke(Tomcat70AgentValve.java:38)
        at
   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at
   org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
        at
   
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at
   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at
   
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
        at
   
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        at
   
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
   Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
   Source)
        at java.lang.Thread.run(Unknown Source)


At the end, the issue is that i've sent this:

   
*{"author":{"id":302},"autoProm":0,"autorizationPool":null,"blockedBy":null,"blockedByName":null,"businessUnit":null,"code":"","creationDate":"2014-07-30T12:36:37","deleted":0,"department":{"id":"13"},"description":"BITACORA
   DE REVISION SEMANAL DE MOLINOS GLENN
   
MILL","document":null,"documentCode":"FFQ-043","documentType":{"code":"FORMATOS","deleted":0,"description":"FORMATOS","id":11,"isRetainable":1,"moduleId":0,"saveHandle":null,"status":4,"value":"11"},"fileId":12820,"flujo":{"id":"24"},"id":_41201_,"isBusy":null,"nodo":{"id":3575},"organizationalUnit":null,"reazon":"FORMALIDAD
   DE LA BITACORA EN UN REGISTRO
   
CONTROLADO","requestLogList":[],"retentionText":"3","retentionTime":1,"saveHandle":null,"status":3,"storagePlaceId":"1","timeToFreeMinutes":null,"type":1,"verificationList":[],"version":"1","tipoSolicitud":1}*

But the /JSONUtil.deserialize (at JSONInterceptor:123)/ inside of struts
did this (please note that *"id":_41201_* is missing) (the following
JSON was made by using /JSONUtil.serialize /of my Entity /[ignoring
hierarchy and excluding nulls//]/)

   
*{"author":{"id":302},"autoProm":0,"creationDate":"2014-07-30T12:36:37","department":{"code":"","deleted":0,"description":"","id":13,"status":1},"documentCode":"FFQ-043","documentType":{"code":"FORMATOS","deleted":0,"description":"FORMATOS","id":11,"isRetainable":1,"moduleId":0,"status":4,"value":"11"},"fileId":12820,"flujo":{"code":"","deleted":0,"description":"","id":24,"status":1},"nodo":{"code":"","deleted":0,"description":"","id":3575,"status":1,"topLevel":0},"reazon":"FORMALIDAD
   DE LA BITACORA EN UN REGISTRO
   
CONTROLADO","requestLogList":[],"retentionText":3,"retentionTime":1,"storagePlaceId":1,"type":1,"verificationList":[],"version":"1"}*

I've inspected a lot of struts2 source code and i didn't found anything,
my guess is that somewhere inside struts something like
/request.getParameter("id")/ is beign called or simply
/JSONUtil.deserialize /is not working properly.

The issue is not easily reproducible because it happens like 1 time per
day, some important fact is that once it happens ONCE at any SMD call it
starts happening at ALL SMD calls... the only fix for this is to restart
Tomcat, after that the application starts working fine again,

A workaroud i did by following the /request.getParameter("id")/ guess
was to do a HttpServletRequestWrapper to make "getParameter"
multireadable, by using this workaround the error stoped happending by
20 days... but suddenly it happeed again, the following link shows my
HttpServletRequestWrapper

 * http://codeviewer.org/view/code:4241

Basically it stores all RequestBody data to be able to call request data
more than once (getParameter, getParameters, getInputStream, etc), if
you need more information i'll be happy to help,

Greetings


---
Este mensaje no contiene virus ni malware porque la protección de avast! 
Antivirus está activa.
http://www.avast.com

Reply via email to