数据库
首页 > 数据库> > 使用jOOQ执行PL / SQL函数时的Java空指针

使用jOOQ执行PL / SQL函数时的Java空指针

作者:互联网

我目前正在尝试调用一个接受多个输入/输出参数的PL / SQL函数.该函数包含以下数据类型:

>字符串.
>字符串数组.

但是,当应用程序设置数据以将其发送到数据库服务器时,该应用程序将引发一个空指针异常,该异常与引起的实际错误无关(请注意,下面给出了实际错误,因为在调试时已找到了该错误)应用程序).

该应用程序正在准备以下数据:

>字符串->这些没有问题
>列表->转换为CustTabVarchar2_50Record
>列表->转换为CustTabVarchar2_4000Record

然后将其传递到jOOQ生成的类,该类包含PL / SQL函数的Java包装器.

在这一点上,当它遍历参数时,尤其是在CustTabVarchar2_50Record上迭代时,它会失败.

在这一点上,它将引发异常:

java.lang.NoSuchMethodException: No similar method createARRAY with params [class java.lang.String, class [Ljava.lang.Object;] could be found on type class org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8.

我目前假设它可能是以下问题之一:

> jOOQ出现问题.
> jBoss正在使用的错误库指出:“ org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8”

PL SQL标头:

procedure a_l_ws(
  p_i_num      in      varchar2, 
  p_s       in      varchar2,
  p_u       in      varchar2,
  p_tpu    in      varchar2,
  p_tpa     in      varchar2,
  p_data_desc     in      cust_tab_varchar2_50,
  p_l     in      cust_tab_varchar2_4000,
  p_r        out     pls_integer,
  p_p     out     varchar2,
  p_appl        out     varchar2,
  p_ml    out     cust_tab_varchar2_12,
  p_m         out     cust_tab_varchar2_4000) 

堆栈跟踪:

result = {ReflectException@23035} Method threw 'org.jooq.tools.reflect.ReflectException' exception.
detailMessage = "java.lang.NoSuchMethodException: No similar method createARRAY with params [class java.lang.String, class [Ljava.lang.Object;] could be found on type class org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8."
cause = {NoSuchMethodException@23038} "java.lang.NoSuchMethodException: No similar method createARRAY with params [class java.lang.String, class [Ljava.lang.Object;] could be found on type class org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8."
detailMessage = "No similar method createARRAY with params [class java.lang.String, class [Ljava.lang.Object;] could be found on type class org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8."
cause = {NoSuchMethodException@23038} "java.lang.NoSuchMethodException: No similar method createARRAY with params [class java.lang.String, class [Ljava.lang.Object;] could be found on type class org.jboss.jca.adapters.jdbc.jdk8.WrappedConnectionJDK8."
stackTrace = {StackTraceElement[102]@23047} 
0 = {StackTraceElement@23049} "org.jooq.tools.reflect.Reflect.similarMethod(Reflect.java:436)"… Navigate
1 = {StackTraceElement@23050} "org.jooq.tools.reflect.Reflect.call(Reflect.java:366)"… Navigate
2 = {StackTraceElement@23051} "org.jooq.impl.DefaultBinding.createOracleARRAY(DefaultBinding.java:1403)"… Navigate
3 = {StackTraceElement@23052} "org.jooq.impl.DefaultBinding.set(DefaultBinding.java:1243)"… Navigate
4 = {StackTraceElement@23053} "org.jooq.impl.DefaultBindContext.bindValue0(DefaultBindContext.java:62)"… Navigate
5 = {StackTraceElement@23054} "org.jooq.impl.AbstractBindContext.bindValue(AbstractBindContext.java:127)"… Navigate
6 = {StackTraceElement@23055} "org.jooq.impl.ArrayConstant.bind0(ArrayConstant.java:110)"… Navigate
7 = {StackTraceElement@23056} "org.jooq.impl.ArrayConstant.accept(ArrayConstant.java:81)"… Navigate
8 = {StackTraceElement@23057} "org.jooq.impl.AbstractBindContext.bindInternal(AbstractBindContext.java:257)"… Navigate
9 = {StackTraceElement@23058} "org.jooq.impl.AbstractBindContext.visit0(AbstractBindContext.java:91)"… Navigate
10 = {StackTraceElement@23059} "org.jooq.impl.AbstractContext.visit0(AbstractContext.java:402)"… Navigate
11 = {StackTraceElement@23060} "org.jooq.impl.AbstractContext.visit(AbstractContext.java:168)"… Navigate
12 = {StackTraceElement@23061} "org.jooq.impl.AbstractRoutine.bind1(AbstractRoutine.java:588)"… Navigate
13 = {StackTraceElement@23062} "org.jooq.impl.AbstractRoutine.bind0(AbstractRoutine.java:558)"… Navigate
14 = {StackTraceElement@23063} "org.jooq.impl.AbstractRoutine.accept(AbstractRoutine.java:508)"… Navigate
15 = {StackTraceElement@23064} "org.jooq.impl.AbstractBindContext.bindInternal(AbstractBindContext.java:257)"… Navigate
16 = {StackTraceElement@23065} "org.jooq.impl.AbstractBindContext.visit0(AbstractBindContext.java:91)"… Navigate
17 = {StackTraceElement@23066} "org.jooq.impl.AbstractContext.visit0(AbstractContext.java:402)"… Navigate
18 = {StackTraceElement@23067} "org.jooq.impl.AbstractContext.visit(AbstractContext.java:168)"… Navigate
19 = {StackTraceElement@23068} "org.jooq.impl.AbstractRoutine.executeCallableStatement(AbstractRoutine.java:439)"… Navigate
20 = {StackTraceElement@23069} "org.jooq.impl.AbstractRoutine.execute(AbstractRoutine.java:310)"… Navigate
21 = {StackTraceElement@23070} "org.jooq.impl.AbstractRoutine.execute(AbstractRoutine.java:287)"… Navigate
22 = {StackTraceElement@23071} "c.r.w.jooq.model.db.db.packages.Aim.aimLoadWs(Aim.java:71)"… Navigate
23 = {StackTraceElement@23072} "c.r.w.jsonapi.repositories.onboarding.OnboardingService.loadApplication(OnboardingService.java:378)"… Navigate
24 = {StackTraceElement@23073} "c.r.w.jsonapi.repositories.onboarding.OnboardingService.loadMerchant(OnboardingService.java:74)"… Navigate
25 = {StackTraceElement@23074} "c.r.w.jsonapi.repositories.merchants.merchant.resource.MerchantRepository.saveRecord(MerchantRepository.java:93)"… Navigate
26 = {StackTraceElement@23075} "c.r.w.jsonapi.repositories.merchants.merchant.resource.MerchantRepository.saveRecord(MerchantRepository.java:24)"… Navigate
27 = {StackTraceElement@23076} "c.r.w.jsonapi.repositories.AbstractResourceRepository.save(AbstractResourceRepository.java:204)"… Navigate
28 = {StackTraceElement@23077} "c.r.w.jsonapi.repositories.AbstractResourceRepository.save(AbstractResourceRepository.java:33)"… Navigate
29 = {StackTraceElement@23078} "io.katharsis.core.internal.repository.adapter.ResourceRepositoryAdapter$4.invoke(ResourceRepositoryAdapter.java:133)"… Navigate
30 = {StackTraceElement@23079} "io.katharsis.core.internal.repository.adapter.ResponseRepositoryAdapter$RepositoryRequestFilterChainImpl.doFilter(ResponseRepositoryAdapter.java:203)"… Navigate
31 = {StackTraceElement@23080} "io.katharsis.core.internal.repository.adapter.ResourceRepositoryAdapter.save(ResourceRepositoryAdapter.java:145)"… Navigate
32 = {StackTraceElement@23081} "io.katharsis.core.internal.repository.adapter.ResourceRepositoryAdapter.update(ResourceRepositoryAdapter.java:110)"… Navigate
33 = {StackTraceElement@23082} "io.katharsis.core.internal.dispatcher.controller.ResourcePatch.handle(ResourcePatch.java:133)"… Navigate
34 = {StackTraceElement@23083} "io.katharsis.core.internal.dispatcher.RequestDispatcher$DefaultFilterChain.doFilter(RequestDispatcher.java:126)"… Navigate
35 = {StackTraceElement@23084} "io.katharsis.core.internal.dispatcher.RequestDispatcher.dispatchRequest(RequestDispatcher.java:80)"… Navigate
36 = {StackTraceElement@23085} "io.katharsis.rs.KatharsisFilter.dispatchRequest(KatharsisFilter.java:151)"… Navigate
37 = {StackTraceElement@23086} "io.katharsis.rs.KatharsisFilter.filter(KatharsisFilter.java:111)"… Navigate
38 = {StackTraceElement@23087} "org.apache.cxf.jaxrs.utils.JAXRSUtils.runContainerRequestFilters(JAXRSUtils.java:1642)"… Navigate
39 = {StackTraceElement@23088} "org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:106)"… Navigate
40 = {StackTraceElement@23089} "org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:77)"… Navigate
41 = {StackTraceElement@23090} "org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)"… Navigate
42 = {StackTraceElement@23091} "org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)"… Navigate
43 = {StackTraceElement@23092} "org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)"… Navigate
44 = {StackTraceElement@23093} "org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)"… Navigate
45 = {StackTraceElement@23094} "org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)"… Navigate
46 = {StackTraceElement@23095} "org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)"… Navigate
47 = {StackTraceElement@23096} "org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)"… Navigate
48 = {StackTraceElement@23097} "org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293)"… Navigate
49 = {StackTraceElement@23098} "org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:270)"… Navigate
50 = {StackTraceElement@23099} "io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)"… Navigate
51 = {StackTraceElement@23100} "io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)"… Navigate
52 = {StackTraceElement@23101} "org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)"… Navigate
53 = {StackTraceElement@23102} "org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)"… Navigate
54 = {StackTraceElement@23103} "org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)"… Navigate
55 = {StackTraceElement@23104} "org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)"… Navigate
56 = {StackTraceElement@23105} "org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)"… Navigate
57 = {StackTraceElement@23106} "org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)"… Navigate
58 = {StackTraceElement@23107} "org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)"… Navigate
59 = {StackTraceElement@23108} "org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)"… Navigate
60 = {StackTraceElement@23109} "org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)"… Navigate
61 = {StackTraceElement@23110} "org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)"… Navigate
62 = {StackTraceElement@23111} "c.r.wsecurity.oauth2.AuthenticationFilterOAuth2.doFilter(AuthenticationFilterOAuth2.java:73)"… Navigate
63 = {StackTraceElement@23112} "org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)"… Navigate
64 = {StackTraceElement@23113} "org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)"… Navigate
65 = {StackTraceElement@23114} "org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)"… Navigate
66 = {StackTraceElement@23115} "org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)"… Navigate
67 = {StackTraceElement@23116} "org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)"… Navigate
68 = {StackTraceElement@23117} "org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)"… Navigate
69 = {StackTraceElement@23118} "org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)"… Navigate
70 = {StackTraceElement@23119} "org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)"… Navigate
71 = {StackTraceElement@23120} "org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)"… Navigate
72 = {StackTraceElement@23121} "org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)"… Navigate
73 = {StackTraceElement@23122} "io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)"… Navigate
74 = {StackTraceElement@23123} "io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)"… Navigate
75 = {StackTraceElement@23124} "io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)"… Navigate
76 = {StackTraceElement@23125} "io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)"… Navigate
77 = {StackTraceElement@23126} "io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)"… Navigate
78 = {StackTraceElement@23127} "org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)"… Navigate
79 = {StackTraceElement@23128} "io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)"… Navigate
80 = {StackTraceElement@23129} "io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)"… Navigate
81 = {StackTraceElement@23130} "io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)"… Navigate
82 = {StackTraceElement@23131} "io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)"… Navigate
83 = {StackTraceElement@23132} "io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)"… Navigate
84 = {StackTraceElement@23133} "io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)"… Navigate
85 = {StackTraceElement@23134} "io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)"… Navigate
86 = {StackTraceElement@23135} "io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)"… Navigate
87 = {StackTraceElement@23136} "io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)"… Navigate
88 = {StackTraceElement@23137} "io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)"… Navigate
89 = {StackTraceElement@23138} "io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)"… Navigate
90 = {StackTraceElement@23139} "org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)"… Navigate
91 = {StackTraceElement@23140} "io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)"… Navigate
92 = {StackTraceElement@23141} "io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)"… Navigate
93 = {StackTraceElement@23142} "io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285)"… Navigate
94 = {StackTraceElement@23143} "io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)"… Navigate
95 = {StackTraceElement@23144} "io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)"… Navigate
96 = {StackTraceElement@23145} "io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)"… Navigate
97 = {StackTraceElement@23146} "io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)"… Navigate
98 = {StackTraceElement@23147} "io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:792)"… Navigate
99 = {StackTraceElement@23148} "java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)"… Navigate
… (2 more items. Double-click to see)
suppressedExceptions = {Collections$UnmodifiableRandomAccessList@22457}  size = 0
stackTrace = {StackTraceElement[101]@23039} 
suppressedExceptions = {Collections$UnmodifiableRandomAccessList@22457}  size = 0

解决方法:

当使用通过Oracle JDBC驱动程序配置的连接包装器(通过数据源或连接池)时,这似乎与https://github.com/jOOQ/jOOQ/issues/3639有关.就您而言,您似乎正在使用JBoss数据源.如问题中所述,由于createARRAY不是标准的JDBC,而是特定于Oracle的,因此如果您使用Oracle方言创建DSL连接,则jOOQ将假定正在使用Oracle连接,因此尝试调用Oracle的createARRAY()而不是createArrayOf() ).

jOOQ的作者也许可以阐明是否可以通过配置设置,修复或其他方式避免这种情况.

注意:由于我的声誉仍然很低,因此不得不将其作为回答而不是评论.如果此项获得高票,将在此处提供最终答案.

标签:jooq,java-8,plsql,jboss7-x,java
来源: https://codeday.me/bug/20191108/2010125.html