2 Replies Latest reply on Dec 15, 2017 7:35 PM by TexasApexDeveloper

    ORDS 500 Server error trying to download BLOB

    TexasApexDeveloper

      Using Ords 3.0.12.263.15.32 on an Oracle 11g R2 database and APEX 5.1.3, trying to download a blob I am getting an internal 500 server error from ORDs:

       

      PL/SQL that is causing the error:         sys.wpg_docload.download_file( l_File );

       

      Java Error:

       

      500  Internal Server Error

       

      • An unexpected error with the following message occurred: UNKNOWN

       

      Debug Trace

      [TE] url-mapping start: 2017-12-15T16:11:41.164Z duration: 0ms [TE] GET /ords_ebzd2/f?p=129:70:106696030377296:DOWNLOAD_FILE:NO::: start: 2017-12-15T16:11:41.164Z duration: 6718ms  

      Stack Trace

      InternalServerException [statusCode=500, reasons=[An unexpected error with the following message occurred: UNKNOWN]] at oracle.dbtools.http.errors.ServletResponseExceptionMapper.mapError(ServletResponseExceptionMapper.java:84) at oracle.dbtools.http.errors.ErrorPageRenderer.<init>(ErrorPageRenderer.java:43) at oracle.dbtools.http.errors.ErrorPageRenderer.<init>(ErrorPageRenderer.java:35) at oracle.dbtools.http.errors.ErrorPageFilter.doFilter(ErrorPageFilter.java:119) at oracle.dbtools.http.filters.HttpFilter.doFilter(HttpFilter.java:47) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:64) at oracle.dbtools.http.auth.ForceAuthFilter.doFilter(ForceAuthFilter.java:44) at oracle.dbtools.http.filters.HttpFilter.doFilter(HttpFilter.java:47) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:64) at oracle.dbtools.http.filters.Filters.filter(Filters.java:47) at oracle.dbtools.http.entrypoint.EntryPoint.service(EntryPoint.java:82) at oracle.dbtools.http.entrypoint.EntryPointServlet.service(EntryPointServlet.java:49) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at oracle.dbtools.rt.web.HttpEndpointBase.dispatchableServices(HttpEndpointBase.java:116) at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:81) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3697) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3667) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326) at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197) at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2443) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2291) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2269) at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1703) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1663) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272) at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352) at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337) at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57) at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41) at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:644) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:415) at weblogic.work.ExecuteThread.run(ExecuteThread.java:355) Caused by: java.lang.IllegalArgumentException: UNKNOWN at oracle.dbtools.http.ContentType.contentType(ContentType.java:225) at oracle.dbtools.http.servlet.NormalizedServletResponse.setContentType(NormalizedServletResponse.java:508) at javax.servlet.ServletResponseWrapper.setContentType(ServletResponseWrapper.java:179) at oracle.dbtools.apex.HeaderUtils.processResponseHeaders(HeaderUtils.java:52) at oracle.dbtools.apex.HeaderUtils.processHeaders(HeaderUtils.java:21) at oracle.dbtools.apex.ModApex.handleRequest(ModApex.java:289) at oracle.dbtools.apex.ModApex.doGet(ModApex.java:135) at oracle.dbtools.apex.ModApex.service(ModApex.java:100) at oracle.dbtools.http.entrypoint.Dispatcher.dispatch(Dispatcher.java:125) at oracle.dbtools.http.entrypoint.EntryPoint$FilteredServlet.service(EntryPoint.java:240) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:73) at oracle.dbtools.http.forwarding.QueryFilteringRewrite.doFilter(QueryFilteringRewrite.java:90) at oracle.dbtools.http.filters.HttpFilter.doFilter(HttpFilter.java:47) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:64) at oracle.dbtools.http.forwarding.ForwardingFilter.doFilter(ForwardingFilter.java:68) at oracle.dbtools.http.filters.HttpFilter.doFilter(HttpFilter.java:47) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:64) at oracle.dbtools.http.cors.CORSPreflightFilter.doFilter(CORSPreflightFilter.java:66) at oracle.dbtools.http.filters.HttpFilter.doFilter(HttpFilter.java:47) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:64) at oracle.dbtools.http.cookies.auth.CookieSessionCSRFFilter.doFilter(CookieSessionCSRFFilter.java:75) at oracle.dbtools.http.filters.HttpFilter.doFilter(HttpFilter.java:47) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:64) at oracle.dbtools.http.auth.AuthenticationFilter.authenticate(AuthenticationFilter.java:87) at oracle.dbtools.http.auth.AuthenticationFilter.doFilter(AuthenticationFilter.java:62) at oracle.dbtools.http.filters.HttpFilter.doFilter(HttpFilter.java:47) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:64) at oracle.dbtools.url.mapping.RequestMapperImpl.doFilter(RequestMapperImpl.java:125) at oracle.dbtools.url.mapping.URLMappingBase.doFilter(URLMappingBase.java:103) at oracle.dbtools.url.mapping.filter.URLMappingFilter.doFilter(URLMappingFilter.java:124) at oracle.dbtools.http.filters.HttpFilter.doFilter(HttpFilter.java:47) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:64) at oracle.dbtools.http.cors.CORSResponseFilter.doFilter(CORSResponseFilter.java:83) at oracle.dbtools.http.filters.HttpResponseFilter.doFilter(HttpResponseFilter.java:45) at oracle.dbtools.http.filters.FilterChainImpl.doFilter(FilterChainImpl.java:64) at oracle.dbtools.http.errors.ErrorPageFilter.doFilter(ErrorPageFilter.java:94) ... 36 more  

      Can any one shed some light on what needs to be adjusted in ORDS to allow file downloads via PL/SQL?

       

      Thanks!

       

      Tony Miller

      Los Alamos, NM

        • 1. Re: ORDS 500 Server error trying to download BLOB
          Kris Rice-Oracle

          The crux of this is this section:

           

          41 at weblogic.work.ExecuteThread.run(ExecuteThread.java:355) Caused by: java.lang.IllegalArgumentException: UNKNOWN

          42 at oracle.dbtools.http.ContentType.contentType(ContentType.java:225)

          43 at oracle.dbtools.http.servlet.NormalizedServletResponse.setContentType(NormalizedServletResponse.java:508)

          44 at javax.servlet.ServletResponseWrapper.setContentType(ServletResponseWrapper.java:179)

          45 at oracle.dbtools.apex.HeaderUtils.processResponseHeaders(HeaderUtils.java:52)

           

          A content-type of "UNKNOWN" isn't valid. We do need a better error message than this.

           

          Change your code to something along these lines...

          1.     owa_util.mime_header( 'application/octect' , false ); 

           

          1.     owa_util.http_header_close; 
          2.     wpg_docload.download_file( l_File ); 

           

          -kris

           

          • 2. Re: ORDS 500 Server error trying to download BLOB
            TexasApexDeveloper

            Kris,

            Thanks!  That did it.. As soon as I stopped using a function and a local variable for the MIMETYPE and just hard-coded the provided value, it works great now!

             

            Thanks for your help!!

             

            Tony Miller

            Los Alamos, NM