Announcement

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

    File upload component is not working in Smart Client 8.1

    The application have Struts 2 and Smart Client 8.1 both plug-in(s).
    Please note application deployed on Weblogic 10.3 server.

    Case 1: When the Struts filter has enabled the file file uploader component does not upload the file and return null on DMI Layer.

    Case 2: When we disable Struts 2 filer then file uploader workes but, it not upload complete file. Where as the total file size is just 10-15 KB.
    We got "org.xml.sax.SAXParseException: Premature end of file." Exception.

    {Stake trace}
    org.xml.sax.SAXParseException: Premature end of file.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1044)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:133)
    at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:172)
    at org.apache.commons.digester.Digester.parse(Digester.java:1572)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:239)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReportToStream(JasperCompileManager.java:169)
    at com.ias.dm.dmi.impl.ReportsDMIImpl.compileFile(ReportsDMIImpl.java:254)
    at com.ias.dm.dmi.impl.ReportsDMIImpl.saveReport(ReportsDMIImpl.java:128)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:949)
    at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:610)
    at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
    at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1711)
    at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
    at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
    at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
    at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at com.ias.dm.login.DM2AppicationFilter.doFilter(DM2AppicationFilter.java:86)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException: Premature end of file.
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReportToStream(JasperCompileManager.java:169)
    at com.ias.dm.dmi.impl.ReportsDMIImpl.compileFile(ReportsDMIImpl.java:254)
    at com.ias.dm.dmi.impl.ReportsDMIImpl.saveReport(ReportsDMIImpl.java:128)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:949)
    at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:610)
    at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
    at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1711)
    at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
    at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
    at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
    at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at com.ias.dm.login.DM2AppicationFilter.doFilter(DM2AppicationFilter.java:86)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    {Stake trace}



    below are the code snippets.

    1. In DS file we have declare a field type as binary :- report.DS.xml
    <field>
    <name>reportdata</name>
    <title>JRXML File</title>
    <type>binary</type>
    <showFileInline>true</showFileInline>
    <required>true</required>
    </field>

    2. DMI Class code:- ReportDMIImpl.java
    Map valueMap = dsRequest.getValues();
    Long reportID = (Long) dsRequest.getParameter("reportid");
    ISCFileItem fileItem = dsRequest.getUploadedFile("reportdata");
    if(fileItem== null && reportID!= null && reportID> 0){
    return DM2Utils.getFailureResponse(dsResponse, new ReportDTO());
    }


    Please let me know if more information is required.

    Thanks!

    #2
    This error doesn't suggest that the file is truncated during upload, just that it's an invalid file for whatever is parsing it (which is a third-party library).

    If you discover that the file *is* truncated however, then that would be due to one of the remaining filters that are still involved in processing the request (according to the stack you showed).

    Comment


      #3
      This is not only the recent uploaded file but also it is happen to other files.
      Last edited by spant; 25 Oct 2011, 12:49.

      Comment


        #4
        ?

        Not particularly hard to find - you posted the stack trace:

        at com.ias.dm.login.DM2AppicationFilter.doFilter(DM2A ppicationFilter.java:86)

        Comment


          #5
          Complete stack trace:

          11:10:18.386:MUP6:INFO:RPCManager:sendQueue called with no current queue, ignoring
          11:10:18.387:MUP6:WARN:ReportPane:isc_ReportPane_0:couldn't find member to remove: [HLayout ID:isc_HLayout_8]
          11:10:18.387:MUP6:WARN:ReportPane:isc_ReportPane_0:couldn't find member to remove: [HLayout ID:isc_HLayout_14]
          11:10:18.388:MUP6:WARN:ReportPane:isc_ReportPane_0:couldn't find member to remove: [HLayout ID:isc_HLayout_15]
          11:10:18.388:MUP6:INFO:RPCManager:sendQueue called with no current queue, ignoring
          11:10:18.389:MUP6:INFO:RPCManager:sendQueue called with no current queue, ignoring
          11:10:18.390:MUP6:INFO:RPCManager:Request configuration (directSubmit, downloadResult, or target) requires it to be sent using hiddenFrame transport. Will be submitted without queueing.
          11:10:18.392:MUP6:DEBUG:RPCManager:Grabbed prompt from first request that defined one: Saving form...
          11:10:18.393:MUP6:INFO:RPCManager:sendQueue[7]: 1 RPCRequest(s); transport: hiddenFrame; target: http://localhost:9100/dispatchmanager/isomorphic/IDACall?isc_rpc=1&isc_v=8.1&isc_tnum=7
          11:10:18.396:MUP6:INFO:RPCManager:Direct submit assigning request data to hidden field instead of submitting as GET request
          11:10:18.406:MUP6[E]:INFO:layout:isc_ReportPane_0:not applying height: 25 to overflowed member: [HLayout ID:isc_HLayout_12] w/height: 29
          11:10:18.409:MUP6[E]:INFO:layout:isc_ReportPane_0:not applying height: 15 to overflowed member: [HLayout ID:isc_HLayout_10] w/height: 32
          11:10:18.409:MUP6[E]:INFO:layout:isc_ReportPane_0:not applying height: 24 to overflowed member: [ToolStrip ID:isc_ToolStrip_2] w/height: 32
          11:10:18.410:MUP6[E]:INFO:layout:isc_ReportPane_0:member: [HLayout ID:isc_HLayout_12] overflowed. set length: 25 got length: 29
          11:10:18.410:MUP6[E]:INFO:layout:isc_ReportPane_0:member: [HLayout ID:isc_HLayout_10] overflowed. set length: 15 got length: 32
          11:10:18.411:MUP6[E]:INFO:layout:isc_ReportPane_0:member: [ToolStrip ID:isc_ToolStrip_2] overflowed. set length: 24 got length: 32
          11:10:18.413:MUP6[E]:DEBUG:layout:isc_ReportPane_0:centering wrt visible breadth: 1260
          11:10:18.415:MUP6[E]:INFO:layout:isc_ReportPane_0:layoutChildren (reason: membersRemoved):
          layout specified size: 1260w x 414h
          drawn size: 1260w x 414h
          available size: 1260w x 414h (length)
          [HLayout ID:isc_HLayout_12]
          29 drawn length (resizeLength: 25) (policyLength: 29) (explicit size)
          1260 drawn breadth (breadth policy: fill)
          [HLayout ID:isc_HLayout_10]
          32 drawn length (resizeLength: 15) (policyLength: 32) (explicit size)
          1260 drawn breadth (breadth policy: fill)
          [SectionStack ID:isc_SectionStack_0]
          291 drawn length (resizeLength: 291) (policyLength: *) (no length specified)
          1260 drawn breadth (breadth policy: fill)
          [LayoutSpacer ID:isc_LayoutSpacer_7]
          30 drawn length (resizeLength: 30) (policyLength: 30) (explicit size)
          1260 drawn breadth (breadth policy: fill)
          [ToolStrip ID:isc_ToolStrip_2]
          32 drawn length (resizeLength: 24) (policyLength: 32) (explicit size)
          1260 drawn breadth (breadth policy: fill)

          11:11:16.718:INFO:RPCManager:transaction 7 arrived after 58321ms
          11:11:16.721:DEBUG:RPCManager:Result string for transaction 7: "//isc_RPCResponseStart-->[{endRow:0,queueStatus:-1,totalRows:0,isDSResponse:true,invalidateCache:false,status:-1,startRow:0,data:{lastmodified:null,lastmodifiedby:null,location:null,party:null,published:null,reportcategory:null,reportdata:null,reportid:null,reportname:null,role:null}}]//isc_RPCResponseEnd"
          11:11:16.727:INFO:RPCManager:rpcResponse(createReportDS_add)[add]: result: object[status=-1]
          11:11:16.728:INFO:layout:isc_ReportPane_0:adding newMembers: [HLayout ID:isc_HLayout_14] at position: 2
          11:11:16.729:DEBUG:layout:isc_ReportPane_0:resizing [HLayout ID:isc_HLayout_14]: 1260w
          11:11:16.779:TMR3:INFO:layout:isc_ReportPane_0:not applying height: 25 to overflowed member: [HLayout ID:isc_HLayout_12] w/height: 29
          11:11:16.786:TMR3:INFO:layout:isc_ReportPane_0:not applying height: 15 to overflowed member: [HLayout ID:isc_HLayout_10] w/height: 32
          11:11:16.788:TMR3:INFO:layout:isc_ReportPane_0:not applying height: 24 to overflowed member: [ToolStrip ID:isc_ToolStrip_2] w/height: 32
          11:11:16.807:TMR3:DEBUG:layout:isc_HLayout_14:resizing [Label ID:isc_Label_15]: 1256w
          11:11:16.836:TMR3:DEBUG:layout:isc_HLayout_14:centering wrt visible breadth: 20
          11:11:16.836:TMR3:INFO:layout:isc_HLayout_14:layoutChildren (reason: initial draw):
          layout specified size: 1260w x 20h
          drawn size: 1260w x 24h
          available size: 1260w (length) x 20h
          [Label ID:isc_Label_15]
          1256 drawn length (resizeLength: 1256) (policyLength: 100%) (explicit size)
          20 drawn breadth (explicit size)

          11:11:16.838:TMR3:INFO:layout:isc_ReportPane_0:member: [HLayout ID:isc_HLayout_12] overflowed. set length: 25 got length: 29
          11:11:16.839:TMR3:INFO:layout:isc_ReportPane_0:member: [HLayout ID:isc_HLayout_10] overflowed. set length: 15 got length: 32
          11:11:16.839:TMR3:INFO:layout:isc_ReportPane_0:member: [HLayout ID:isc_HLayout_14] overflowed. set length: 20 got length: 24
          11:11:16.839:TMR3:INFO:layout:isc_ReportPane_0:member: [ToolStrip ID:isc_ToolStrip_2] overflowed. set length: 24 got length: 32
          11:11:16.840:TMR3:DEBUG:layout:isc_ReportPane_0:resizing [SectionStack ID:isc_SectionStack_0] (drawn): 1260w 267h
          11:11:16.841:TMR3:INFO:layout:isc_SectionStack_0:not applying height: 30 to overflowed member: [HLayout ID:isc_HLayout_9] w/height: 188
          11:11:16.847:TMR3:INFO:layout:isc_SectionStack_0:member: [HLayout ID:isc_HLayout_9] overflowed. set length: 30 got length: 188
          11:11:16.848:TMR3:DEBUG:layout:isc_SectionStack_0:centering wrt visible breadth: 1258
          11:11:16.850:TMR3:INFO:layout:isc_SectionStack_0:layoutChildren (reason: resized):
          layout specified size: 1260w x 267h
          drawn size: 1260w x 267h
          available size: 1258w x 266h (length)
          [ImgSectionHeader ID:isc_ImgSectionHeader_0]
          26 drawn length (resizeLength: 26) (policyLength: 26) (explicit size)
          1258 drawn breadth (breadth policy: fill)
          [HLayout ID:isc_HLayout_9]
          188 drawn length (resizeLength: 30) (policyLength: 188) (explicit size)
          1258 drawn breadth (breadth policy: fill)

          11:11:16.853:TMR3:DEBUG:layout:isc_ReportPane_0:centering wrt visible breadth: 1260
          11:11:16.858:TMR3:INFO:layout:isc_ReportPane_0:layoutChildren (reason: membersAdded):
          layout specified size: 1260w x 414h
          drawn size: 1260w x 414h
          available size: 1260w x 414h (length)
          [HLayout ID:isc_HLayout_12]
          29 drawn length (resizeLength: 25) (policyLength: 29) (explicit size)
          1260 drawn breadth (breadth policy: fill)
          [HLayout ID:isc_HLayout_10]
          32 drawn length (resizeLength: 15) (policyLength: 32) (explicit size)
          1260 drawn breadth (breadth policy: fill)
          [HLayout ID:isc_HLayout_14]
          24 drawn length (resizeLength: 20) (policyLength: 24) (explicit size)
          1260 drawn breadth (breadth policy: fill)
          [SectionStack ID:isc_SectionStack_0]
          267 drawn length (resizeLength: 267) (policyLength: *) (no length specified)
          1260 drawn breadth (breadth policy: fill)
          [LayoutSpacer ID:isc_LayoutSpacer_7]
          30 drawn length (resizeLength: 30) (policyLength: 30) (explicit size)
          1260 drawn breadth (breadth policy: fill)
          [ToolStrip ID:isc_ToolStrip_2]
          32 drawn length (resizeLength: 24) (policyLength: 32) (explicit size)
          1260 drawn breadth (breadth policy: fill)

          Comment


            #6
            The problem with the file truncation is resolved if I remove the struts2 filter.

            If I add back the struts 2 filter, the below API on the DMI layer returns fileItem as null.

            ISCFileItem fileItem = dsRequest.getUploadedFile("attachedReport");

            I have verified that I get the inputstream on my DM2ApplicationFilter but when DMI layer is invoked, this inputstream is null.

            Please advice what can be the resolution for this issue.

            Comment


              #7
              The surest resolution is to stop using Struts2, either entirely or for this particular filter. Struts2 is an older architecture similar to JSF, there's no reason to be using it with SmartClient.

              Beyond that, you will need to file a bug with the Struts team (it's not our bug).

              Comment

              Working...
              X