Following your advice here: http://forums.smartclient.com/showthread.php?t=26985
I started to write the logging classes but I think there is a smartGWT Bug.
Test case (adapted from the showcase)
WorldDSExport.xml
SQLLoggingDataSource.java:
Testing Module (EntryPoint):
Outcome:
As soon as I take away the serverConstructor="zedes2.server.SqlLoggingDataSource", no error occurs. But if I put the serverConstructor the error shown above occurs.
Using SmartGWT 3.1p EE 21-05-13.
But I also tried with the actual nightly (2013-06-26) and also with the 4.1d (2013-06-27) and still I get this error.
I started to write the logging classes but I think there is a smartGWT Bug.
Test case (adapted from the showcase)
WorldDSExport.xml
Code:
<DataSource ID="worldDSExport" tableName="worldDS" serverType="sql" recordName="country" serverConstructor="zedes2.server.SqlLoggingDataSource" > <fields> <field name="pk" type="sequence" hidden="true" primaryKey="true" /> <field name="countryCode" type="text" required="true" /> <field name="countryName" type="text" required="true" /> <field name="capital" type="text" /> <field name="government" type="text" length="500" /> <field name="continent" type="text" > </field> <field name="independence" type="date" /> <field name="area" type="float" /> <field name="population" type="integer" /> <field name="gdp" type="float" /> <field name="member_g8" type="boolean" /> </fields> <operationBindings> <operationBinding operationType="fetch" operationId="customJSONExport"> <exportResults>true</exportResults> <exportAs>json</exportAs> <exportFilename>Results.txt</exportFilename> <lineBreakStyle>dos</lineBreakStyle> </operationBinding> </operationBindings> </DataSource>
Code:
public class SqlLoggingDataSource extends DataSource { private static final long serialVersionUID = 1363865609764341340L; @Override public DSResponse executeAdd(DSRequest req) throws Exception { DSResponse response = super.executeAdd(req); log(req, response); return response; } public void log(DSRequest request, DSResponse response) { if (response.getAffectedRows()!=0) { System.out.println("execute add"); } } }
Code:
public class TestingModule implements EntryPoint { public void onModuleLoad() { DataSource worldDSExport = DataSource.get("worldDSExport"); final ListGrid countryList = new CountryList(); countryList.setWidth(500); countryList.setAlternateRecordStyles(true); countryList.setDataSource(worldDSExport); countryList.setAutoFetchData(false); countryList.setShowFilterEditor(true); countryList.setFilterOnKeypress(true); countryList.setFetchDelay(500); ListGridField countryName = new ListGridField("countryName", "Country"); ListGridField capital = new ListGridField("capital", "Capital"); countryList.setFields(countryName, capital); countryList.setAutoFitData(Autofit.VERTICAL); countryList.setShowFilterEditor(true); countryList.setAutoFitMaxRecords(10); VLayout layout = new VLayout(15); layout.setAutoHeight(); HLayout formLayout = new HLayout(15); layout.addMember(formLayout); layout.addMember(countryList); Criteria c = new Criteria(); c.addCriteria("continent", "Europe"); countryList.fetchData(c); layout.draw(); } private class CountryList extends ListGrid implements FilterEditorSubmitHandler { DSRequest properties; public CountryList() { properties = new DSRequest(); properties.setOperationType(DSOperationType.FETCH); addFilterEditorSubmitHandler(this); } @Override public void fetchData() { super.fetchData(null, null, properties); } @Override public void onFilterEditorSubmit(FilterEditorSubmitEvent event) { Criteria c = event.getCriteria(); System.out.println("Filter criteria: " + JSON.encode(c.getJsObj())); fetchData(); } }
Code:
=== 2013-06-27 19:10:40,737 [l0-0] DEBUG XML - Parsed XML from C:\Users\Eduardo\git\zedes2\zedes2\war\ds\worldDSExport.ds.xml: 15ms === 2013-06-27 19:10:40,737 [l0-0] ERROR DataSourceLoader - Key[type=com.isomorphic.servlet.DataSourceLoader, annotation=[none]] - Exception while attempting to load a DataSource java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map at com.isomorphic.datasource.DeclarativeSecurity.annotateDataSourceFields(DeclarativeSecurity.java:740) at com.isomorphic.servlet.DataSourceLoader.processRequest(DataSourceLoader.java:135) at com.isomorphic.servlet.DataSourceLoader.doGet(DataSourceLoader.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113) 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.headerComplete(HttpConnection.java:829) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513) 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) === 2013-06-27 19:10:40,737 [l0-0] ERROR DataSourceLoader - Key[type=com.isomorphic.servlet.DataSourceLoader, annotation=[none]] - Top-level servlet error: javax.servlet.ServletException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map at com.isomorphic.datasource.DeclarativeSecurity.annotateDataSourceFields(DeclarativeSecurity.java:740) at com.isomorphic.servlet.DataSourceLoader.processRequest(DataSourceLoader.java:135) at com.isomorphic.servlet.DataSourceLoader.doGet(DataSourceLoader.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113) 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.headerComplete(HttpConnection.java:829) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513) 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) at com.isomorphic.servlet.DataSourceLoader.processRequest(DataSourceLoader.java:185) at com.isomorphic.servlet.DataSourceLoader.doGet(DataSourceLoader.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113) 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.headerComplete(HttpConnection.java:829) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513) 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) === 2013-06-27 19:10:40,737 [l0-0] INFO Compression - /zedes2/sc/DataSourceLoader: 121324 -> 17428 bytes
Using SmartGWT 3.1p EE 21-05-13.
But I also tried with the actual nightly (2013-06-26) and also with the 4.1d (2013-06-27) and still I get this error.
Comment