I have a problem with Spring application and getting data from database with DTO. I got "java.sql.SQLException: The result set is closed". Database is Firebird (Jaybird version 3.0.3).
My dto file:
package ekoncept.dto;
import ...
public class FakturaListDTO {
private Integer fakturaId;
#Getter #Setter private String fakturaPrefix;
...
#Getter #Setter private BigDecimal fakturaZaplacono;
#Id
#Column(name = "FAKTURA_ID")
public Integer getFakturaId() {
return fakturaId;
}
public void setFakturaId(Integer fakturaId) {
this.fakturaId = fakturaId;
}
public FakturaListDTO(Faktura fakt) { // not working
this.fakturaId = fakt.getFakturaId();
this.fakturaPrefix = fakt.getFakturaPrefix();
...
this.fakturaZaplacono = fakt.getFakturaZaplacono();
}
public FakturaListDTO(Integer faktId) { // working
this.fakturaId = faktId;
}
}
My Repository file:
package ekoncept.repositories;
import ...
#Repository
public interface FakturaRepository extends JpaRepository<Faktura, Integer> {
// this is NOT working:
//#Query("select new ekoncept.dto.FakturaListDTO(f) " +
// " from Faktura f " +
// " where f.fakturaData between :data_od and :data_do")
// this is working
#Query("select new ekoncept.dto.FakturaListDTO(f.fakturaId) " +
" from Faktura f " +
" where f.fakturaData between :data_od and :data_do")
List<FakturaListDTO> listByFakturaData(#Param("data_od") Date dataOd, #Param("data_do") Date dataDo);
}
When in repository I define #Query like this:
#Query("select new ekoncept.dto.FakturaListDTO(f.fakturaId)"+
" from Faktura f " +
" where f.fakturaData between :data_od and :data_do")
it works and I get response with JSON (of course only field fakturaId is not null, but I get response 200)
when I define #Query like this:
#Query("select new ekoncept.dto.FakturaListDTO(f)"+
" from Faktura f " +
" where f.fakturaData between :data_od and :data_do")
using constructor FakturaListDTO(Faktura fakt) I got response 500:
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.dao.InvalidDataAccessResourceUsageException",
"message": "could not execute query; SQL [select faktura0_.faktura_id as col_0_0_ from faktura faktura0_ where faktura0_.faktura_data between ? and ?]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query",
"path": "/api/faktura/getFakturaList"
SQL query is ok, I have spring.jpa.show-sql=true and SQL in output is executing on DB.
In ERROR.log I got "The result set is closed":
2018-04-25 13:47:50 - The result set is closed
2018-04-25 13:47:50 - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; SQL [select faktura0_.faktura_id as col_0_0_ from faktura faktura0_ where faktura0_.faktura_data between ? and ?]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query] with root cause
java.sql.SQLException: The result set is closed
at org.firebirdsql.jdbc.AbstractResultSet.checkOpen(AbstractResultSet.java:287)
at org.firebirdsql.jdbc.AbstractResultSet.checkCursorMove(AbstractResultSet.java:275)
at org.firebirdsql.jdbc.AbstractResultSet.next(AbstractResultSet.java:350)
at org.hibernate.loader.Loader.processResultSet(Loader.java:968)
at org.hibernate.loader.Loader.doQuery(Loader.java:930)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)
at org.hibernate.loader.Loader.doList(Loader.java:2610)
at org.hibernate.loader.Loader.doList(Loader.java:2593)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2422)
at org.hibernate.loader.Loader.list(Loader.java:2417)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1339)
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)
at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483)
at org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:123)
at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:87)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:116)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:106)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:499)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:477)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy107.listByFakturaData(Unknown Source)
at ekoncept.controller.FakturaController.listByDates(FakturaController.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
I finally choosen the second solution with adding annotiation #Transactional in file FakturaRepository.java
package ekoncept.repositories;
import ...
#Repository
#Transactional
public interface FakturaRepository extends JpaRepository<Faktura, Integer> {
...
}
and I removed defaultResultSetHoldable=true from spring.datasource.url
spring.datasource.url=jdbc:firebirdsql://localhost:3050/pension?charSet=utf8
Everything is working fine now.
Adding defaultResultSetHoldable=true to spring.datasource.url helped. Now it looks like this:
spring.datasource.url=jdbc:firebirdsql://localhost:3050/pension?charSet=utf8&defaultResultSetHoldable=true
and it's working fine - I got a JSON answer with data.
Related
I have a springboot application deployed on Azure app service. I am trying to get response from detectIntent method of dialogflow. I am getting the
com.google.api.gax.rpc.UnknownException: io.grpc.StatusRuntimeException: UNKNOWN: Channel Pipeline: [WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0] exception.
The app is deployed as war file on the azure app service. Locally it works fine (IDE) also the war file runs successfully in tomcat server.
protected DetectIntentResponse getActionFromNLPV2(String userQuery, String sessionId){
log.info("Start of getActionFromNLPV2");
DetectIntentResponse response =null;
try {
try ( SessionsClient sessionsClient = SessionsClient.create(sessionsSettings)) {
log.info("Start of getActionFromNLPV2");
SessionName session = SessionName.of(projectId, sessionId);
log.info("SessionName " + session);
Builder textInput = TextInput.newBuilder().setText(userQuery).setLanguageCode("en");
QueryInput queryInput = QueryInput.newBuilder().setText(textInput).build();
response = sessionsClient.detectIntent(session, queryInput);
if (response!=null) {
return response;
} else {
return null;
}
}
} catch (Exception e) {
log.error("Exception from getting action data from NLP" + e);
return null;
}
}
pom.xml
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-dialogflow</artifactId>
<version>0.107.0-alpha</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.89.0</version>
</dependency>
full stack trace
2022-08-09T11:29:14.637263290Z Exception from getting action data from NLP
2022-08-09T11:29:14.644974865Z com.google.api.gax.rpc.UnknownException: io.grpc.StatusRuntimeException: UNKNOWN: Channel Pipeline: [WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
2022-08-09T11:29:14.646319678Z at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:47)
2022-08-09T11:29:14.646836283Z at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
2022-08-09T11:29:14.647275788Z at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
2022-08-09T11:29:14.654538558Z at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
2022-08-09T11:29:14.654556159Z at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68)
2022-08-09T11:29:14.654893862Z at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:982)
2022-08-09T11:29:14.655115264Z at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
2022-08-09T11:29:14.655283666Z at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1138)
2022-08-09T11:29:14.655474368Z at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:957)
2022-08-09T11:29:14.655482668Z at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:748)
2022-08-09T11:29:14.655639969Z at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:515)
2022-08-09T11:29:14.656248975Z at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:490)
2022-08-09T11:29:14.656562978Z at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
2022-08-09T11:29:14.656572578Z at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
2022-08-09T11:29:14.656576178Z at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
2022-08-09T11:29:14.656579678Z at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:700)
2022-08-09T11:29:14.657373486Z at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
2022-08-09T11:29:14.657388286Z at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
2022-08-09T11:29:14.657495487Z at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
2022-08-09T11:29:14.657502087Z at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:399)
2022-08-09T11:29:14.657506087Z at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:510)
2022-08-09T11:29:14.657689989Z at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:66)
2022-08-09T11:29:14.744958540Z at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:630)
2022-08-09T11:29:14.744982941Z at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:518)
2022-08-09T11:29:14.744987641Z at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:692)
2022-08-09T11:29:14.744991041Z at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:681)
2022-08-09T11:29:14.744994641Z at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
2022-08-09T11:29:14.744997941Z at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
2022-08-09T11:29:14.745001541Z at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
2022-08-09T11:29:14.745004541Z at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2022-08-09T11:29:14.745007741Z at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
2022-08-09T11:29:14.745010941Z at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
2022-08-09T11:29:14.745027341Z at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2022-08-09T11:29:14.745030641Z at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2022-08-09T11:29:14.745033741Z at java.lang.Thread.run(Thread.java:748)
2022-08-09T11:29:14.745036741Z Suppressed: com.google.api.gax.rpc.AsyncTaskException: Asynchronous task failed
2022-08-09T11:29:14.745039841Z at com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:57)
2022-08-09T11:29:14.745042941Z at com.google.api.gax.rpc.UnaryCallable.call(UnaryCallable.java:112)
2022-08-09T11:29:14.745046041Z at com.google.cloud.dialogflow.v2beta1.SessionsClient.detectIntent(SessionsClient.java:253)
2022-08-09T11:29:14.745049141Z at com.google.cloud.dialogflow.v2beta1.SessionsClient.detectIntent(SessionsClient.java:188)
2022-08-09T11:29:14.745052341Z at com.zensar.zenconverseassist.controller.AbstractAPIConnectionLayer.getActionFromNLPV2(AbstractAPIConnectionLayer.java:91)
2022-08-09T11:29:14.745055541Z at com.zensar.zenconverseassist.controller.ActionInfoControllerV2.getActionInfo(ActionInfoControllerV2.java:62)
2022-08-09T11:29:14.745058741Z at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2022-08-09T11:29:14.745061741Z at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2022-08-09T11:29:14.745066041Z at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2022-08-09T11:29:14.745069241Z at java.lang.reflect.Method.invoke(Method.java:498)
2022-08-09T11:29:14.745072241Z at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
2022-08-09T11:29:14.745075441Z at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
2022-08-09T11:29:14.745078642Z at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
2022-08-09T11:29:14.745081842Z at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
2022-08-09T11:29:14.745086042Z at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
2022-08-09T11:29:14.745089442Z at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
2022-08-09T11:29:14.745092642Zat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
2022-08-09T11:29:14.745095842Z at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
2022-08-09T11:29:14.745099042Z at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
2022-08-09T11:29:14.745104742Z at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
2022-08-09T11:29:14.745107942Z at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
2022-08-09T11:29:14.745111042Z at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
2022-08-09T11:29:14.745114142Z at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
2022-08-09T11:29:14.745117142Z at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
2022-08-09T11:29:14.745120242Z at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2022-08-09T11:29:14.745123342Z at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
2022-08-09T11:29:14.745126342Z at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2022-08-09T11:29:14.745129442Z at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2022-08-09T11:29:14.745132542Z at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
2022-08-09T11:29:14.745135942Z at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
2022-08-09T11:29:14.745139142Z at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2022-08-09T11:29:14.745142242Z at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2022-08-09T11:29:14.745145342Z at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
2022-08-09T11:29:14.745148442Z at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
2022-08-09T11:29:14.745151642Z at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2022-08-09T11:29:14.745154742Z at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2022-08-09T11:29:14.745157842Z at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
2022-08-09T11:29:14.745160942Z at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
2022-08-09T11:29:14.745164042Z at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2022-08-09T11:29:14.745167142Z at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2022-08-09T11:29:14.745170242Z at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
2022-08-09T11:29:14.745173342Z at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
2022-08-09T11:29:14.745178943Z at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2022-08-09T11:29:14.745182143Z at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2022-08-09T11:29:14.745185343Z at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115)
2022-08-09T11:29:14.745188443Z at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59)
2022-08-09T11:29:14.745191543Z at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90)
2022-08-09T11:29:14.745194643Z at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
2022-08-09T11:29:14.745197743Zat org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108)
2022-08-09T11:29:14.745201043Z at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2022-08-09T11:29:14.745204243Z at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2022-08-09T11:29:14.745207343Z at com.microsoft.azure.appservice.filters.AppServiceFilter.doFilter(AppServiceFilter.java:59)
2022-08-09T11:29:14.745210443Z at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2022-08-09T11:29:14.745213543Z at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2022-08-09T11:29:14.745216643Z at com.microsoft.azure.appservice.EasyAuthFilter.doFilter(EasyAuthFilter.java:42)
2022-08-09T11:29:14.745219743Z at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2022-08-09T11:29:14.745222843Z at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2022-08-09T11:29:14.745225943Z at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:196)
2022-08-09T11:29:14.745229043Z at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
2022-08-09T11:29:14.745232143Z at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
2022-08-09T11:29:14.745235243Z at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
2022-08-09T11:29:14.745238343Z at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
2022-08-09T11:29:14.745241443Z at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:698)
2022-08-09T11:29:14.745244743Z at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
2022-08-09T11:29:14.745259843Z at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:364)
2022-08-09T11:29:14.745263443Z at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:624)
2022-08-09T11:29:14.745269743Z at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
2022-08-09T11:29:14.745273343Z at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831)
2022-08-09T11:29:14.745276943Z at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1650)
2022-08-09T11:29:14.745280743Z at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
2022-08-09T11:29:14.745284244Z at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
2022-08-09T11:29:14.745287744Z at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
2022-08-09T11:29:14.745291444Z at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
2022-08-09T11:29:14.745295044Z ... 1 more
2022-08-09T11:29:14.745298444Z Caused by: io.grpc.StatusRuntimeException: UNKNOWN: Channel Pipeline: [WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
2022-08-09T11:29:14.745302044Z at io.grpc.Status.asRuntimeException(Status.java:533)
2022-08-09T11:29:14.745305444Z ... 24 more
2022-08-09T11:29:14.745308844Z Caused by: io.grpc.netty.shaded.io.netty.channel.ChannelPipelineException: io.grpc.netty.shaded.io.grpc.netty.ProtocolNegotiators$ClientTlsHandler.handlerAdded() has thrown an exception; removed.
2022-08-09T11:29:14.745312544Z at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:625)
2022-08-09T11:29:14.745316044Z at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.replace(DefaultChannelPipeline.java:573)
2022-08-09T11:29:14.745319544Z at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.replace(DefaultChannelPipeline.java:516)
2022-08-09T11:29:14.745323144Z at io.grpc.netty.shaded.io.grpc.netty.ProtocolNegotiators$ProtocolNegotiationHandler.fireProtocolNegotiationEvent(ProtocolNegotiators.java:949)
2022-08-09T11:29:14.745326744Z at io.grpc.netty.shaded.io.grpc.netty.ProtocolNegotiators$WaitUntilActiveHandler.channelActive(ProtocolNegotiators.java:858)
2022-08-09T11:29:14.745330244Z at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:225)
2022-08-09T11:29:14.745333844Z at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:211)
2022-08-09T11:29:14.745337344Z at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelActive(AbstractChannelHandlerContext.java:204)
2022-08-09T11:29:14.745340844Z at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelActive(DefaultChannelPipeline.java:1409)
2022-08-09T11:29:14.745344544Z at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:225)
2022-08-09T11:29:14.745351344Z at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:211)
2022-08-09T11:29:14.745355044Z at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelActive(DefaultChannelPipeline.java:906)
2022-08-09T11:29:14.745358944Z at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.fulfillConnectPromise(AbstractEpollChannel.java:615)
2022-08-09T11:29:14.745362644Z at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:648)
2022-08-09T11:29:14.745366344Z at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:524)
2022-08-09T11:29:14.745369844Z at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:414)
2022-08-09T11:29:14.745373344Z at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:326)
2022-08-09T11:29:14.745376844Z at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
2022-08-09T11:29:14.745380344Z at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
2022-08-09T11:29:14.745383744Z at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2022-08-09T11:29:14.745387245Z ... 1 more
2022-08-09T11:29:14.745390745Z Caused by: java.lang.RuntimeException: ALPN unsupported. Is your classpath configured correctly? For Conscrypt, add the appropriate Conscrypt JAR to classpath and set the security provider. For Jetty-ALPN, see http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-starting
2022-08-09T11:29:14.745394645Z at io.grpc.netty.shaded.io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$FailureWrapper.wrapSslEngine(JdkAlpnApplicationProtocolNegotiator.java:122)
2022-08-09T11:29:14.745398245Z at io.grpc.netty.shaded.io.netty.handler.ssl.JdkSslContext.configureAndWrapEngine(JdkSslContext.java:360)
2022-08-09T11:29:14.745401745Z at io.grpc.netty.shaded.io.netty.handler.ssl.JdkSslContext.newEngine(JdkSslContext.java:335)
2022-08-09T11:29:14.745405145Z at io.grpc.netty.shaded.io.grpc.netty.ProtocolNegotiators$ClientTlsHandler.handlerAdded0(ProtocolNegotiators.java:341)
2022-08-09T11:29:14.745408745Z at io.grpc.netty.shaded.io.grpc.netty.ProtocolNegotiators$ProtocolNegotiationHandler.handlerAdded(ProtocolNegotiators.java:908)
2022-08-09T11:29:14.745412245Z at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:964)
2022-08-09T11:29:14.745415745Z at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:610)
2022-08-09T11:29:14.745419345Z ... 20 more
I'm get stuck with how i can using #NamedStoredProcedureQuery with schema in Entity for my Service.For example i have a shema call "appschema" and my store procedure base on another schema like "dbschema",i have create the same proc in my default schema everything work fine but when i try to using procedureName = "dbschema.myStoreName" it's not understand. So anybody can help!
Thanks for yours help.
This is my Entities:
#Entity
#NamedStoredProcedureQuery(name = "TestProc", procedureName = "appSchema.P_GET_ACCOUNT_INFO",
resultClasses = {
ProcGetAccounts.class }, parameters = {
#StoredProcedureParameter(name = "pm_id", type = String.class, mode = ParameterMode.IN),
#StoredProcedureParameter(name = "pm_acct", type = String.class, mode = ParameterMode.INOUT),
#StoredProcedureParameter(name = "pm_acct_name", type = String.class, mode = ParameterMode.INOUT),
#StoredProcedureParameter(name = "pm_acct_type", type = String.class, mode = ParameterMode.INOUT),
#StoredProcedureParameter(name = "pm_curr", type = String.class, mode = ParameterMode.INOUT),
#StoredProcedureParameter(name = "pm_date", type = Date.class, mode = ParameterMode.IN),
#StoredProcedureParameter(name = "p_err", type = Float.class, mode = ParameterMode.OUT),
#StoredProcedureParameter(name = "p_ref_cur", type = void.class, mode = ParameterMode.REF_CURSOR) })
public class ProcGetAccounts implements Serializable{...}
this is the error:
03-11-2018 11:06:51 DEBUG (http-nio-8866-exec-2)
{call appSchema.P_GET_ACCOUNT_INFO(?,?,?,?,?,?,?,?)}
Hibernate:
{call appSchema.P_GET_ACCOUNT_INFO(?,?,?,?,?,?,?,?)}
03-11-2018 11:06:51 DEBUG (http-nio-8866-exec-2) Stored procedure [appSchema.P_GET_ACCOUNT_INFO] IN/INOUT parameter [org.hibernate.procedure.internal.NamedParameterRegistration#2e3edb84] not bound and `passNulls` was set to false; assuming procedure defines default value
03-11-2018 11:06:51 DEBUG (http-nio-8866-exec-2) Stored procedure [appSchema.P_GET_ACCOUNT_INFO] IN/INOUT parameter [org.hibernate.procedure.internal.NamedParameterRegistration#735676a9] not bound and `passNulls` was set to false; assuming procedure defines default value
03-11-2018 11:06:51 DEBUG (http-nio-8866-exec-2) Stored procedure [appSchema.P_GET_ACCOUNT_INFO] IN/INOUT parameter [org.hibernate.procedure.internal.NamedParameterRegistration#7485f578] not bound and `passNulls` was set to false; assuming procedure defines default value
03-11-2018 11:06:51 DEBUG (http-nio-8866-exec-2) Stored procedure [appSchema.P_GET_ACCOUNT_INFO] IN/INOUT parameter [org.hibernate.procedure.internal.NamedParameterRegistration#1cb9b23c] not bound and `passNulls` was set to false; assuming procedure defines default value
03-11-2018 11:06:51 DEBUG (http-nio-8866-exec-2) Error calling CallableStatement.getMoreResults [appSchema.P_GET_ACCOUNT_INFO]
java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00201: identifier 'appSchema.P_GET_ACCOUNT_INFO' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:205) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1043) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3613) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3714) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4755) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378) ~[ojdbc6.jar:11.2.0.4.0]
at org.hibernate.result.internal.OutputsImpl.<init>(OutputsImpl.java:52) [hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.procedure.internal.ProcedureOutputsImpl.<init>(ProcedureOutputsImpl.java:32) [hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.procedure.internal.ProcedureCallImpl.buildOutputs(ProcedureCallImpl.java:411) [hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.procedure.internal.ProcedureCallImpl.getOutputs(ProcedureCallImpl.java:363) [hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.jpa.internal.StoredProcedureQueryImpl.outputs(StoredProcedureQueryImpl.java:234) [hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.jpa.internal.StoredProcedureQueryImpl.execute(StoredProcedureQueryImpl.java:217) [hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
at com.dab.ptud.spring.ws.app.access.CollateralAccountsDaoImpl.getCollateralAccountsByTaxCode(CollateralAccountsDaoImpl.java:60) [classes/:?]
at com.dab.ptud.spring.ws.app.access.CollateralAccountsDaoImpl$$FastClassBySpringCGLIB$$d256a02e.invoke(<generated>) [classes/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) [spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) [spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) [spring-tx-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) [spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at com.dab.ptud.spring.ws.app.access.CollateralAccountsDaoImpl$$EnhancerBySpringCGLIB$$43f5a35a.getCollateralAccountsByTaxCode(<generated>) [classes/:?]
at com.dab.ptud.spring.ws.app.business.CollateralAccountsBoImpl.getCollaterallAccountsByTaxCode(CollateralAccountsBoImpl.java:44) [classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_102]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_102]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) [spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) [spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) [spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) [spring-tx-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) [spring-tx-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) [spring-tx-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) [spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at com.sun.proxy.$Proxy83.getCollaterallAccountsByTaxCode(Unknown Source) [?:?]
at com.dab.ptud.spring.ws.app.services.BaseServicesImpl.HandlerMsg(BaseServicesImpl.java:190) [classes/:?]
at com.dab.ptud.spring.ws.app.endpoint.SpringWebserviceEndPoint.callExecution(SpringWebserviceEndPoint.java:46) [classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_102]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_102]
at org.springframework.ws.server.endpoint.MethodEndpoint.invoke(MethodEndpoint.java:134) [spring-ws-core-2.4.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter.invokeInternal(DefaultMethodEndpointAdapter.java:291) [spring-ws-core-2.4.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter.invoke(AbstractMethodEndpointAdapter.java:55) [spring-ws-core-2.4.2.RELEASE.jar:?]
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:236) [spring-ws-core-2.4.2.RELEASE.jar:?]
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:176) [spring-ws-core-2.4.2.RELEASE.jar:?]
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89) [spring-ws-core-2.4.2.RELEASE.jar:?]
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:61) [spring-ws-core-2.4.2.RELEASE.jar:?]
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293) [spring-ws-core-2.4.2.RELEASE.jar:?]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) [spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) [spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.27.jar:8.5.27]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_102]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_102]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.27.jar:8.5.27]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_102]
I found my problems that i have to permitted my app schema to can execute Proc in another schema. I'm using Oracle Database.
#Transactional
public void importarAdiantamento(LayoutArquivo arquivo, Usuario usuario) throws Exception {
try {
DateFormat fmt = new SimpleDateFormat("dd/MM/yyyy");
SqlParameterSource in = new MapSqlParameterSource()
.addValue("DATAVCM", new java.sql.Date(fmt.parse(arquivo.getVencimento()).getTime()))
.addValue("VALOR", arquivo.getValor())
.addValue("MOTIVO", arquivo.getCodMotivo())
.addValue("EMPRESA", arquivo.getCodEmpresa())
.addValue("NPARCELA", 1)
.addValue("TOTALPARCELA", 1)
.addValue("DOCUMENTO", arquivo.getDocumento())
.addValue("FUNCIONARIO", arquivo.getCodFunc())
.addValue("HISTORICO", "VALE IMPORTADO")
.addValue("EXPORTAR", 0)
.addValue("USUARIO", usuario.getCodigousuario())
.addValue("DUPLIC", 0)
.addValue("PROTOCOLO", "0");
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate).withCatalogName("dbo").withProcedureName(AdiantamentoQueries.importarAdiantamento());
jdbcCall.execute(in);
} catch (Exception e) {
throw new Exception(e);
}
}
public class AdiantamentoQueries {
public static String importarAdiantamento() {
return "AD_INSERT_ADIANTAMENTO_PARCELAS ?,?,?,?,?,?,?,?,?,?,?,?,?";
}
}
The exception thrown is:
java.lang.IllegalArgumentException: Erro ao importar Adiantamentos: org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call dbo.AD_INSERT_ADIANTAMENTO_PARCELAS ?,?,?,?,?,?,?,?,?,?,?,?,?()}]; SQL state [null]; error code [0]; O valor não está definido para o número de parâmetro 1.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: O valor não está definido para o número de parâmetro 1.
at br.com.adiantamento.controller.ImportacaoController.importarAdiantamento(ImportacaoController.java:172) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.27.jar:8.5.27]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.27.jar:8.5.27]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.27.jar:8.5.27]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
The value is not set for parameter number 1 .; nested exception is
com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set
to parameter number 1.
I see many tutorials and anwser about with use SimpleJdbcCall spring.
but no success, i am try this way, and have exception.
Other doubt, My parameter DUPLIC is a out parameter, how to use this out parameter in my code?
Obs: the database used is SQL Server
Edit: here's the procedure:
ALTER PROCEDURE [dbo].[AD_INSERT_ADIANTAMENTO_PARCELAS]
(#DATAVCM DATE,
#VALOR NUMERIC(18,2),
#MOTIVO INT,
#EMPRESA INT,
#NPARCELA INT,
#TOTALPARCELA INT,
#DOCUMENTO VARCHAR(100),
#FUNCIONARIO INT,
#HISTORICO VARCHAR(100),
#EXPORTAR INT,
#USUARIO INT,
#DUPLIC INT OUTPUT,
#PROTOCOLO VARCHAR(100))
AS
...
Here is the sample code.
declareParameters - Declare all input and output parameters of the
procedure. Use SqlOutParameter class for declaring the output
parameter
You can define DUPLIC as NUMBER (i.e. output parameter) and get the values using getInt.
Sample code:-
SimpleJdbcCall insertParcelas = new SimpleJdbcCall(jdbcTemplate)
.withSchemaName("dbo")
.withCatalogName("dbo")
.withProcedureName("AD_INSERT_ADIANTAMENTO_PARCELAS")
.declareParameters(
new SqlParameter("DATAVCM", OracleTypes.DATE),
new SqlParameter("VALOR", OracleTypes.VARCHAR),
....
new SqlOutParameter("DUPLIC", OracleTypes.NUMBER));
DateFormat fmt = new SimpleDateFormat("dd/MM/yyyy");
SqlParameterSource in = new MapSqlParameterSource()
.addValue("DATAVCM", new java.sql.Date(fmt.parse(arquivo.getVencimento()).getTime()))
.addValue("VALOR", arquivo.getValor())
.addValue("MOTIVO", arquivo.getCodMotivo())
.addValue("EMPRESA", arquivo.getCodEmpresa())
.addValue("NPARCELA", 1)
.addValue("TOTALPARCELA", 1)
.addValue("DOCUMENTO", arquivo.getDocumento())
.addValue("FUNCIONARIO", arquivo.getCodFunc())
.addValue("HISTORICO", "VALE IMPORTADO")
.addValue("EXPORTAR", 0)
.addValue("USUARIO", usuario.getCodigousuario())
.addValue("DUPLIC", 0)
.addValue("PROTOCOLO", "0");
Map<String, Object> out = insertParcelas.execute(in);
if (out != null && !out.isEmpty()) {
Sysout.out.println(out.getInt("DUPLIC"));
}
I am using Spring NamedParamJdbcTemplate in a spring Boot application.
I am defining all the CRUD operations in a different class for reusability and returning ResultSet object as the output for DML operations. When I try to parse the returned ResultSet object in calling class I am getting exception saying ResultSet object is closed. If I parse the Resultset right after I get the reponse from query execution I can do with out any problem but it kills the re usability as I want to use the same method for multiple read operations with different queries.
Adding what I options I know, of this problem to give little bit clarity.
EDIT:
even it shows the same for configuring different transaction managers for different data sources.
What I have thought was keeping the transaction open on getStudentInfo(String stdntNbr) would solve this is( keep ResultSet object open in calling method in different class),but it hasn't worked.
I have three probable solutions:
1) Parsing the ResultSet object in same method ( or by calling another method in same class) and differentiate the ResultSet object parsing logic based on the query executed and assigning it to proper java bean and send it as an Object type and cast it back in the calling method.
2) Parsing the ResultSet object and assign it to a List of type Map and send the List back to the calling method and there again parsing the List of Map's and assign it to the proper java bean.
This is a performance killer as I am mapping the values twice for the same result( one from ResultSet to List of Map's and another from List of Map's to respective java bean.
3) (Not working)
Enabling Declarative transaction ( if I parse the ResultSet object in same transaction it wont close the ResultSet , so in those terms I am trying to enable the transaction on calling method. But it seems like its not keeping the ResultSet object alive .i.e. ResultSet object is closing as usual when I try to parse. Below is the sample code I am using, at the end please find the stack trace.
So my questions are:
1) But what I am interested in is to just return the ResultSet object after query execution and parse it on the calling class in another method. Does it possible by using Spring Jdbc?
2) For doing above thing, does enabling Declarative Transaction( #Transactional with the created transaction manager on respective data source) keep the ResultSet object open until that transaction closed(say, calling from a method in Service layer class to a method in DAO layer class) ?
I have referred Spring Docs to configire
Note :
I am having two data sources namely redDataSource, greenDataSource from them I am creating two NamedParamJdbcTemplate objects namely redJdbcTemplate and greenJdbcTemplate, for each data source one transaction manager namely redTxManager and greenTxManager
Code :
#Repository
public class RedJdbcOperations {
public static final int SQL_TIMEOUT = 5; //in seconds
#Autowired
#Qualifier("redJdbcTemplate")
NamedParameterJdbcTemplate redJdbcTemplate;
public ResultSet read(String sqlQuery,Map<String,?> paramMap) {
return redJdbcTemplate.execute(sqlQuery, paramMap, ps -> {
ps.setQueryTimeout(SQL_TIMEOUT);
return ps.executeQuery();
});
}
}
when I call the method in above class from the method in below class , I am getting the closed ResultSet object exception.
#Component
public class StudentDAOImpl implements StudentDAO {
private static final String STUDENT_DATA_INFO_SQL = "Select STDNT_KEY, STUDENT_TYPE_NBR, GRP_CDE from RED.STUDENT_DATA";
#Autowired
RedJdbcOperations redOperations;
#Autowired
GreenJdbcOperations greenOperations;
#Override
#Transactional("redTxManager")
public StudentVO getStudentInfo(String stdntNbr) {
Map<String, ?> mapParam = new HashMap<>();
mapParam.put("rollNbr", 1444);
ResultSet rs = redOperations.readCapp(StudentQueries.STUDENT_DATA_INFO_SQL, mapParam);
try {
if(rs.next())
return populateStudentVO(rs);
} catch (NullPointerException e) {
//throw custom exception
return null;
} catch (SQLException e) {
//throw custom exception
} catch (Exception e) {
//throw custom exception
}
return null;
}
private StudentVO populateStudentVO(ResultSet rs) throws SQLException {
StudentVO student = null;
if (rs.next()) {
student = new StudentVO();
student.setAcctKey(rs.getString("STDNT_KEY"));
student.setTypeNbr(rs.getString("STUDENT_TYPE_NBR"));
student.setGrpCode(rs.getInt("GRP_CDE"));
}
return student;
}
And I have the configuration defined in below class in support of #Transactional("redTxManager")
#Configuration
#EnableTransactionManagement
#Profile("local")
public class DBConfigLocal {
/*varibale configuration for reading from yml files
*/
#Bean(name = "redDataSource")
public DataSource redRestDataSource() {
return getDataSource(datasourceDriver, redOracleUrl, redDbUsername, redDbPassword, minPoolSize, maxPoolSize,
maxWaitTime);
}
#Bean(name = "greenDataSource")
#Primary
public DataSource greenRestDataSource() {
return getDataSource(datasourceDriver, greenOracleUrl, greenDbUsername, greenDbPassword, minPoolSize, maxPoolSize,
maxWaitTime);
}
#Bean(name = "redJdbcTemplate")
public NamedParameterJdbcTemplate createRedJdbcTemplate() {
NamedParameterJdbcDaoSupport daoSupport = new NamedParameterJdbcDaoSupport();
daoSupport.setDataSource(redRestDataSource());
return daoSupport.getNamedParameterJdbcTemplate();
}
#Bean(name = "greenJdbcTemplate")
public NamedParameterJdbcTemplate createGreenJdbcTemplate() {
NamedParameterJdbcDaoSupport daoSupport = new NamedParameterJdbcDaoSupport();
daoSupport.setDataSource(greenRestDataSource());
return daoSupport.getNamedParameterJdbcTemplate();
}
#Bean("redTxManager")
#Primary
public PlatformTransactionManager redTransactionManager() {
DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
transactionManager.setDataSource(redRestDataSource());
return transactionManager;
}
#Bean("greenTxManager")
public PlatformTransactionManager greenTransactionManager() {
DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
transactionManager.setDataSource(greenRestDataSource());
return transactionManager;
}
private DataSource getDataSource(String datasourceDriver, String url, String userName, String password,
int minPoolSize, int maxPoolSize, int maxWaitTime) {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(datasourceDriver);
dataSource.setUrl(url);
dataSource.setUsername(userName);
dataSource.setPassword(password);
dataSource.setInitialSize(minPoolSize);
dataSource.setMaxActive(maxPoolSize);
dataSource.setMaxWait(maxWaitTime);
return dataSource;
}
}
Even after configuration I am still getting the Exception saying ResultSet object is closed
I am not sure whats going wrong here , any help is appreciated.
EDIT : stack trace
[http-nio-8080-exec-3]: DEBUG o.s.web.servlet.DispatcherServlet 869 - DispatcherServlet with name 'dispatcherServlet' processing POST request for [/student/v1/recom/query]
[http-nio-8080-exec-3]: DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping 310 - Looking up handler method for path /student/v1/recom/query
[http-nio-8080-exec-3]: DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping 317 - Returning handler method [public com.api.ex.vo.StudentVO com.api.ex.controller.StudentController.studentRecom(com.api.ex.vo.StudentRecmRequestVO)]
[http-nio-8080-exec-3]: DEBUG o.s.w.s.m.m.a.RequestResponseBodyMethodProcessor 197 - Read [class com.api.ex.vo.StudentRequestVO] as "application/json;charset=UTF-8" with [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter#7c91e6d4]
[http-nio-8080-exec-3]: ERROR c.a.e.daoimpl.StudentDAOImpl 151 - Error while trying to execute the query = Select STDNT_KEY, STUDENT_TYPE_NBR, GRP_CDE from RED.STUDENT_DATA WHERE STDNT_KEY = :rollNbrjava.sql.SQLRecoverableException: Closed Resultset: next

 at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:238) ~[ojdbc6-11.2.0.4.jar:11.2.0.3.0]

 at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207) ~[commons-dbcp-1.4.jar:1.4]

 at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207) ~[commons-dbcp-1.4.jar:1.4]

 at com.api.ex.daoimpl.StudentDAOImpl .getStudentInfo(RecomsDAOImpl.java:145) [bin/:na]

 at com.api.ex.daoimpl.StudentDAOImpl .getStudentInfo(RecomsDAOImpl.java:1) [bin/:na]

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_77]

 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_77]

 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_77]

 at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_77]

 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) [spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) [spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) [spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) [spring-tx-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) [spring-tx-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) [spring-tx-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) [spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at com.sun.proxy.$Proxy219.getStudentInfo(Unknown Source) [na:na]

 at com.api.ex.serviceimpl.StudentServiceImpl.getStudentRecommendations(StudentServiceImpl.java:228) [bin/:na]

 at com.api.ex.controller.StudentsController.studentRecom(StudentController.java:64) [bin/:na]

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_77]

 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_77]

 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_77]

 at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_77]

 at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]

 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110) [spring-boot-actuator-1.5.8.RELEASE.jar:1.5.8.RELEASE]

 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106) [spring-boot-actuator-1.5.8.RELEASE.jar:1.5.8.RELEASE]

 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE]

 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_77]

 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_77]

 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.23.jar:8.5.23]

 at java.lang.Thread.run(Thread.java:745) [na:1.8.0_77]
I have created a repository for my entity and I added two methods to it as following :
#Modifying
#Query("UPDATE Offre o SET o.state = 'DISABLED' where o.codeOffre=:x")
void disable(#Param("x") Long offre);
#Modifying
#Query("UPDATE Offre o SET o.state = 'REMOVED' where o.codeOffre=:x")
void remove(#Param("x") Long offre);
Offre entity :
#Entity
public class Offre implements Serializable {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "CODE_OFFRE")
private Long codeOffre;
private String titre;
#Enumerated(EnumType.STRING)
#Column(columnDefinition = "ENUM('ENABLED', 'DISABLED', 'REMOVED') DEFAULT 'ENABLED'")
private State state;
//Getters,Setters
}
and this is my service class :
#Service
public class OffreMetierImpl implements IOffreMetier {
#Autowired
private OffreRepository offreRepository;
#Override
#Modifying
public boolean removeOffre(Long codeOffre) {
offreRepository.remove(codeOffre);
return true;
}
#Override
#Modifying
public boolean disableOffre(Long codeOffre) {
offreRepository.disable(codeOffre);
return true;
}
// Other methods
}
but when I call offreRepository.remove I'm getting this error message :
failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query] with root cause javax.persistence.TransactionRequiredException: Executing an update/delete query
How can I solve this problem ?
Edit :
full stack trace :
2016-03-23 12:22:51,076 [http-nio-8080-exec-10] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query] with root cause
javax.persistence.TransactionRequiredException: Executing an update/delete query
at org.hibernate.jpa.spi.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:71)
at org.springframework.data.jpa.repository.query.JpaQueryExecution$ModifyingExecution.doExecute(JpaQueryExecution.java:238)
at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:78)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:100)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:91)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:462)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:440)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:131)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
at com.sun.proxy.$Proxy101.remove(Unknown Source)
at com.capValue.Rekrute.metierImpl.OffreMetierImpl.removeOffre(OffreMetierImpl.java:44)
at com.capValue.Rekrute.service.OffreService.removeOffre(OffreService.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
at org.springframework.web.servlet.FrameworkServlet.doDelete(FrameworkServlet.java:892)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:654)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Please make sure that following things are correct at your end.
Your #Modifying annotation should be wrapped up with #Transactional attribute which helps post-processor wraps #Transactional annotated bean methods with an AOP method interceptor which handles transactional behavior.
example
#Modifying
#Transactional
#Query("UPDATE Offre o SET o.state = 'DISABLED' where o.codeOffre=:x")
void disable(#Param("x") Long offre);
Also make sure entries for context:component-scan and
<tx:annotation-driven /> declared at application level (in application context.
Please refer post1 post2 for more information regards.