Announcement

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

    applyWhen 'automatic' fetch and velocity context

    SmartClient Version: SNAPSHOT_v11.1d_2016-12-04/Enterprise Deployment (built 2016-12-04)

    Hello, I've got an error while doing an update operation. Actually it's the same ds of that post http://forums.smartclient.com/forum/...689#post241689
    but it's an update (instead of add) and I've removed the validator on the field which gives the error. That dataSource has got another validator type=required with an applyWhen, and the framework is doing a fetch to retrieve the dependent field value. This fetch has got a velocity expression ($sessionAttributes.ID_TITOLARE_IMPERSONATO_FK) and it's raising an error:

    Code:
    2016-12-05 15:25:25,494 INFO  SQLDataSource [builtinApplication.null] Performing fetch operation with
        criteria: {ID_REC:1}    values: {ID_REC:1} 
    2016-12-05 15:25:25,495 INFO  SQLDataSource [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause, JTK_RUBRICA_TITOLARI WHERE 
                    $defaultWhereClause
                    and JTK_NOMI_TICKET.ID_REC = JTK_RUBRICA_TITOLARI.ID_NOME_RUBRICA_FK (+)
                    
                    and ($sessionAttributes.ID_TITOLARE_IMPERSONATO_FK = JTK_RUBRICA_TITOLARI.ID_TITOLARE_FK or JTK_RUBRICA_TITOLARI.ID_TITOLARE_FK is null)
                 AND $defaultJoinWhereClause 
    2016-12-05 15:25:25,495 WARN  HttpAttributeHandler [builtinApplication.null] In HttpAttributeHandler.get() both request and session were null 
    2016-12-05 15:25:25,497 DEBUG DSRequest About to free up resources for request of type fetch on DataSource JTK_NOMI_TICKET 
    2016-12-05 15:25:25,497 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1493 
    2016-12-05 15:25:25,497 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1494 
    2016-12-05 15:25:25,497 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1495 
    2016-12-05 15:25:25,497 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1495 
    2016-12-05 15:25:25,497 DEBUG PoolableDataSourceFactory Cleared and passivated DataSource 1495 of type 'JPC_NAZIONI_BASE' 
    2016-12-05 15:25:25,498 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1494 
    2016-12-05 15:25:25,498 DEBUG PoolableDataSourceFactory Cleared and passivated DataSource 1494 of type 'JPC_NAZIONI' 
    2016-12-05 15:25:25,498 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1496 
    2016-12-05 15:25:25,498 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1497 
    2016-12-05 15:25:25,498 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1497 
    2016-12-05 15:25:25,498 DEBUG PoolableDataSourceFactory Cleared and passivated DataSource 1497 of type 'JPC_COMUNI_BASE' 
    2016-12-05 15:25:25,498 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1496 
    2016-12-05 15:25:25,498 DEBUG PoolableDataSourceFactory Cleared and passivated DataSource 1496 of type 'JPC_COMUNI' 
    2016-12-05 15:25:25,498 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1493 
    2016-12-05 15:25:25,498 DEBUG SQLDataSource About to clear SQLDriver state for DS instance 1493 
    2016-12-05 15:25:25,498 DEBUG PoolableDataSourceFactory Cleared and passivated DataSource 1493 of type 'JTK_NOMI_TICKET' 
    2016-12-05 15:25:25,498 ERROR StoredRecordHandler Failed to fetch stored record with primary key {ID_REC=1} from data base. Treating as no reocrd. 
    org.apache.velocity.exception.MethodInvocationException: Invocation of method 'get' in  class com.isomorphic.velocity.HttpAttributeHandler threw exception java.lang.Exception: Both request and session were null at fetch[line 5, column 41]
        at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223)
        at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
        at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369)
        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
        at org.apache.velocity.runtime.RuntimeInstance.render(RuntimeInstance.java:1378)
        at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1314)
        at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1265)
        at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:199)
        at com.isomorphic.velocity.Velocity.evaluate(Velocity.java:352)
        at com.isomorphic.velocity.Velocity.evaluateAsString(Velocity.java:287)
        at com.isomorphic.velocity.Velocity.evaluateAsString(Velocity.java:261)
        at com.isomorphic.sql.SQLDataSource.generateSQLStatement(SQLDataSource.java:1456)
        at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1693)
        at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:436)
        at com.isomorphic.sql.SQLDataSource.executeFetch(SQLDataSource.java:381)
        at com.isomorphic.datasource.DataSource.execute(DataSource.java:2226)
        at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:735)
        at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:652)
        at com.isomorphic.application.AppBase.execute(AppBase.java:493)
        at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2785)
        at com.isomorphic.datasource.DataSource.fetchById(DataSource.java:6721)
        at com.isomorphic.velocity.StoredRecordHandler.fetchStoredRecord(StoredRecordHandler.java:188)
        at com.isomorphic.velocity.StoredRecordHandler.size(StoredRecordHandler.java:232)
        at java.util.HashMap.<init>(HashMap.java:294)
        at com.isomorphic.util.DefaultValidators.validateField(DefaultValidators.java:231)
        at com.isomorphic.datasource.SimpleType.validateValue(SimpleType.java:101)
        at com.isomorphic.datasource.SimpleType.create(SimpleType.java:75)
        at com.isomorphic.datasource.BasicDataSource.validateFieldValue(BasicDataSource.java:2229)
        at com.isomorphic.datasource.BasicDataSource.validateFieldValue(BasicDataSource.java:2144)
        at com.isomorphic.datasource.BasicDataSource.toRecord(BasicDataSource.java:1480)
        at com.isomorphic.datasource.BasicDataSource.toRecords(BasicDataSource.java:1417)
        at com.isomorphic.datasource.BasicDataSource.toRecords(BasicDataSource.java:1378)
        at com.isomorphic.datasource.DataSource.validateDSRequest(DataSource.java:3754)
        at com.isomorphic.datasource.DataSource.validateDSRequest(DataSource.java:3699)
        at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:171)
        at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
        at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2781)
        at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:230)
        at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:187)
        at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:152)
        at com.isomorphic.servlet.IDACall._processRequest(IDACall.java:119)
        at com.isomorphic.servlet.IDACall.doPost(IDACall.java:79)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:167)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:200)
        at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:178)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at com.juve.utils.Log4jSessionFilter.doFilter(Log4jSessionFilter.java:65)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at com.isomorphic.js.JSSyntaxScannerFilter._doFilter(JSSyntaxScannerFilter.java:262)
        at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:93)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
        at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:93)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:76)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        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:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
        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:1002)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.Exception: Both request and session were null
        at com.isomorphic.velocity.HttpAttributeHandler.get(HttpAttributeHandler.java:62)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecutor.java:117)
        at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:539)
        at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198)
        ... 109 more
    it seems that the request for this 'automatic' fetch (done for the applyWhen) doesn't have the velocity context initialized.

    #2
    Could you please post the DataSource? We want to see how this fetch is arising. You can email it to support@isomorphic.com if it has confidential content that you don't want to post on the public forums

    Comment


      #3
      Here it is:
      Code:
      <DataSource xmlns:fmt="WEB-INF/" xmlns="http://www.smartclient.com/schema"
                  ID="JTK_NOMI_TICKET"
                  serverType="sql"
                  dbName="dbJpcEP"
                  schema="DBSALES"
                  tableName="JTK_NOMI_TICKET"
                  allowAdvancedCriteria="true"
                  requiresAuthentication="true"
                  dropExtraFields="false"
      >
          <fmt:bundle basename="i18nMessages" encoding="utf-8"/>
          <fields>
              <field sqlType="decimal" primaryKey="true" name="ID_REC" type="sequence" hidden="true" sequenceName="SEQUENCE_ID_JTK"/>
              <field name="NOME" type="capitalizeFullyTrimText" required="true" length="100"/>
              <field name="COGNOME" type="capitalizeFullyTrimText" required="true" length="100"/>
              <field name="DATA_NASCITA" type="date" required="true"/>
              <field name="EMAIL" type="trimText" length="200"/>
              <field name="ID_NAZIONE_FK" type="integer" foreignKey="JPC_NAZIONI.ID_REC" joinType="outer" required="true" displayField="NAZIONE"/>
              <field name="NAZIONE" type="text" includeFrom="JPC_NAZIONI.NOME"/>
              <field name="ID_COMUNE_FK" type="integer" foreignKey="JPC_COMUNI.ID_REC" joinType="outer" displayField="COMUNE">
                   <validators>
                       <validator type="required" stopIfFalse="true" dependentFields="ID_NAZIONE_FK">
                           <applyWhen operator="and">
                               <criteria>
                                   <criterion fieldName="ID_NAZIONE_FK" operator="equals" value="118"/>
                               </criteria>
                           </applyWhen>
                       </validator>
                   </validators>
              </field>
              <field name="COMUNE" type="text" includeFrom="JPC_COMUNI.NOME"/>
              <field name="LOCALITA" type="capitalizeFullyTrimText" length="100">
              </field>
      
              <field name="NOMINATIVO_IN_RUBRICA" type="boolean" sqlStorageStrategy="singleCharTF"
                     customSelectExpression="decode(JTK_RUBRICA_TITOLARI.ID_REC, null, 'F', 'T')"/>
      
              <field name="CREATOR" type="creator" editRequires="false"/>
              <field name="CREATOR_TIMESTAMP" type="creatorTimestamp" editRequires="false"/>
              <field name="MODIFIER" type="modifier" editRequires="false"/>
              <field name="MODIFIER_TIMESTAMP" type="modifierTimestamp" editRequires="false"/>
          </fields>
          <operationBindings>
              <operationBinding operationType="fetch" requiresRole="">
                  <tableClause>$defaultTableClause, JTK_RUBRICA_TITOLARI</tableClause>
                  <whereClause>
                      $defaultWhereClause
                      and JTK_NOMI_TICKET.ID_REC = JTK_RUBRICA_TITOLARI.ID_NOME_RUBRICA_FK (+)
                      and ($sessionAttributes.ID_TITOLARE_IMPERSONATO_FK = JTK_RUBRICA_TITOLARI.ID_TITOLARE_FK or JTK_RUBRICA_TITOLARI.ID_TITOLARE_FK is null)
                  </whereClause>
              </operationBinding>
              <operationBinding operationType="fetch" operationId="fetchAll" requiresRole="ROLE_TICKETING"/>
              <operationBinding operationType="add" requiresRole="ROLE_TICKETING"/>
              <operationBinding operationType="update" requiresRole="ROLE_TICKETING"/>
              <operationBinding operationType="add" operationId="salvaNomeBigliettoPagamento" serverMethod="salvaNomeBigliettoPagamento" requiresRole="">
                  <serverObject lookupStyle="new" className="com.juve.jtk.SalvaNomeBigliettoPagamento"/>
              </operationBinding>
              <operationBinding operationType="update" operationId="salvaNomeBigliettoPagamento" serverMethod="salvaNomeBigliettoPagamento" requiresRole="">
                  <serverObject lookupStyle="new" className="com.juve.jtk.SalvaNomeBigliettoPagamento"/>
              </operationBinding>
              <operationBinding operationType="add" operationId="salvaNomeBigliettoOmaggio" serverMethod="salvaNomeBigliettoOmaggio" requiresRole="">
                  <serverObject lookupStyle="new" className="com.juve.jtk.SalvaNomeBigliettoOmaggio"/>
              </operationBinding>
              <operationBinding operationType="update" operationId="salvaNomeBigliettoOmaggio" serverMethod="salvaNomeBigliettoOmaggio" requiresRole="">
                  <serverObject lookupStyle="new" className="com.juve.jtk.SalvaNomeBigliettoOmaggio"/>
              </operationBinding>
              <operationBinding operationType="remove" requiresRole=""/>
          </operationBindings>
      </DataSource>
      please let me know if you need other details

      Comment


        #4
        We have enhanced the DataSource.fetchById() method to fix this problem. The correction should be in today's (Wednesday) 11.1 / 6.1 builds, please try it out and let us know if you still see a problem

        Comment


          #5
          SmartClient Version: SNAPSHOT_v11.1d_2016-12-15/Enterprise Deployment (built 2016-12-15)

          I can confirm it's fixed, thank you very much.

          Comment

          Working...
          X