Hello,
I'm seeing NullPointerException thrown by DataSource.addDynamicDSGenerator call when invoked from Servlet.init method during the application startup:
CustomInitServlet is just a way to add my DS generator:
I only see the problem if the servlet is configured to load on startup. Everything works fine if servlet is inited by hitting the mapped url. It seems that DataSource.addDynamicDSGenerator must be called at a particular point in time, not during the application startup. The documentation doesn't specify any particular way this API should be used. What's the correct way to call it?
I'm seeing NullPointerException thrown by DataSource.addDynamicDSGenerator call when invoked from Servlet.init method during the application startup:
Code:
Loading modules com.epacube.ao.approval Validating <servlet> tags for module 'approval' For additional info see: file:/C:/springsource/sts-2.9.2.RELEASE/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201206290132-rel-r37/gwt-2.4.0/doc/helpInfo/servletMappings.html [WARN] Module declares a servlet class 'com.google.gwt.junit.server.JUnitHostImpl', but the web.xml has no corresponding declaration; please add the following lines to your web.xml: <servlet> <servlet-name>jUnitHostImpl</servlet-name> <servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>jUnitHostImpl</servlet-name> <url-pattern>/approval/junithost/*</url-pattern> </servlet-mapping> ISC: Configuring log4j from: file:/C:/workspace-sts-2.9.2-epacube-omm/omm/target/omm-1.0-SNAPSHOT/WEB-INF/classes/log4j.isc.config.xml === 2012-09-22 10:29:58,019 [main] INFO ISCInit - Isomorphic SmartClient/SmartGWT Framework initialization called from [No class name provided] === 2012-09-22 10:29:58,020 [main] INFO ISCInit - Isomorphic SmartClient/SmartGWT Framework - Initializing === 2012-09-22 10:29:58,024 [main] INFO ConfigLoader - Attempting to load framework.properties from CLASSPATH === 2012-09-22 10:29:58,136 [main] INFO ConfigLoader - Successfully loaded framework.properties from CLASSPATH at location: jar:file:/C:/workspace-sts-2.9.2-epacube-omm/omm/target/omm-1.0-SNAPSHOT/WEB-INF/lib/isomorphic-core-rpc-3.1.d20120921.jar!/framework.properties === 2012-09-22 10:29:58,136 [main] INFO ConfigLoader - Attempting to load project.properties from CLASSPATH === 2012-09-22 10:29:58,136 [main] INFO ConfigLoader - Unable to locate project.properties in CLASSPATH === 2012-09-22 10:29:58,141 [main] INFO ConfigLoader - Successfully loaded isc_interfaces.properties from CLASSPATH at location: jar:file:/C:/workspace-sts-2.9.2-epacube-omm/omm/target/omm-1.0-SNAPSHOT/WEB-INF/lib/isomorphic-core-rpc-3.1.d20120921.jar!/isc_interfaces.properties === 2012-09-22 10:29:58,141 [main] INFO ConfigLoader - Attempting to load server.properties from CLASSPATH === 2012-09-22 10:29:58,144 [main] INFO ConfigLoader - Successfully loaded server.properties from CLASSPATH at location: file:/C:/workspace-sts-2.9.2-epacube-omm/omm/target/omm-1.0-SNAPSHOT/WEB-INF/classes/server.properties === 2012-09-22 10:29:58,169 [main] INFO Logger - Logging system started. === 2012-09-22 10:29:58,170 [main] INFO ISCInit - Isomorphic SmartClient/SmartGWT Framework (SNAPSHOT_v8.3d_2012-09-21/EVAL Deployment 2012-09-21) - Initialization Complete === 2012-09-22 10:29:58,173 [main] ERROR ISCInit - Can't find marker file for webRoot: C:/workspace-sts-2.9.2-epacube-omm/omm/target/omm-1.0-SNAPSHOT/approval/sc for configured/autodetected webRoot - if you moved the 'isomorphic' directory, please set isomorphicPathRootRelative in server.properties to the new location and restart the servlet engine. === 2012-09-22 10:29:58,173 [main] INFO ISCInit - WebRoot auto-detection failed - using container IO === 2012-09-22 10:29:58,190 [main] INFO ISCInit - Isomorphic SmartClient/SmartGWT Framework initialization called from com.isomorphic.base.Base === 2012-09-22 10:29:58,190 [main] INFO ISCInit - Isomorphic SmartClient/SmartGWT Framework is already initialized Problem loading builtinTypes.xml Exception when loading from __USE_CONTAINER__/approval/sc/system/schema/builtinTypes.xml: java.lang.NullPointerException at com.isomorphic.io.ISCFile.lastModified(ISCFile.java:419) at com.isomorphic.store.ProcessedFileCache.getObjectFromFile(ProcessedFileCache.java:131) at com.isomorphic.store.ProcessedFileCache.getObjectFromFile(ProcessedFileCache.java:74) at com.isomorphic.store.ProcessedFileCache.getObjectFromFile(ProcessedFileCache.java:138) at com.isomorphic.xml.XML.getXMLDocument(XML.java:255) at com.isomorphic.xml.XML.toDSRecords(XML.java:263) at com.isomorphic.xml.XML.toDSRecords(XML.java:266) at com.isomorphic.datasource.DataSource.<clinit>(DataSource.java:581) at com.epacube.ao.server.CustomInitServlet.init(CustomInitServlet.java:14) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433) at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:616) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448) at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:222) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672) at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509) at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068) at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811) at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Code:
public class CustomInitServlet extends HttpServlet { @Override public void init() throws ServletException { DataSource.addDynamicDSGenerator(new SchemaAwareDSGenerator(), "dynamic_"); } }
Comment