You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Luis Limas <lu...@hotmail.com> on 2014/08/04 18:37:03 UTC

Struts missing parameters

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

Re: Struts missing parameters

Posted by Luis Limas <lu...@hotmail.com>.
Any ideas of what's happening?

On 04/08/2014 12:38 p. m., Luis Limas wrote:
> An update, the concrete lost-parameters are this ones:
>
> {
>    "id":41201,
>    "code":"",
>    "deleted":0,
>    "status":3,
>    "description":"BITACORA DE REVISION SEMANAL DE MOLINOS GLENN MILL"
> }
>
> This is my entity who's missing parameters:
>
>  * http://codeviewer.org/view/code:4259
>
> I've just noticed that all the misssing parameters belong to 
> StandardEntity.java (anotated with @MappedSuperclass)
>
>  * http://codeviewer.org/view/code:425a
>
> I consider this a very important fact, so it seems like somehow 
> /JSONUtil.deserialize/ fails at sometimes when tries to deserialize 
> @MappedSuperclass (es)
>
> Greetings,
>
> On 04/08/2014 11:37 a. m., Luis Limas wrote:
>> 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
>>
>
>
>
> ---
> Este mensaje no contiene virus ni malware porque la protección de 
> avast! Antivirus está activa.
> http://www.avast.com
>


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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Luis Limas <lu...@hotmail.com>.
An update, the concrete lost-parameters are this ones:

{
    "id":41201,
    "code":"",
    "deleted":0,
    "status":3,
    "description":"BITACORA DE REVISION SEMANAL DE MOLINOS GLENN MILL"
}

This is my entity who's missing parameters:

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

I've just noticed that all the misssing parameters belong to 
StandardEntity.java (anotated with @MappedSuperclass)

  * http://codeviewer.org/view/code:425a

I consider this a very important fact, so it seems like somehow 
/JSONUtil.deserialize/ fails at sometimes when tries to deserialize 
@MappedSuperclass (es)

Greetings,

On 04/08/2014 11:37 a. m., Luis Limas wrote:
> 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
>



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

Re: Struts missing parameters

Posted by Luis Limas <lu...@hotmail.com>.
On 08/08/2014 02:18 a. m., Lukasz Lenart wrote:
> 2014-08-07 22:58 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>> Thanks again for the reply Lukasz, this is the full hierarchy used at JSON
>> in the 1st mail:
>>
>>   * 1st level : http://codeviewer.org/view/code:4279
>>   * 2nd level : http://codeviewer.org/view/code:427a
>>   * 3rd level (issue) : http://codeviewer.org/view/code:427b
>>   * 4th level : http://codeviewer.org/view/code:427c
>>
>>
>> As i told before, the issue is particularly hard to debug (also hard to
>> reproduce) because once Tomcat is reset the bug seems to be repaired,
> Oh... I missed that out. Anyway I think there isn't a good solution
> for you right now. You are using Hibernate entities directly and you
> try to serialize/deserialize them which is always a bad idea ™
>
> JSONWriter (used to serialize) has some logic to detect Javassist
> extended classes but there is no way to do the same in opposite.
>
>
> Regards
Thanks again for the reply Lukasz, you misunderstood me, im not doing 
serialize/deserialize my entities for any logic, the deserialize 
instruction is being called inside struts (Project: Struts 2 JSON 
Plugin, JSONInterceptor.java : 123) when parsing JSON to Map (before 
calling the setters inside JSONReader) and then to Object, i mentioned 
the deserialize thing because there is where it seems to me that setters 
are not being called. The serialize instruction i only use it for 
debugging purposes so i was able to see how it looks the populated 
(final) object,

Also im not sure to understand what do you mean with "there's no way to 
do the opposite", isn't JSONReader doing that? The issue seems to be 
that JSONReader is not working properly when parsing the JSON-String to 
Object (Entity).

Greetings,

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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Luis Limas <lu...@hotmail.com>.
On 21/08/2014 01:24 p. m., Lukasz Lenart wrote:
> 2014-08-21 19:14 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>> Yep, but by using log4j XML configuration:
>>
>>      <category name="com.opensymphony.xwork2.interceptor" additivity="false">
>>          <priority value="DEBUG" />
>>          <appender-ref ref="basic" />
>>      </category>
>>      <category name="com.opensymphony.xwork2.ognl.OgnlValueStack"
>> additivity="false">
>>          <priority value="WARN" />
>>          <appender-ref ref="basic" />
>>      </category>
>>
>> I've suspended trying to solve the issue by now, i'll restart my research
>> next week, i'll post everything i've found at the mailing list at that time,
>>
>> Right now i'm just restarting tomcat to solve the issue temporarily, yet i
>> haven't seen any tomcat log,
> Great but please add the below to your log4j configuration
>
> <category name="org.apache.struts2.json" additivity="false">
>       <priority value="DEBUG" />
>        <appender-ref ref="basic" />
> </category>
>
>
> Regards
Done :)

Thank you,

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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Lukasz Lenart <lu...@apache.org>.
2014-08-21 19:14 GMT+02:00 Luis Limas <lu...@hotmail.com>:
> Yep, but by using log4j XML configuration:
>
>     <category name="com.opensymphony.xwork2.interceptor" additivity="false">
>         <priority value="DEBUG" />
>         <appender-ref ref="basic" />
>     </category>
>     <category name="com.opensymphony.xwork2.ognl.OgnlValueStack"
> additivity="false">
>         <priority value="WARN" />
>         <appender-ref ref="basic" />
>     </category>
>
> I've suspended trying to solve the issue by now, i'll restart my research
> next week, i'll post everything i've found at the mailing list at that time,
>
> Right now i'm just restarting tomcat to solve the issue temporarily, yet i
> haven't seen any tomcat log,

Great but please add the below to your log4j configuration

<category name="org.apache.struts2.json" additivity="false">
     <priority value="DEBUG" />
      <appender-ref ref="basic" />
</category>


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Luis Limas <lu...@hotmail.com>.
On 20/08/2014 02:21 p. m., Lukasz Lenart wrote:
> 2014-08-09 4:22 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>> On 08/08/2014 02:24 p. m., Lukasz Lenart wrote:
>>> 2014-08-08 17:38 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>>>> Thanks again for the reply Lukasz, you misunderstood me, im not doing
>>>> serialize/deserialize my entities for any logic, the deserialize
>>>> instruction
>>>> is being called inside struts (Project: Struts 2 JSON Plugin,
>>>> JSONInterceptor.java : 123) when parsing JSON to Map (before calling the
>>>> setters inside JSONReader) and then to Object,  i mentioned the
>>>> deserialize
>>>> thing because there is where it seems to me that setters are not being
>>>> called. The serialize instruction i only use it for debuging purposes so
>>>> i
>>>> was able to see how it looks the populated (final) object,
>>> Yes I know, but you're exposing Hibernate entity directly not some VO
>>> - it always will be an issue, as you can see [1], JSONWriter already
>>> contains some logic to detect Hibernate bean, but JSONReader can't do
>>> that.
>>>
>>>> The issue seems to be that JSONWriter is not working propely. Also im not
>>>> sure to understand what do you mean with "there's no way to do the
>>>> opposite", isn't JSONReader doing that?
>>> ...create proper Hibernate entity from JSON - only Hibernate can do
>>> that and creating entities by hand can cause some problems like your.
>>>
>>> To clarify few things:
>>> - JSONWriter serializes an object to JSON (writes to request)
>>> - JSONRead deserializes JSON into an object (reads from request)
>>>
>>> As I understand you have problem with converting JSON into an object?
>>> So in that case JSONReader and JSONPopulator are involved.
>>>
>>> [1]
>>> https://github.com/apache/struts/blob/aa744b811f9c41b80cc30ad6cf41ccaa75da5323/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java#L290-L312
>>>
>>>
>>> Regards
>> My problem is that struts calls JSONReader when using SMDMethod=true to
>> convert JSON to Object. And so on, JSONReader fails to do the conversion.
>>
>> This is an example of SMDMethod im calling
>>
>> @SMDMethod
>> public String mySMDMethod(Request obj /*I showed Request.java at previews
>> mail */) {
>>      if(obj.getId() == null) {
>>          System.out.println("Unexpected behavior, actually the JSON sended
>> from client was {id:99}. Somehow struts didn't managed to populate ");
>>      }
>>      //logic stuff...
>>      return "succesfull example";
>> }
>>
>> At client side im sending always at least a JSON like this {id:99}.
>>
>> So you think this issue ocurrs because the "obj" parameter at "mySMDMethod"
>> is an entity? that means that the issue should cease to happen by just
>> removing all hibernate annotations?? (because thats the only special thing
>> about entities at this call)
>>
>> Thanks for your kind help :)
> Did you try to setup higher level for logger used with JSON plugin?
>
> ie.
> log4j.logger.org.apache.struts2.json = debug
>
>
> Regards
Yep, but by using log4j XML configuration:

     <category name="com.opensymphony.xwork2.interceptor" 
additivity="false">
         <priority value="DEBUG" />
         <appender-ref ref="basic" />
     </category>
     <category name="com.opensymphony.xwork2.ognl.OgnlValueStack" 
additivity="false">
         <priority value="WARN" />
         <appender-ref ref="basic" />
     </category>

I've suspended trying to solve the issue by now, i'll restart my 
research next week, i'll post everything i've found at the mailing list 
at that time,

Right now i'm just restarting tomcat to solve the issue temporarily, yet 
i haven't seen any tomcat log,

Thanks for your time :)



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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Lukasz Lenart <lu...@apache.org>.
2014-08-09 4:22 GMT+02:00 Luis Limas <lu...@hotmail.com>:
> On 08/08/2014 02:24 p. m., Lukasz Lenart wrote:
>>
>> 2014-08-08 17:38 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>>>
>>> Thanks again for the reply Lukasz, you misunderstood me, im not doing
>>> serialize/deserialize my entities for any logic, the deserialize
>>> instruction
>>> is being called inside struts (Project: Struts 2 JSON Plugin,
>>> JSONInterceptor.java : 123) when parsing JSON to Map (before calling the
>>> setters inside JSONReader) and then to Object,  i mentioned the
>>> deserialize
>>> thing because there is where it seems to me that setters are not being
>>> called. The serialize instruction i only use it for debuging purposes so
>>> i
>>> was able to see how it looks the populated (final) object,
>>
>> Yes I know, but you're exposing Hibernate entity directly not some VO
>> - it always will be an issue, as you can see [1], JSONWriter already
>> contains some logic to detect Hibernate bean, but JSONReader can't do
>> that.
>>
>>> The issue seems to be that JSONWriter is not working propely. Also im not
>>> sure to understand what do you mean with "there's no way to do the
>>> opposite", isn't JSONReader doing that?
>>
>> ...create proper Hibernate entity from JSON - only Hibernate can do
>> that and creating entities by hand can cause some problems like your.
>>
>> To clarify few things:
>> - JSONWriter serializes an object to JSON (writes to request)
>> - JSONRead deserializes JSON into an object (reads from request)
>>
>> As I understand you have problem with converting JSON into an object?
>> So in that case JSONReader and JSONPopulator are involved.
>>
>> [1]
>> https://github.com/apache/struts/blob/aa744b811f9c41b80cc30ad6cf41ccaa75da5323/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java#L290-L312
>>
>>
>> Regards
>
> My problem is that struts calls JSONReader when using SMDMethod=true to
> convert JSON to Object. And so on, JSONReader fails to do the conversion.
>
> This is an example of SMDMethod im calling
>
> @SMDMethod
> public String mySMDMethod(Request obj /*I showed Request.java at previews
> mail */) {
>     if(obj.getId() == null) {
>         System.out.println("Unexpected behavior, actually the JSON sended
> from client was {id:99}. Somehow struts didn't managed to populate ");
>     }
>     //logic stuff...
>     return "succesfull example";
> }
>
> At client side im sending always at least a JSON like this {id:99}.
>
> So you think this issue ocurrs because the "obj" parameter at "mySMDMethod"
> is an entity? that means that the issue should cease to happen by just
> removing all hibernate annotations?? (because thats the only special thing
> about entities at this call)
>
> Thanks for your kind help :)

Did you try to setup higher level for logger used with JSON plugin?

ie.
log4j.logger.org.apache.struts2.json = debug


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Luis Limas <lu...@hotmail.com>.
On 08/08/2014 02:24 p. m., Lukasz Lenart wrote:
> 2014-08-08 17:38 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>> Thanks again for the reply Lukasz, you misunderstood me, im not doing
>> serialize/deserialize my entities for any logic, the deserialize instruction
>> is being called inside struts (Project: Struts 2 JSON Plugin,
>> JSONInterceptor.java : 123) when parsing JSON to Map (before calling the
>> setters inside JSONReader) and then to Object,  i mentioned the deserialize
>> thing because there is where it seems to me that setters are not being
>> called. The serialize instruction i only use it for debuging purposes so i
>> was able to see how it looks the populated (final) object,
> Yes I know, but you're exposing Hibernate entity directly not some VO
> - it always will be an issue, as you can see [1], JSONWriter already
> contains some logic to detect Hibernate bean, but JSONReader can't do
> that.
>
>> The issue seems to be that JSONWriter is not working propely. Also im not
>> sure to understand what do you mean with "there's no way to do the
>> opposite", isn't JSONReader doing that?
> ...create proper Hibernate entity from JSON - only Hibernate can do
> that and creating entities by hand can cause some problems like your.
>
> To clarify few things:
> - JSONWriter serializes an object to JSON (writes to request)
> - JSONRead deserializes JSON into an object (reads from request)
>
> As I understand you have problem with converting JSON into an object?
> So in that case JSONReader and JSONPopulator are involved.
>
> [1] https://github.com/apache/struts/blob/aa744b811f9c41b80cc30ad6cf41ccaa75da5323/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java#L290-L312
>
>
> Regards
My problem is that struts calls JSONReader when using SMDMethod=true to 
convert JSON to Object. And so on, JSONReader fails to do the conversion.

This is an example of SMDMethod im calling

@SMDMethod
public String mySMDMethod(Request obj /*I showed Request.java at 
previews mail */) {
     if(obj.getId() == null) {
         System.out.println("Unexpected behavior, actually the JSON 
sended from client was {id:99}. Somehow struts didn't managed to 
populate ");
     }
     //logic stuff...
     return "succesfull example";
}

At client side im sending always at least a JSON like this {id:99}.

So you think this issue ocurrs because the "obj" parameter at 
"mySMDMethod" is an entity? that means that the issue should cease to 
happen by just removing all hibernate annotations?? (because thats the 
only special thing about entities at this call)

Thanks for your kind help :)

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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Lukasz Lenart <lu...@apache.org>.
2014-08-08 17:38 GMT+02:00 Luis Limas <lu...@hotmail.com>:
> Thanks again for the reply Lukasz, you misunderstood me, im not doing
> serialize/deserialize my entities for any logic, the deserialize instruction
> is being called inside struts (Project: Struts 2 JSON Plugin,
> JSONInterceptor.java : 123) when parsing JSON to Map (before calling the
> setters inside JSONReader) and then to Object,  i mentioned the deserialize
> thing because there is where it seems to me that setters are not being
> called. The serialize instruction i only use it for debuging purposes so i
> was able to see how it looks the populated (final) object,

Yes I know, but you're exposing Hibernate entity directly not some VO
- it always will be an issue, as you can see [1], JSONWriter already
contains some logic to detect Hibernate bean, but JSONReader can't do
that.

> The issue seems to be that JSONWriter is not working propely. Also im not
> sure to understand what do you mean with "there's no way to do the
> opposite", isn't JSONReader doing that?

...create proper Hibernate entity from JSON - only Hibernate can do
that and creating entities by hand can cause some problems like your.

To clarify few things:
- JSONWriter serializes an object to JSON (writes to request)
- JSONRead deserializes JSON into an object (reads from request)

As I understand you have problem with converting JSON into an object?
So in that case JSONReader and JSONPopulator are involved.

[1] https://github.com/apache/struts/blob/aa744b811f9c41b80cc30ad6cf41ccaa75da5323/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java#L290-L312


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Luis Limas <lu...@hotmail.com>.
On 08/08/2014 02:18 a. m., Lukasz Lenart wrote:
> 2014-08-07 22:58 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>> Thanks again for the reply Lukasz, this is the full hierarchy used at JSON
>> in the 1st mail:
>>
>>   * 1st level : http://codeviewer.org/view/code:4279
>>   * 2nd level : http://codeviewer.org/view/code:427a
>>   * 3rd level (issue) : http://codeviewer.org/view/code:427b
>>   * 4th level : http://codeviewer.org/view/code:427c
>>
>>
>> As i told before, the issue is particularly hard to debug (also hard to
>> reproduce) because once Tomcat is reset the bug seems to be repaired,
> Oh... I missed that out. Anyway I think there isn't a good solution
> for you right now. You are using Hibernate entities directly and you
> try to serialize/deserialize them which is always a bad idea ™
>
> JSONWriter (used to serialize) has some logic to detect Javassist
> extended classes but there is no way to do the same in opposite.
>
>
> Regards
Thanks again for the reply Lukasz, you misunderstood me, im not doing 
serialize/deserialize my entities for any logic, the deserialize 
instruction is being called inside struts (Project: Struts 2 JSON 
Plugin, JSONInterceptor.java : 123) when parsing JSON to Map (before 
calling the setters inside JSONReader) and then to Object,  i mentioned 
the deserialize thing because there is where it seems to me that setters 
are not being called. The serialize instruction i only use it for 
debuging purposes so i was able to see how it looks the populated 
(final) object,

The issue seems to be that JSONWriter is not working propely. Also im 
not sure to understand what do you mean with "there's no way to do the 
opposite", isn't JSONReader doing that?

Greetings,

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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Lukasz Lenart <lu...@apache.org>.
2014-08-07 22:58 GMT+02:00 Luis Limas <lu...@hotmail.com>:
> Thanks again for the reply Lukasz, this is the full hierarchy used at JSON
> in the 1st mail:
>
>  * 1st level : http://codeviewer.org/view/code:4279
>  * 2nd level : http://codeviewer.org/view/code:427a
>  * 3rd level (issue) : http://codeviewer.org/view/code:427b
>  * 4th level : http://codeviewer.org/view/code:427c
>
>
> As i told before, the issue is particularly hard to debug (also hard to
> reproduce) because once Tomcat is reset the bug seems to be repaired,

Oh... I missed that out. Anyway I think there isn't a good solution
for you right now. You are using Hibernate entities directly and you
try to serialize/deserialize them which is always a bad idea ™

JSONWriter (used to serialize) has some logic to detect Javassist
extended classes but there is no way to do the same in opposite.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Luis Limas <lu...@hotmail.com>.
On 07/08/2014 01:17 p. m., Lukasz Lenart wrote:
> 2014-08-07 17:04 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>> Thanks for the reply Lukasz, the main issue i am having it's that entity
>> annotated with @MappedSuperClass is not being correctly populated after
>> JSONUtil.deserialize, the issue occurs randomly and only "super" setters are
>> the ones that are not being called,
> Can you post example class hierarchy which I can use to test JSONUtil?
>
>
> Regards
Thanks again for the reply Lukasz, this is the full hierarchy used at 
JSON in the 1st mail:

  * 1st level : http://codeviewer.org/view/code:4279
  * 2nd level : http://codeviewer.org/view/code:427a
  * 3rd level (issue) : http://codeviewer.org/view/code:427b
  * 4th level : http://codeviewer.org/view/code:427c


As i told before, the issue is particularly hard to debug (also hard to 
reproduce) because once Tomcat is reset the bug seems to be repaired,
Greetings,




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

Re: Struts missing parameters

Posted by Lukasz Lenart <lu...@apache.org>.
2014-08-07 17:04 GMT+02:00 Luis Limas <lu...@hotmail.com>:
> Thanks for the reply Lukasz, the main issue i am having it's that entity
> annotated with @MappedSuperClass is not being correctly populated after
> JSONUtil.deserialize, the issue occurs randomly and only "super" setters are
> the ones that are not being called,

Can you post example class hierarchy which I can use to test JSONUtil?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Luis Limas <lu...@hotmail.com>.
On 07/08/2014 12:52 a. m., Lukasz Lenart wrote:
> 2014-08-04 18:37 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>>       =============================================
>>       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
> I don't see "red-id" in POST-DATA section
>
>
> Regards
The mailing list is removing color/bold/italic format. the following 
json-attribute its supposed to have red font color

"id":_41201_

Thanks for the reply Lukasz, the main issue i am having it's that entity annotated with @MappedSuperClass is not being correctly populated after JSONUtil.deserialize, the issue occurs randomly and only "super" setters are the ones that are not being called,

Greetings,


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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts missing parameters

Posted by Lukasz Lenart <lu...@apache.org>.
2014-08-04 18:37 GMT+02:00 Luis Limas <lu...@hotmail.com>:
>      =============================================
>      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

I don't see "red-id" in POST-DATA section


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org