Announcement

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

    Problem with Upload File in SQL Server 2008 Back End

    Hi Isomorphic. I have been trying to implement the file upload feature with no success. Specifically, I'm trying to follow this sample, but I keep getting a timeout every time I try to save a file to my SQL Server 2008 DB. Here is my bank_load.ds.xml DataSource declaration:

    Code:
    <DataSource        
        ID="bank_load" 
        serverType="sql" 
        tableName="bank_load" >    
    
        <fields>
            <field name="id" hidden="false" primaryKey="true"/>  
            <field name="file" type="binary"/>
        </fields>
    </DataSource>
    I am following your instructions here, and what troubles me is that you say:
    To use Smart GWT's client-server upload system, you use a DataSource field of type "binary". By default, a DynamicForm bound to a DataSource with a field of type "binary" will use the FileItem, which displays a standard HTML <input type="upload"> form control.
    When you call DynamicForm.saveData() on a DynamicForm containing a FileItem, Smart GWT processes the save identically to a saveData() call that did not include a file upload
    But I can't seem to get the DynamicForm to saveData correctly when I hit the save button. But if I change the bank_load.ds.xml file to be like the following (without including the binary field), now the save operation will work correctly (persisting my manually entered data for the metadata fields created on the table):

    Code:
    <DataSource 
        ID="bank_load" 
        serverType="sql" 
        tableName="bank_load" >
    
        <fields>
            <field name="id" hidden="true" primaryKey="true"/>  
            <field name="file_filename"/>  
            <field name="file_filesize"/>  
            <field name="file_date_created"/> 
        </fields>
    </DataSource>
    Finally, this is the table structure I'm using to back the file upload operation:
    Code:
    CREATE TABLE [dbo].[bank_load](
        [id] [int] IDENTITY(1,1) NOT NULL,
        [file] [binary] NULL,
        [file_filename] [varchar](255) NULL,
        [file_filesize] [numeric](10) NULL,
        [file_date_created] [date] NULL,
        CONSTRAINT bank_load_pk PRIMARY KEY (id)
    )
    Any pointers regarding what am I missing to make this work would be greatly appreciated!

    ps. Here is the full error log (notice that it points to a malformed Update query near the file field... highlighted for your convenience):

    2016-04-04T15:42:33.398-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: host:localhost:8082
    2016-04-04T15:42:33.398-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: connection:keep-alive
    2016-04-04T15:42:33.398-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: content-length:1873
    2016-04-04T15:42:33.398-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: cache-control:max-age=0
    2016-04-04T15:42:33.398-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    2016-04-04T15:42:33.398-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: origin:http://localhost:8082
    2016-04-04T15:42:33.398-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: upgrade-insecure-requests:1
    2016-04-04T15:42:33.398-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: user-agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36
    2016-04-04T15:42:33.398-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: content-type:multipart/form-data; boundary=----WebKitFormBoundaryTbLYn08WBOpt9aVz;charset=UTF-8
    2016-04-04T15:42:33.399-0500|Info: === 2016-04-04 15:42:33,398 [1(3)] DEBUG IDACall - Header Name:Value pair: referer:http://localhost:8082/BMSim/BMSim.html?locale=es
    2016-04-04T15:42:33.399-0500|Info: === 2016-04-04 15:42:33,399 [1(3)] DEBUG IDACall - Header Name:Value pair: accept-encoding:gzip, deflate
    2016-04-04T15:42:33.399-0500|Info: === 2016-04-04 15:42:33,399 [1(3)] DEBUG IDACall - Header Name:Value pair: accept-language:en-US,en;q=0.8
    2016-04-04T15:42:33.399-0500|Info: === 2016-04-04 15:42:33,399 [1(3)] DEBUG IDACall - Header Name:Value pair: cookie:JSESSIONID=2e63e9cc5c82f91753f52b4fe277; isc_cState=ready; GLog=%7B%0A%20%20%20%20trackRPC%3Atrue%2C%20%0A%20%20%20%20isc_pageURL%3A%22http%3A//localhost%3A8082/BMSim/BMSim.html%3Flocale%3Des%22%2C%20%0A%20%20%20%20isc_pageGUID%3A%22CE4CC82E-16F5-4E36-8DF0-BD5AAD02E0AD%22%2C%20%0A%20%20%20%20priorityDefaults%3A%7B%0A%20%20%20%20%20%20%20%20sgwtInternal%3A1%2C%20%0A%20%20%20%20%20%20%20%20sizing%3A5%0A%20%20%20%20%7D%2C%20%0A%20%20%20%20defaultPriority%3A3%2C%20%0A%20%20%20%20left%3A-967%2C%20%0A%20%20%20%20top%3A0%2C%20%0A%20%20%20%20width%3A958%2C%20%0A%20%20%20%20height%3A1021%0A%7D
    2016-04-04T15:42:33.399-0500|Info: === 2016-04-04 15:42:33,399 [1(3)] DEBUG IDACall - session exists: 2e63e9cc5c82f91753f52b4fe277
    2016-04-04T15:42:33.399-0500|Info: === 2016-04-04 15:42:33,399 [1(3)] DEBUG IDACall - remote user: carlos.sierra
    2016-04-04T15:42:33.399-0500|Info: === 2016-04-04 15:42:33,399 [1(3)] INFO RequestContext - URL: '/BMSim/bmsim/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36': Safari with Accept-Encoding header
    2016-04-04T15:42:33.405-0500|Info: === 2016-04-04 15:42:33,405 [1(3)] DEBUG XML - Parsed XML from (in memory stream): 3ms
    2016-04-04T15:42:33.405-0500|Info: === 2016-04-04 15:42:33,405 [1(3)] DEBUG ISCKeyedObjectPool - Borrowing object for 'transaction'
    2016-04-04T15:42:33.405-0500|Info: === 2016-04-04 15:42:33,405 [1(3)] DEBUG PoolableDataSourceFactory - Tried to create DataSource of type 'transaction' but null was returned
    2016-04-04T15:42:33.405-0500|Info: === 2016-04-04 15:42:33,405 [1(3)] DEBUG PoolableDataSourceFactory - Created DataSource null of type 'transaction' in the pooling flow
    2016-04-04T15:42:33.405-0500|Info: === 2016-04-04 15:42:33,405 [1(3)] DEBUG ISCKeyedObjectPool - Borrowing object for 'Object'
    2016-04-04T15:42:33.405-0500|Info: === 2016-04-04 15:42:33,405 [1(3)] DEBUG PoolableDataSourceFactory - Created DataSource 48 of type 'Object' and assigned it to thread http-listener-1(3)
    2016-04-04T15:42:33.405-0500|Info: === 2016-04-04 15:42:33,405 [1(3)] DEBUG PoolableDataSourceFactory - Created DataSource 48 of type 'Object' in the pooling flow
    2016-04-04T15:42:33.406-0500|Info: === 2016-04-04 15:42:33,406 [1(3)] DEBUG PoolableDataSourceFactory - Activated DataSource 48 of type 'Object'
    2016-04-04T15:42:33.406-0500|Info: === 2016-04-04 15:42:33,406 [1(3)] DEBUG ISCKeyedObjectPool - Borrowing object for 'List'
    2016-04-04T15:42:33.408-0500|Info: === 2016-04-04 15:42:33,408 [1(3)] DEBUG PoolableDataSourceFactory - Created DataSource 49 of type 'List' and assigned it to thread http-listener-1(3)
    2016-04-04T15:42:33.408-0500|Info: === 2016-04-04 15:42:33,408 [1(3)] DEBUG PoolableDataSourceFactory - Created DataSource 49 of type 'List' in the pooling flow
    2016-04-04T15:42:33.408-0500|Info: === 2016-04-04 15:42:33,408 [1(3)] DEBUG PoolableDataSourceFactory - Activated DataSource 49 of type 'List'
    2016-04-04T15:42:33.408-0500|Info: === 2016-04-04 15:42:33,408 [1(3)] DEBUG ISCKeyedObjectPool - Borrowing object for 'elem'
    2016-04-04T15:42:33.408-0500|Info: === 2016-04-04 15:42:33,408 [1(3)] DEBUG PoolableDataSourceFactory - Tried to create DataSource of type 'elem' but null was returned
    2016-04-04T15:42:33.408-0500|Info: === 2016-04-04 15:42:33,408 [1(3)] DEBUG PoolableDataSourceFactory - Created DataSource null of type 'elem' in the pooling flow
    2016-04-04T15:42:33.409-0500|Info: === 2016-04-04 15:42:33,409 [1(3)] DEBUG RPCManager - Processing 1 requests.
    2016-04-04T15:42:33.409-0500|Info: === 2016-04-04 15:42:33,409 [1(3)] DEBUG ISCKeyedObjectPool - Borrowing object for 'bank_load'
    2016-04-04T15:42:33.409-0500|Info: === 2016-04-04 15:42:33,409 [1(3)] DEBUG PoolableDataSourceFactory - Activated DataSource 29 of type 'bank_load'
    2016-04-04T15:42:33.409-0500|Info: === 2016-04-04 15:42:33,409 [1(3)] DEBUG DSRequest - Caching instance 29 of DS 'bank_load' from DSRequest.getDataSource()
    2016-04-04T15:42:33.409-0500|Info: === 2016-04-04 15:42:33,409 [1(3)] DEBUG DSRequest - Caching instance 29 of DS bank_load
    2016-04-04T15:42:33.409-0500|Info: === 2016-04-04 15:42:33,409 [1(3)] INFO DSRequest - We parsed 1 uploaded file(s): "C:/fakepath/eclipse.ini" (653 bytes)
    2016-04-04T15:42:33.409-0500|Info: === 2016-04-04 15:42:33,409 [1(3)] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 29
    2016-04-04T15:42:33.409-0500|Info: === 2016-04-04 15:42:33,409 [1(3)] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 29
    2016-04-04T15:42:33.409-0500|Info: === 2016-04-04 15:42:33,409 [1(3)] DEBUG PoolableDataSourceFactory - Cleared and passivated DataSource 29 of type 'bank_load'
    2016-04-04T15:42:33.410-0500|Info: === 2016-04-04 15:42:33,410 [1(3)] DEBUG RPCManager - Request #1 (DSRequest) payload: {
    criteria:{
    id:2
    },
    values:{
    file:"C:\\fakepath\\eclipse.ini",
    file_filename:"eclipse.ini",
    id:2,
    _transaction:null,
    file_filesize:653,
    file_date_created:new Date(1459802553409)
    },
    operationConfig:{
    dataSource:"bank_load",
    repo:null,
    operationType:"update",
    textMatchStyle:"exact"
    },
    componentId:"isc_DynamicForm_5",
    appID:"builtinApplication",
    operation:"bank_load_update",
    oldValues:{
    file_filename:"1",
    id:2
    }
    }
    2016-04-04T15:42:33.410-0500|Info: === 2016-04-04 15:42:33,410 [1(3)] INFO IDACall - Performing 1 operation(s)
    2016-04-04T15:42:33.410-0500|Info: === 2016-04-04 15:42:33,410 [1(3)] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    2016-04-04T15:42:33.410-0500|Info: === 2016-04-04 15:42:33,410 [1(3)] DEBUG DeclarativeSecurity - DataSource bank_load is not in the pre-checked list, processing...
    2016-04-04T15:42:33.410-0500|Info: === 2016-04-04 15:42:33,410 [1(3)] DEBUG AppBase - [builtinApplication.bank_load_update] No userTypes defined, allowing anyone access to all operations for this application
    2016-04-04T15:42:33.410-0500|Info: === 2016-04-04 15:42:33,410 [1(3)] DEBUG AppBase - [builtinApplication.bank_load_update] No public zero-argument method named '_bank_load_update' found, performing generic datasource operation
    2016-04-04T15:42:33.411-0500|Info: === 2016-04-04 15:42:33,411 [1(3)] INFO SQLDataSource - [builtinApplication.bank_load_update] Performing update operation with
    criteria: {id:2} values: {file_filename:"eclipse.ini",id:"2",_transaction:null,file_filesize:"653",file_date_created:"Mon Apr 04 15:42:33 COT 2016"}
    2016-04-04T15:42:33.411-0500|Info: === 2016-04-04 15:42:33,411 [1(3)] INFO SQLValuesClause - [builtinApplication.bank_load_update] Ignored data for non-existent or included columns: [_transaction]
    2016-04-04T15:42:33.414-0500|Info: === 2016-04-04 15:42:33,414 [1(3)] DEBUG PoolableSQLConnectionFactory - [builtinApplication.bank_load_update] makeObject() created an unpooled Connection '1503947647'
    2016-04-04T15:42:33.414-0500|Info: === 2016-04-04 15:42:33,414 [1(3)] DEBUG SQLConnectionManager - [builtinApplication.bank_load_update] Borrowed connection '1503947647'
    2016-04-04T15:42:33.414-0500|Info: === 2016-04-04 15:42:33,414 [1(3)] INFO SQLDriver - [builtinApplication.bank_load_update] Executing SQL query on 'SQLServer' using connection '1503947647': UPDATE bank_load SET file=?, file_date_created='Mon Apr 04 15:42:33 COT 2016', file_filename='eclipse.ini', file_filesize='653' WHERE (LOWER(bank_load.id)='2')
    2016-04-04T15:42:33.415-0500|Info: === 2016-04-04 15:42:33,415 [1(3)] INFO SQLDriver - [builtinApplication.bank_load_update] Execute of update: UPDATE bank_load SET file=?, file_date_created='Mon Apr 04 15:42:33 COT 2016', file_filename='eclipse.ini', file_filesize='653' WHERE (LOWER(bank_load.id)='2') on db: SQLServer threw exception: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'file'. - assuming stale connection and retrying update.
    2016-04-04T15:42:33.415-0500|Info: === 2016-04-04 15:42:33,415 [1(3)] DEBUG SQLConnectionManager - [builtinApplication.bank_load_update] About to close ConnectionWrapper40 with hashcode "1503947647"
    2016-04-04T15:42:33.415-0500|Info: === 2016-04-04 15:42:33,415 [1(3)] DEBUG PoolableSQLConnectionFactory - [builtinApplication.bank_load_update] makeObject() created an unpooled Connection '438094729'
    2016-04-04T15:42:33.416-0500|Info: === 2016-04-04 15:42:33,416 [1(3)] DEBUG DSRequest - About to free up resources for request of type update on DataSource bank_load
    2016-04-04T15:42:33.416-0500|Info: === 2016-04-04 15:42:33,416 [1(3)] WARN RequestContext - dsRequest.execute() failed:
    com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'file'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1635)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:426)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:372)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:184)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:159)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:315)
    at com.sun.gjc.spi.base.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:125)
    at com.isomorphic.sql.SQLDriver.doUpdate(SQLDriver.java:929)
    at com.isomorphic.sql.SQLDriver.update(SQLDriver.java:844)
    at com.isomorphic.sql.SQLDriver.executeUpdate(SQLDriver.java:1016)
    at com.isomorphic.sql.SQLDataSource.executeNativeUpdate(SQLDataSource.java:596)
    at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:2101)
    at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:447)
    at com.isomorphic.sql.SQLDataSource.executeUpdate(SQLDataSource.java:396)
    at com.isomorphic.datasource.DataSource.execute(DataSource.java:2281)
    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:2694)
    at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:228)
    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:707)
    at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:162)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.http://www.BasicAuthenticationFilter...ilter.java:158)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    2016-04-04T15:42:33.416-0500|Info: at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    at java.lang.Thread.run(Thread.java:745)
    2016-04-04T15:42:33.417-0500|Info: === 2016-04-04 15:42:33,417 [1(3)] DEBUG RPCManager - Content type for RPC transaction: text/html; charset=UTF-8
    2016-04-04T15:42:33.417-0500|Info: === 2016-04-04 15:42:33,417 [1(3)] DEBUG RPCManager - non-DMI response, dropExtraFields: false
    2016-04-04T15:42:33.418-0500|Info: === 2016-04-04 15:42:33,418 [1(3)] INFO Compression - /BMSim/bmsim/sc/IDACall: 670 -> 423 bytes
    2016-04-04T15:42:33.418-0500|Info: === 2016-04-04 15:42:33,418 [1(3)] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 29
    2016-04-04T15:42:33.418-0500|Info: === 2016-04-04 15:42:33,418 [1(3)] DEBUG SQLDriver - Freeing SQLDriver dbConnection 438094729 for SQLDriver instance 1294365210
    2016-04-04T15:42:33.419-0500|Info: === 2016-04-04 15:42:33,419 [1(3)] DEBUG SQLConnectionManager - About to close ConnectionWrapper40 with hashcode "438094729"
    2016-04-04T15:46:33.399-0500|Info: === 2016-04-04 15:46:33,399 [1(1)] INFO RequestContext - URL: '/BMSim/bmsim/sc/skins/Enterprise/images/Dialog/warn.png', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36': Safari with Accept-Encoding header
    2016-04-04T15:46:33.401-0500|Info: === 2016-04-04 15:46:33,401 [1(1)] INFO Download - done streaming: D:/Dropbox/Apps/Glassfish4/glassfish/domains/BMSim/eclipseApps/BMSim/bmsim/sc/skins/Enterprise/images/Dialog/warn.png
    2016-04-04T15:46:33.418-0500|Info: === 2016-04-04 15:46:33,418 [1(2)] INFO RequestContext - URL: '/BMSim/bmsim/sc/skins/Enterprise/images/blank.gif', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36': Safari with Accept-Encoding header
    2016-04-04T15:46:33.419-0500|Info: === 2016-04-04 15:46:33,419 [1(2)] INFO Download - done streaming: D:/Dropbox/Apps/Glassfish4/glassfish/domains/BMSim/eclipseApps/BMSim/bmsim/sc/skins/Enterprise/images/blank.gif
    2016-04-04T15:46:33.423-0500|Info: === 2016-04-04 15:46:33,423 [1(5)] INFO RequestContext - URL: '/BMSim/bmsim/sc/skins/Enterprise/images/headerIcons/close.png', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36': Safari with Accept-Encoding header
    2016-04-04T15:46:33.424-0500|Info: === 2016-04-04 15:46:33,424 [1(5)] INFO Download - done streaming: D:/Dropbox/Apps/Glassfish4/glassfish/domains/BMSim/eclipseApps/BMSim/bmsim/sc/skins/Enterprise/images/headerIcons/close.png
    SmartGWT version is 5.1p 2016-04-02. Chrome version is 49.0.2623.110 m.

    #2
    Hi Isomorphic. I have tried a lot of different things here, and still can't make it work. I ruled out a SQL DB or DataSource configuration, because I'm able to make the Upload functionality work when Spring Security is not used in the project. I also tried allowing unrestricted access to IDACall in my Spring enabled project, but that didn't work either (this makes me think that it's not a permissions related problem).

    Looking at the Chrome developer console, I can see this error message just when I hit the save button:
    Refused to display 'http://localhost:8082/BMSim/bmsim/sc/IDACall?isc_rpc=1&isc_v=v10.1p_2016-04-02&isc_tnum=4' in a frame because it set 'X-Frame-Options' to 'DENY'.
    And then the operation times out, I get:
    ISC_Core.js:1078 *14:24:57.455:TMR3:WARN:RPCManager:Operation timed outundefined - response: {operationId: "bank_load_update",clientContext: Obj,internalClientContext: Obj,context: Obj,transactionNum: 4,httpResponseCode: undef,httpResponseText: undef,xmlHttpRequest: undef,transport: "hiddenFrame",status: -100,clientOnly: undef,isStructured: true,callbackArgs: null,results: Obj,data: "Operation timed out",httpHeaders: undef,startRow: 0,endRow: 0,totalRows: 0}
    Couldn't this be another case of Spring Security interfering with Smart GWT's functionality, similar to what happened here?

    Comment


      #3
      Hi Isomorphic. I am really lost here. Can you please take a look at this? Any ideas or pointers you can provide for me to keep looking would be greatly appreciated!

      Comment


        #4
        I have upload-files with MSSQL and they are working fine.

        You say you tried with only the binary field (without the metadata fields) or with only the metadata fields (and no binary field). (if I understand you correctly)
        I think you need both, i.e. :

        Code:
         <DataSource      ID="bank_load"      serverType="sql"      tableName="bank_load" >      
        <fields>        
        <field name="id" hidden="true" primaryKey="true"/>    
         <field name="file" type="binary"/> 
        <field name="file_filename"/>          
        <field name="file_filesize"/>          
        <field name="file_date_created"/>    
        </fields>
        </DataSource>
        Edit: Isomorphic why is copy-paste not working well in the forums ?

        Comment


          #5
          My binary fields are varbinary(max). Maybe this is the problem with your config?

          Comment


            #6
            edulid, thanks a lot for posting and trying to help me. I really appreciate it!!

            Unfortunataly, the problem seems to be Spring Security interfering with the file upload functionality. I can make it work when Spring Security is not being used. This is my ds.xml file right now:
            Code:
            <DataSource       
                ID="bank_load" 
                serverType="sql" 
                tableName="bank_load">    
            
                <fields>
                    <field name="pk" type="sequence" hidden="true" primaryKey="true"/>   
                    <field name="bankfile" type="binary"/>         
                </fields>
            </DataSource>
            And the bankfile field is set to varbinary(max) as you also suggest. This is working fine.

            But once Spring Security is enabled, the timeouts start to happen again.

            Maybe there's a particular url I need to leave unprotected in Spring?
            Last edited by carlossierra; 8 Apr 2016, 04:52. Reason: When posting code from iPad, it won't show.

            Comment


              #7
              Most likely, Spring Security is parsing the uploaded request and by the time it reaches the SmartGWT set let, the file is no longer available from the HttpServletRequest. You can verify this by temporarily substituting a basic servlet that just tries to read the uploaded file.

              Comment


                #8
                edulid do you have the setup you mention above running on SmartGWT 6.0p? What server are you running this on? Glassfish?
                Thanks

                Comment


                  #9
                  Well, the problem was indeed in Spring Security's configuration. I just needed to add this to my config file (under the http element):
                  Code:
                  <headers>
                      <frame-options policy="SAMEORIGIN" />
                  </headers>
                  For a deeper explanation on why this is required when using features like File Upload (that I assume are creating a frame in the upload process), see this SO question.

                  Thanks edulid and Isomorphic...

                  ps. in case anybody stumbles across this page having the same problem, here is my http config in my applicationContext.xml file:
                  Code:
                  <http auto-config="true" use-expressions="true">
                      
                      <!-- Security exceptions to allow proper login page resource loading -->
                      <intercept-url pattern="/bmsim/sc/skins/**" access="permitAll"/>
                      <intercept-url pattern="/bmsim/sc/system/**" access="permitAll"/>
                      <intercept-url pattern="/resources/css/**" access="permitAll"/>
                      <intercept-url pattern="/favicon.ico" access="permitAll"/>
                      <intercept-url pattern="/resources/images/login_logo.png" access="permitAll"/>
                      <intercept-url pattern="/login*" access="permitAll"/>
                      
                      <intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
                      <form-login 
                          login-page="/login.jsp" 
                          default-target-url="/BMSim.html"
                          always-use-default-target="true"
                          authentication-failure-url="/login.jsp?error" 
                          username-parameter="username"
                          password-parameter="password" />
                      <logout logout-url="/logout" logout-success-url="/login.jsp?logout"  />
                      <!-- disable csrf protection -->
                      <csrf disabled="true"/>
                      <!-- allow SmartGWT to create frames and call servlets from there -->
                      <headers>
                          <frame-options policy="SAMEORIGIN" />
                      </headers>
                  </http>

                  Comment

                  Working...
                  X