Announcement

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

    RESTHandler and DynamicDataSource get NullPointerException

    I have configured a subclass of RESTHandler in my web.xml and have overridden the processRequest method to add a call to DataSource.addDynamicDSGenerator to register my ds generator. But when I make a POST request I get this null pointer error.
    Code:
    java.lang.NullPointerException
    	at com.isomorphic.datasource.PoolableDataSourceFactory.makeUnpooledObject(PoolableDataSourceFactory.java:130)
    	at com.isomorphic.pool.PoolManager.borrowUnpooledObject(PoolManager.java:123)
    	at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:93)
    	at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:86)
    	at com.isomorphic.datasource.DataSourceManager.get(DataSourceManager.java:118)
    	at com.isomorphic.rpc.RestRequestParser.parseRequest(RestRequestParser.java:378)
    	at com.isomorphic.rpc.RPCManager.<init>(RPCManager.java:308)
    	at com.isomorphic.servlet.RESTHandler.processRequest(RESTHandler.java:306)
    	at com.islandpacific.gui.server.IpRESTHandler.processRequest(IpRESTHandler.java:39)
    	at com.isomorphic.servlet.RESTHandler.doPost(RESTHandler.java:258)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097)
    	at com.islandpacific.gui.server.GWTCacheControlFilter.doFilter(GWTCacheControlFilter.java:44)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
    	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:355)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at com.islandpacific.gui.security.IpConcurrentSessionFilter.doFilter(IpConcurrentSessionFilter.java:55)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:247)
    	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    	at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    	at org.mortbay.jetty.Server.handle(Server.java:324)
    	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    The content of my http POST looks correct.
    Code:
    {data:{_constructor:"AdvancedCriteria",operator:"and",criteria:[{fieldName:"description",operator:"iContains",value:"TUNIC"},{fieldName:"showNoteCategory",operator:"equals",value:"WEB"}]},dataSource:"Product",operationType:"fetch"}
    What could be causing the npe?

    #2
    Is this happening before the Init servlet has run? That would cause issues.

    Comment


      #3
      No. Init has run. This is the full log leading up to the error. You can see that other server-side DSRequests have been processed sucessfully as part of the login request. But then when a request comes in for one of the dynamic datasources it gets the error, which is what led me to think they might be related.
      Code:
      === 2014-03-10 15:12:33,491 [ad-1] INFO  ContextLoader - Root WebApplicationContext: initialization started
      === 2014-03-10 15:12:33,541 [ad-1] INFO  XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Mon Mar 10 15:12:33 CDT 2014]; root of context hierarchy
      === 2014-03-10 15:12:33,651 [ad-1] INFO  XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
      === 2014-03-10 15:12:34,339 [ad-1] INFO  HttpSecurityBeanDefinitionParser - Checking sorted filter chain: [<concurrencyFilter>, order = 200, Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 300, Root bean: class [org.springframework.security.web.authentication.logout.LogoutFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 400, <formLoginFilter>, order = 800, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1300, Root bean: class [org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1400, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1700, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1800, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 1900]
      === 2014-03-10 15:12:34,619 [ad-1] INFO  DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@438c1676: defining beans [org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.config.http.UserDetailsServiceInjectionBeanPostProcessor#0,org.springframework.security.filterChainProxy,authenticationEntryPoint,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,userDetailsAuthenticationProvider,formLoginFilter,accessDeniedHandler,concurrencyFilter,sessionAuthenticationStrategy,sessionRegistry,logoutSuccessHandler]; root of factory hierarchy
      === 2014-03-10 15:12:34,897 [ad-1] INFO  FilterSecurityInterceptor - Validated configuration attributes
      ISC: Configuring log4j from: file:/Users/jfisher/Documents/juno-workspace/IPGui_trunk/war/WEB-INF/classes/log4j.isc.config.xml
      === 2014-03-10 15:12:35,195 [ad-1] INFO  ContextLoader - Root WebApplicationContext: initialization completed in 1704 ms
      === 2014-03-10 15:12:35,210 [ad-1] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework - Initializing
      === 2014-03-10 15:12:35,316 [ad-1] INFO  ConfigLoader - Attempting to load framework.properties from CLASSPATH
      === 2014-03-10 15:12:35,564 [ad-1] INFO  ConfigLoader - Successfully loaded framework.properties from CLASSPATH at location: jar:file:/Users/jfisher/Documents/juno-workspace/IPGui_trunk/war/WEB-INF/lib/isomorphic_core_rpc.jar!/framework.properties
      === 2014-03-10 15:12:35,564 [ad-1] INFO  ConfigLoader - Attempting to load project.properties from CLASSPATH
      === 2014-03-10 15:12:35,566 [ad-1] INFO  ConfigLoader - Unable to locate project.properties in CLASSPATH
      === 2014-03-10 15:12:35,574 [ad-1] INFO  ConfigLoader - Successfully loaded isc_interfaces.properties from CLASSPATH at location: jar:file:/Users/jfisher/Documents/juno-workspace/IPGui_trunk/war/WEB-INF/lib/isomorphic_core_rpc.jar!/isc_interfaces.properties
      === 2014-03-10 15:12:35,575 [ad-1] INFO  ConfigLoader - Attempting to load server.properties from CLASSPATH
      === 2014-03-10 15:12:35,613 [ad-1] INFO  ConfigLoader - Successfully loaded server.properties from CLASSPATH at location: file:/Users/jfisher/Documents/juno-workspace/IPGui_trunk/war/WEB-INF/classes/server.properties
      === 2014-03-10 15:12:35,634 [ad-1] INFO  Logger - Logging system started.
      === 2014-03-10 15:12:35,636 [ad-1] INFO  ISCInit - Auto-detected webRoot - using: /Users/jfisher/Documents/juno-workspace/IPGui_trunk/war
      === 2014-03-10 15:12:35,638 [ad-1] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework (v9.0p_2013-11-14/PowerEdition Deployment 2013-11-14) - Initialization Complete
      === 2014-03-10 15:12:35,841 [ad-1] INFO  DispatcherServlet - FrameworkServlet 'ipgui': initialization started
      === 2014-03-10 15:12:35,842 [ad-1] INFO  XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'ipgui-servlet': startup date [Mon Mar 10 15:12:35 CDT 2014]; parent: Root WebApplicationContext
      === 2014-03-10 15:12:35,843 [ad-1] INFO  XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/ipgui-servlet.xml]
      === 2014-03-10 15:12:35,891 [ad-1] INFO  DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3286a398: defining beans [viewResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@438c1676
      === 2014-03-10 15:12:35,986 [ad-1] INFO  DispatcherServlet - FrameworkServlet 'ipgui': initialization completed in 145 ms
      === 2014-03-10 15:12:36,096 [ad-1] INFO  PreCache - Isomorphic PreCache servlet loading
      === 2014-03-10 15:12:36,306 [ad-1] INFO  PoolManager - SmartClient pooling started for 'simpleTypes' objects
      === 2014-03-10 15:12:38,196 [ad-1] INFO  PreCache - Isomorphic PreCache complete (2098ms)
      Executing AS/400 command: CHGCURLIB CURLIB(IPUIFILA)
      === 2014-03-10 15:12:51,497 [ad-1] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {name:"IPMS"}	values: {name:"IPMS"}
      === 2014-03-10 15:12:51,508 [ad-1] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:12:51,598 [ad-1] INFO  SQLDataSource - [builtinApplication.null] 47: Executing SQL query on 'ipGui': SELECT application.description, application.id, application.name FROM application WHERE (application.name='IPMS')
      === 2014-03-10 15:12:51,674 [ad-1] INFO  PoolManager - [builtinApplication.null] SmartClient pooling started for 'ipGui' objects
      === 2014-03-10 15:12:53,545 [ad-1] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT application.description, application.id, application.name FROM application WHERE (application.name='IPMS')
      === 2014-03-10 15:12:54,029 [ad-1] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:12:54,044 [ad-1] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {name:"iptsfiln"}	values: {name:"iptsfiln"}
      === 2014-03-10 15:12:54,044 [ad-1] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:12:54,045 [ad-1] INFO  SQLDataSource - [builtinApplication.null] 48: Executing SQL query on 'ipGui': SELECT environment.applicationId, environment.dbase, environment.description, environment.id, environment.name, environment.offline FROM environment WHERE (environment.name='iptsfiln')
      === 2014-03-10 15:12:54,045 [ad-1] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT environment.applicationId, environment.dbase, environment.description, environment.id, environment.name, environment.offline FROM environment WHERE (environment.name='iptsfiln')
      === 2014-03-10 15:12:54,506 [ad-1] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:12:54,533 [ad-1] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {id:0}	values: {id:0}
      === 2014-03-10 15:12:54,533 [ad-1] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:12:54,534 [ad-1] INFO  SQLDataSource - [builtinApplication.null] 47: Executing SQL query on 'ipGui': SELECT application.description, application.id, application.name FROM application WHERE (application.id=0)
      === 2014-03-10 15:12:54,534 [ad-1] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT application.description, application.id, application.name FROM application WHERE (application.id=0)
      === 2014-03-10 15:12:54,937 [ad-1] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:12:54,945 [ad-1] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {name:"User"}	values: {name:"User"}
      === 2014-03-10 15:12:54,949 [ad-1] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:12:54,949 [ad-1] INFO  SQLDataSource - [builtinApplication.null] 49: Executing SQL query on 'ipGui': SELECT role.description, role.id, role.name FROM role WHERE (role.name='User')
      === 2014-03-10 15:12:54,949 [ad-1] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT role.description, role.id, role.name FROM role WHERE (role.name='User')
      === 2014-03-10 15:12:55,329 [ad-1] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:12:55,337 [ad-1] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {name:"IPMS"}	values: {name:"IPMS"}
      === 2014-03-10 15:12:55,337 [ad-1] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:12:55,338 [ad-1] INFO  SQLDataSource - [builtinApplication.null] 47: Executing SQL query on 'ipGui': SELECT application.description, application.id, application.name FROM application WHERE (application.name='IPMS')
      === 2014-03-10 15:12:55,338 [ad-1] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT application.description, application.id, application.name FROM application WHERE (application.name='IPMS')
      === 2014-03-10 15:12:55,729 [ad-1] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:12:55,731 [ad-1] INFO  IpAuthenticationManager - Refreshing system activities.
      === 2014-03-10 15:12:55,769 [ad-1] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {applicationId:0,isSystemGenerated:1}	values: {applicationId:0,isSystemGenerated:1}
      === 2014-03-10 15:12:55,769 [ad-1] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:12:55,770 [ad-1] INFO  SQLDataSource - [builtinApplication.null] 51: Executing SQL query on 'ipGui': SELECT activity.applicationId, activity.description, activity.id, activity.isSystemGenerated, activity.name FROM activity WHERE (activity.applicationId=0 AND activity.isSystemGenerated=1)
      === 2014-03-10 15:12:55,770 [ad-1] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT activity.applicationId, activity.description, activity.id, activity.isSystemGenerated, activity.name FROM activity WHERE (activity.applicationId=0 AND activity.isSystemGenerated=1)
      === 2014-03-10 15:12:56,154 [ad-1] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 195 items
      === 2014-03-10 15:12:56,160 [ad-1] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {}	values: {}
      === 2014-03-10 15:12:56,161 [ad-1] INFO  SQLWhereClause - [builtinApplication.null] empty condition
      === 2014-03-10 15:12:56,161 [ad-1] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:12:56,161 [ad-1] INFO  SQLDataSource - [builtinApplication.null] 48: Executing SQL query on 'ipGui': SELECT environment.applicationId, environment.dbase, environment.description, environment.id, environment.name, environment.offline FROM environment WHERE ('1'='1')
      === 2014-03-10 15:12:56,161 [ad-1] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT environment.applicationId, environment.dbase, environment.description, environment.id, environment.name, environment.offline FROM environment WHERE ('1'='1')
      === 2014-03-10 15:12:56,592 [ad-1] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 17 items
      === 2014-03-10 15:12:56,593 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfilx
      === 2014-03-10 15:12:56,593 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfilx.system not found in server.properties
      === 2014-03-10 15:12:56,593 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfilo
      Executing AS/400 command: CHGCURLIB CURLIB(IPSRFILO)
      Executing AS/400 command: CHGCURLIB CURLIB(IPSRFILO)
      === 2014-03-10 15:13:01,756 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfil4
      === 2014-03-10 15:13:01,756 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfil4.system not found in server.properties
      === 2014-03-10 15:13:01,756 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfilp
      === 2014-03-10 15:13:01,756 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfilp.system not found in server.properties
      === 2014-03-10 15:13:01,756 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfil5
      === 2014-03-10 15:13:01,756 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfil5.system not found in server.properties
      === 2014-03-10 15:13:01,756 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfil3
      === 2014-03-10 15:13:01,756 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfil3.system not found in server.properties
      === 2014-03-10 15:13:01,757 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfilz
      === 2014-03-10 15:13:01,757 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfilz.system not found in server.properties
      === 2014-03-10 15:13:01,757 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfilr
      === 2014-03-10 15:13:01,757 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfilr.system not found in server.properties
      === 2014-03-10 15:13:01,757 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfiln
      Executing AS/400 command: CHGCURLIB CURLIB(IPSRFILN)
      Executing AS/400 command: CHGCURLIB CURLIB(IPSRFILN)
      === 2014-03-10 15:13:05,114 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfily
      === 2014-03-10 15:13:05,114 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfily.system not found in server.properties
      === 2014-03-10 15:13:05,114 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfil6
      === 2014-03-10 15:13:05,114 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfil6.system not found in server.properties
      === 2014-03-10 15:13:05,114 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfil
      === 2014-03-10 15:13:05,115 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfil.system not found in server.properties
      === 2014-03-10 15:13:05,115 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfil2
      Executing AS/400 command: CHGCURLIB CURLIB(IPSRFIL2)
      Executing AS/400 command: CHGCURLIB CURLIB(IPSRFIL2)
      === 2014-03-10 15:13:08,420 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfill
      === 2014-03-10 15:13:08,420 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfill.system not found in server.properties
      === 2014-03-10 15:13:08,420 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfili
      Executing AS/400 command: CHGCURLIB CURLIB(IPSRFILI)
      Executing AS/400 command: CHGCURLIB CURLIB(IPSRFILI)
      === 2014-03-10 15:13:12,078 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfil7
      === 2014-03-10 15:13:12,078 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfil7.system not found in server.properties
      === 2014-03-10 15:13:12,079 [ad-1] INFO  IpAuthenticationManager - Checking environment iptsfilc
      === 2014-03-10 15:13:12,079 [ad-1] WARN  IpAuthenticationManager - Property native.iptsfilc.system not found in server.properties
      === 2014-03-10 15:13:12,080 [ad-1] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {name:"IPMS"}	values: {name:"IPMS"}
      === 2014-03-10 15:13:12,080 [ad-1] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:13:12,081 [ad-1] INFO  SQLDataSource - [builtinApplication.null] 47: Executing SQL query on 'ipGui': SELECT application.description, application.id, application.name FROM application WHERE (application.name='IPMS')
      === 2014-03-10 15:13:12,081 [ad-1] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT application.description, application.id, application.name FROM application WHERE (application.name='IPMS')
      === 2014-03-10 15:13:12,421 [ad-1] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:13:12,422 [ad-1] INFO  IpAuthenticationManager - Refreshing system activities.
      === 2014-03-10 15:13:12,422 [ad-1] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {applicationId:0,isSystemGenerated:1}	values: {applicationId:0,isSystemGenerated:1}
      === 2014-03-10 15:13:12,423 [ad-1] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:13:12,423 [ad-1] INFO  SQLDataSource - [builtinApplication.null] 51: Executing SQL query on 'ipGui': SELECT activity.applicationId, activity.description, activity.id, activity.isSystemGenerated, activity.name FROM activity WHERE (activity.applicationId=0 AND activity.isSystemGenerated=1)
      === 2014-03-10 15:13:12,424 [ad-1] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT activity.applicationId, activity.description, activity.id, activity.isSystemGenerated, activity.name FROM activity WHERE (activity.applicationId=0 AND activity.isSystemGenerated=1)
      === 2014-03-10 15:13:12,793 [ad-1] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 195 items
      SLF4J: Class path contains multiple SLF4J bindings.
      SLF4J: Found binding in [jar:file:/Users/jfisher/Documents/juno-workspace/IPGui_trunk/war/WEB-INF/lib/activemq-all-5.6.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: Found binding in [jar:file:/Users/jfisher/Documents/juno-workspace/IPGui_trunk/war/WEB-INF/lib/slf4j-log4j12-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
      === 2014-03-10 15:13:12,845 [ad-1] INFO  StdSchedulerFactory - Using default implementation for ThreadExecutor
      === 2014-03-10 15:13:12,884 [ad-1] INFO  SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
      === 2014-03-10 15:13:12,886 [ad-1] INFO  QuartzScheduler - Quartz Scheduler v.2.1.3 created.
      === 2014-03-10 15:13:12,889 [ad-1] INFO  RAMJobStore - RAMJobStore initialized.
      === 2014-03-10 15:13:12,891 [ad-1] INFO  QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.1.3) 'IPScheduler' with instanceId 'NON_CLUSTERED'
        Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
        NOT STARTED.
        Currently in standby mode.
        Number of jobs executed: 0
        Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 3 threads.
        Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
      
      === 2014-03-10 15:13:12,891 [ad-1] INFO  StdSchedulerFactory - Quartz scheduler 'IPScheduler' initialized from the specified file : 'server.properties' from the class resource path.
      === 2014-03-10 15:13:12,891 [ad-1] INFO  StdSchedulerFactory - Quartz scheduler version: 2.1.3
      === 2014-03-10 15:13:12,892 [ad-1] INFO  QuartzScheduler - Scheduler IPScheduler_$_NON_CLUSTERED started.
      === 2014-03-10 15:13:12,901 [ad-1] INFO  QuartzScheduler - Scheduler IPScheduler_$_NON_CLUSTERED started.
      === 2014-03-10 15:13:12,907 [ad-1] INFO  QuartzScheduler - Scheduler IPScheduler_$_NON_CLUSTERED started.
      === 2014-03-10 15:18:57,684 [l0-0] INFO  RequestContext - URL: '/j_spring_security_check', User-Agent: 'Jakarta Commons-HttpClient/3.1': Unsupported WITHOUT Accept-Encoding header
      === 2014-03-10 15:18:57,702 [l0-0] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {name:"iptsfilo"}	values: {name:"iptsfilo"}
      === 2014-03-10 15:18:57,703 [l0-0] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:18:57,704 [l0-0] INFO  SQLDataSource - [builtinApplication.null] 48: Executing SQL query on 'ipGui': SELECT environment.applicationId, environment.dbase, environment.description, environment.id, environment.name, environment.offline FROM environment WHERE (environment.name='iptsfilo')
      === 2014-03-10 15:18:57,704 [l0-0] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT environment.applicationId, environment.dbase, environment.description, environment.id, environment.name, environment.offline FROM environment WHERE (environment.name='iptsfilo')
      === 2014-03-10 15:18:58,042 [l0-0] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:18:59,763 [l0-0] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {code:"IPGUI"}	values: {code:"IPGUI"}
      === 2014-03-10 15:18:59,764 [l0-0] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:18:59,764 [l0-0] INFO  SQLDataSource - [builtinApplication.null] 52: Executing SQL query on 'ipGui': SELECT ipuser.code, ipuser.email, ipuser.id, ipuser.name FROM ipuser WHERE (ipuser.code='IPGUI')
      === 2014-03-10 15:18:59,764 [l0-0] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT ipuser.code, ipuser.email, ipuser.id, ipuser.name FROM ipuser WHERE (ipuser.code='IPGUI')
      === 2014-03-10 15:19:00,476 [l0-0] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:19:00,486 [l0-0] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {userId:29,environmentId:0}	values: {userId:29,environmentId:0}
      === 2014-03-10 15:19:00,487 [l0-0] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:19:00,487 [l0-0] INFO  SQLDataSource - [builtinApplication.null] 53: Executing SQL query on 'ipGui': SELECT userrole.environmentId, userrole.id, userrole.roleId, userrole.userId FROM userrole WHERE (userrole.userId=29 AND userrole.environmentId=0)
      === 2014-03-10 15:19:00,487 [l0-0] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT userrole.environmentId, userrole.id, userrole.roleId, userrole.userId FROM userrole WHERE (userrole.userId=29 AND userrole.environmentId=0)
      === 2014-03-10 15:19:00,814 [l0-0] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:19:00,816 [l0-0] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {id:0}	values: {id:0}
      === 2014-03-10 15:19:00,816 [l0-0] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:19:00,817 [l0-0] INFO  SQLDataSource - [builtinApplication.null] 49: Executing SQL query on 'ipGui': SELECT role.description, role.id, role.name FROM role WHERE (role.id=0)
      === 2014-03-10 15:19:00,817 [l0-0] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT role.description, role.id, role.name FROM role WHERE (role.id=0)
      === 2014-03-10 15:19:01,154 [l0-0] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:19:01,167 [l0-0] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {name:"User"}	values: {name:"User"}
      === 2014-03-10 15:19:01,168 [l0-0] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
      === 2014-03-10 15:19:01,168 [l0-0] INFO  SQLDataSource - [builtinApplication.null] 49: Executing SQL query on 'ipGui': SELECT role.description, role.id, role.name FROM role WHERE (role.name='User')
      === 2014-03-10 15:19:01,170 [l0-0] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': SELECT role.description, role.id, role.name FROM role WHERE (role.name='User')
      === 2014-03-10 15:19:01,475 [l0-0] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 1 items
      === 2014-03-10 15:19:01,491 [l0-0] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
      	criteria: {userId:29}	values: {userId:29}
      === 2014-03-10 15:19:01,505 [l0-0] INFO  SQLDataSource - [builtinApplication.null] 55: Executing SQL query on 'ipGui': select componentName, roleName, configurationString
      					  from (
      					  	/* get with the saved state per component for this user */
      						select 1 as level, '' as roleName, useruistate.componentName as componentName, configurationString
      						from useruistate join uistate on useruistate.uistateid = uistate.id
      						where userid = 29
      						union
      						/* combine with the latest saved state per component for any role this user is assigned */
      						select 2 as level, name as roleName, T1.componentName as componentName, configurationString
      						from roleuistate as T1 
      							join uistate on T1.uistateid = uistate.id
      							join role on T1.roleid = role.id
      						where roleid in
      						        (select roleid from userrole where userid = 29)
      						    and uistate.lastSaveTime =
      						    ( select max(uistate.lastSaveTime)
      						        from roleuistate as T2
      									join uistate on T2.uistateid = uistate.id
      						        where T1.componentName = T2.componentName and roleid in
      						        (select roleid from userrole where userid = 29))
      					  ) as X1
      					 where level =
      					     ( select min(level)
      					         from (
      						  	/* get with the saved state per component for this user */
      							select 1 as level, '' as roleName, useruistate.componentName as componentName
      							from useruistate join uistate on useruistate.uistateid = uistate.id
      							where userid = 29
      							union
      							/* combine with the latest saved state per component for any role this user is assigned */
      							select 2 as level, name as roleName, T1.componentName as componentName
      							from roleuistate as T1 
      								join uistate on T1.uistateid = uistate.id
      								join role on T1.roleid = role.id
      							where roleid in
      							        (select roleid from userrole where userid = 29)
      							    and uistate.lastSaveTime =
      							    ( select max(uistate.lastSaveTime)
      							        from roleuistate as T2
      										join uistate on T2.uistateid = uistate.id
      							        where T1.componentName = T2.componentName and roleid in
      							        (select roleid from userrole where userid = 29))
      					       ) as X2
      					        where X1.componentName=X2.componentName)
      === 2014-03-10 15:19:01,505 [l0-0] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'ipGui': select componentName, roleName, configurationString
      					  from (
      					  	/* get with the saved state per component for this user */
      						select 1 as level, '' as roleName, useruistate.componentName as componentName, configurationString
      						from useruistate join uistate on useruistate.uistateid = uistate.id
      						where userid = 29
      						union
      						/* combine with the latest saved state per component for any role this user is assigned */
      						select 2 as level, name as roleName, T1.componentName as componentName, configurationString
      						from roleuistate as T1 
      							join uistate on T1.uistateid = uistate.id
      							join role on T1.roleid = role.id
      						where roleid in
      						        (select roleid from userrole where userid = 29)
      						    and uistate.lastSaveTime =
      						    ( select max(uistate.lastSaveTime)
      						        from roleuistate as T2
      									join uistate on T2.uistateid = uistate.id
      						        where T1.componentName = T2.componentName and roleid in
      						        (select roleid from userrole where userid = 29))
      					  ) as X1
      					 where level =
      					     ( select min(level)
      					         from (
      						  	/* get with the saved state per component for this user */
      							select 1 as level, '' as roleName, useruistate.componentName as componentName
      							from useruistate join uistate on useruistate.uistateid = uistate.id
      							where userid = 29
      							union
      							/* combine with the latest saved state per component for any role this user is assigned */
      							select 2 as level, name as roleName, T1.componentName as componentName
      							from roleuistate as T1 
      								join uistate on T1.uistateid = uistate.id
      								join role on T1.roleid = role.id
      							where roleid in
      							        (select roleid from userrole where userid = 29)
      							    and uistate.lastSaveTime =
      							    ( select max(uistate.lastSaveTime)
      							        from roleuistate as T2
      										join uistate on T2.uistateid = uistate.id
      							        where T1.componentName = T2.componentName and roleid in
      							        (select roleid from userrole where userid = 29))
      					       ) as X2
      					        where X1.componentName=X2.componentName)
      === 2014-03-10 15:19:02,863 [l0-0] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 44 items
      === 2014-03-10 15:19:02,864 [l0-0] INFO  IpAuthenticationManager - User IPGUI logged in to environment iptsfilo
      === 2014-03-10 15:19:07,123 [l0-0] INFO  RequestContext - URL: '/restapi', User-Agent: 'Jakarta Commons-HttpClient/3.1': Unsupported WITHOUT Accept-Encoding header
      === 2014-03-10 15:19:07,130 [l0-0] INFO  DataTools - setProperties: couldn't set:
      {
          defaultDataFormat:"No such property",
          dynamicDataFormatParamName:"No such property",
          wrapJSONResponses:"No such property"
      }
      === 2014-03-10 15:19:20,499 [l0-0] ERROR IpRESTHandler - Top-level servlet error:

      Comment


        #4
        If you make your DynamicDSGenerator into a no-op (always returns null), does that fix the problem?

        If so, the issue is going to be something in the DynamicDSGenerator rather than *just* an override of processRequest, so we'll need to see that.

        Comment


          #5
          My DynamicDSGenerator never gets called. The npe is happening before it gets called.

          Comment


            #6
            What exact version of the product are you using?

            Comment


              #7
              SmartClient Version: v9.0p_2013-11-14/PowerEdition Deployment (built 2013-11-14)

              Comment


                #8
                OK, we see the problem - it is a bug in the codepath that is being followed because of the introduction of the DynamicDSGenerator (even though it hasn't actually been called yet). The fix is simple, but once you get past the NPE, your DynamicDSGenerator is going to be called without a context DSRequest, because the call is taking place as part of the parsing we do to construct the DSRequest.

                If your DynamicDSGenerator can do its thing without needing the DSRequest for context, fine. If not, please explain what you are trying to achieve so we can recommend the best thing to do.

                Thanks,
                Isomorphic Software Support

                Comment


                  #9
                  We don't need the DSRequest for context. There is only one edge case where we look at the request and we can surround it with if (request!=null)

                  Comment


                    #10
                    Actually, spoke too soon on this. There is no obvious bug in that codepath. We're investigating other possibilities.

                    Couple of questions - does this error reliably reproduce or is it intermittent? And does your RESTHandler subclass register the DynamicDSGenerator again for every incoming request, or do you have some mechanism to make sure it only happens once?

                    Comment


                      #11
                      Also, can you please share the source for "com.islandpacific.gui.server.IpRESTHandler"? Email it to support@isomorphic.com, referencing this thread, if you don't want to post it publicly.

                      Comment


                        #12
                        It happens every time. Here is the source for our rest handler. FYI - IpDynamicDataSource is the same ds generator we use for the rest of our app.
                        Code:
                        package com.islandpacific.gui.server;
                        
                        import java.io.IOException;
                        
                        import javax.servlet.ServletException;
                        import javax.servlet.http.HttpServletRequest;
                        import javax.servlet.http.HttpServletResponse;
                        
                        import com.islandpacific.gui.security.IpAuthenticationManager;
                        import com.islandpacific.gui.server.customDataSource.IpDynamicDataSource;
                        import com.isomorphic.datasource.DataSource;
                        import com.isomorphic.log.Logger;
                        import com.isomorphic.servlet.RESTHandler;
                        
                        public class IpRESTHandler extends RESTHandler {
                        
                        	private final Logger log = new Logger(this.getClass().getCanonicalName());
                        	@Override
                        	public void processRequest(final HttpServletRequest request, final HttpServletResponse response)
                        			throws ServletException, IOException {
                        
                        		/*
                        		 * Ensure that the home path is available to any other code that needs it
                        		 * without having to rely on access to the servlet context.
                        		 */
                        		String homePath = IpAuthenticationManager.getHomePath();
                        		if (homePath == null) {
                        			homePath = getServletContext().getRealPath("/");
                        			synchronized (homePath) {
                        				IpAuthenticationManager.setHomePath(homePath);
                        			}
                        		}
                        		
                        		// Register our dynamic datasource constructor.
                        		DataSource.addDynamicDSGenerator(new IpDynamicDataSource());
                        		
                        		// Let super do it's thing.
                        		super.processRequest(request, response);
                        		
                        	}
                        
                        }

                        Comment


                          #13
                          Hmm. Independently, we created pretty much exactly the same arrangement as this: a RESTHandler subclass that overrides processRequest() to just add a DynamicDSGenerator and then immediately invoke super(). It works fine here, against current 9.0.

                          Could you try your use case with the most recent 9.0 nightly, to make sure we're on the same page?

                          Comment


                            #14
                            I just tried with the latest jars and same error. I've even tried commenting out all code from IpRESTHandler so it effectively just hands off to standard RESTHandler. Also tried changing web.xml so com.isomorphic.servlet.RESTHandler is invoked directly and got same error.

                            Can you tell what exactly is null and what I might be doing environmentally to make it so?
                            Last edited by jay.l.fisher; 11 Mar 2014, 12:34.

                            Comment


                              #15
                              It's mysterious. Only two things are dereferenced on that line, and one of them canno0t possibly be null (or, not to be too hasty, that's how it appears to our analysis so far). The other thing is the dataSource name itself.

                              Are you passing the JSON you showed in HTTP parameters, or in the body of the request? And are you using any of the parameters documented here to configure what the RESTHandler servlet expects in terms of incoming data format?

                              Comment

                              Working...
                              X