如何将带有Clob Field的结果集转换为JSON String对象以传递给有角度的前端

时间:2017-01-18 19:58:46

标签: java angularjs json resultset clob

我想做什么 - 我有一个Java 1.7 Spring应用程序,我使用Rest Controller连接到oracle数据库,在那里我查询一个包含保存为CLOB的文件的表。我试图查询表,获取输出CLOB文件,将其打包成一个对象,并使用Gson.toJson将其转换为我发送回角度前端的JSON字符串。

更大的图片是什么 - 我希望角度前端显示文件的内容。我使用控制器查询文件并将其作为clob发送回角度前端。

发生了什么 - 当我尝试执行Gson.toJson(Object)时,它会抛出错误..这是代码..

        ResultSet rs = callableStatment.executeQuery();
        jOFile = new JobOutput();
        while(rs.next())
        {
            .....
            if(rs.getString("VUGEN_OUTPUT_FILE") != null)
                jOFile.setBlobFile(rs.getClob("VUGEN_OUTPUT_FILE"));
            else
                jOFile.setBlobFile(null);
            rs.getClob("VUGEN_OUTPUT_FILE");

        }
        json = new Gson().toJson(jOFile);   
  

例外 -   weblogic.jdbc.wrapper.CallableStatement_oracle_jdbc_driver_OracleCallableStatementWrapper@25

     

java.lang.IllegalArgumentException:class oracle.jdbc.driver.Accessor   声明名为statement at的多个JSON字段   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:146)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:83)     在com.google.gson.Gson.getAdapter(Gson.java:359)at   com.google.gson.internal.bind.ArrayTypeAdapter $ 1。创建(ArrayTypeAdapter.java:48)     在com.google.gson.Gson.getAdapter(Gson.java:359)at   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:122)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access $ 100(ReflectiveTypeAdapterFactory.java:46)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ 1(ReflectiveTypeAdapterFactory.java:92)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:91)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:142)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:83)     在com.google.gson.Gson.getAdapter(Gson.java:359)at   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:122)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access $ 100(ReflectiveTypeAdapterFactory.java:46)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ 1(ReflectiveTypeAdapterFactory.java:92)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:91)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:142)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:83)     在com.google.gson.Gson.getAdapter(Gson.java:359)at   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:122)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access $ 100(ReflectiveTypeAdapterFactory.java:46)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ 1(ReflectiveTypeAdapterFactory.java:92)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:91)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:142)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:83)     在com.google.gson.Gson.getAdapter(Gson.java:359)at   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:122)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access $ 100(ReflectiveTypeAdapterFactory.java:46)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ 1(ReflectiveTypeAdapterFactory.java:92)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:91)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:142)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:83)     在com.google.gson.Gson.getAdapter(Gson.java:359)at   com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:55)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ 1.write(ReflectiveTypeAdapterFactory.java:99)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ Adapter.write(ReflectiveTypeAdapterFactory.java:219)     在   com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ 1.write(ReflectiveTypeAdapterFactory.java:99)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ Adapter.write(ReflectiveTypeAdapterFactory.java:219)     在   com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ 1.write(ReflectiveTypeAdapterFactory.java:99)     在   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory $ Adapter.write(ReflectiveTypeAdapterFactory.java:219)     在com.google.gson.Gson.toJson(Gson.java:600)at   com.google.gson.Gson.toJson(Gson.java:579)at   com.google.gson.Gson.toJson(Gson.java:534)at   com.google.gson.Gson.toJson(Gson.java:514)at   com.usfoods.strApp.controller.RestController1.getJobOutputFile(RestController1.java:1140)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:606)at   org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:220)     在   org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)     在   org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)     在   org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)     在   org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)     在   org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)     在   org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)     在   org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)     在   org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)     在   org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:751)at   org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:844)at   weblogic.servlet.internal.StubSecurityHelper $ ServletServiceAction.run(StubSecurityHelper.java:280)     在   weblogic.servlet.internal.StubSecurityHelper $ ServletServiceAction.run(StubSecurityHelper.java:254)     在   weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)     在   weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)     在weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)     在   weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:317)     在   org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)     在   org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:177)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)     在   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)     在   org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331)     在   org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)     在   org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)     在   org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)     在   org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)     在   weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)     在   oracle.security.jps.ee.http.JpsAbsFilter $ 1.run(JpsAbsFilter.java:137)     在java.security.AccessController.doPrivileged(Native Method)at   oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)     在   oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)     在   oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:120)     在   oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:217)     at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:81)     在   weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)     在   oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:220)     在   weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)     在   weblogic.servlet.internal.WebAppServletContext $ ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)     在   weblogic.servlet.internal.WebAppServletContext $ ServletInvocationAction.run(WebAppServletContext.java:3402)     在   weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)     在   weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)     在   weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)     在   weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)     在   weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)     在   weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)     在   weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)     在   weblogic.servlet.provider.ContainerSupportProviderImpl $ WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)     在weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)at   weblogic.work.ExecuteThread.run(ExecuteThread.java:263)

0 个答案:

没有答案