非常感谢你给我这个机会。
我试图调用一个Oracle存储过程在Quarkus应用程序,但当我尝试REST调用中断,而不是返回数据。
在我的代码中,我有其他资源,实现直接选择在相同的数据库,并为我返回正常的数据。
但当我尝试调用这个存储过程时,这个调用保持在循环中,而不是为我响应数据。
quarkus版本:2。1。1。Final
Oracle数据库:9。2。0。1
POM:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-oracle</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>9.2.0.1</version>
</dependency>
我使用AgroalDatasource。
我的application。properties的一些参数
quarkus.datasource.ORACLEDB.db-kind=oracle
quarkus.datasource.ORACLEDB.jdbc.driver=oracle.jdbc.driver.OracleDriver
quarkus.datasource.ORACLEDB.jdbc.url=jdbc:oracle:thin:@localhost:1521/SOMENAME
quarkus.datasource.jdbc.driver=io.opentracing.contrib.jdbc.TracingDriver
quarkus.datasource.ORACLEDB.username=xxxxxx
quarkus.datasource.ORACLEDB.password=qqqqqqqqq
非常感谢
调试日志:
669 DEBUG [io.net.uti.Recycler] (vert.x-eventloop-thread-5) -Dio.netty.recycler.maxCapacityPerThread: 4096
DEBUG [io.net.uti.Recycler] (vert.x-eventloop-thread-5) -Dio.netty.recycler.maxSharedCapacityFactor: 2
DEBUG [io.net.uti.Recycler] (vert.x-eventloop-thread-5) -Dio.netty.recycler.linkCapacity: 16
DEBUG [io.net.uti.Recycler] (vert.x-eventloop-thread-5) -Dio.netty.recycler.ratio: 8
DEBUG [io.net.uti.Recycler] (vert.x-eventloop-thread-5) -Dio.netty.recycler.delayedQueue.ratio: 8
DEBUG [io.net.buf.AbstractByteBuf] (vert.x-eventloop-thread-5) -Dio.netty.buffer.checkAccessible: true
DEBUG [io.net.buf.AbstractByteBuf] (vert.x-eventloop-thread-5) -Dio.netty.buffer.checkBounds: true
DEBUG [io.net.uti.ResourceLeakDetectorFactory] (vert.x-eventloop-thread-5) Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@7efd258e
DEBUG [io.net.han.cod.com.ZlibCodecFactory] (vert.x-eventloop-thread-5) -Dio.netty.noJdkZlibDecoder: false
DEBUG [io.net.han.cod.com.ZlibCodecFactory] (vert.x-eventloop-thread-5) -Dio.netty.noJdkZlibEncoder: false
DEBUG [io.qua.mic.run.bin.ver.VertxHttpServerMetrics] (vert.x-eventloop-thread-5) requestBegin {CONNECTED_SOCKET_SAMPLE=io.micrometer.core.instrument.composite.CompositeLongTaskTimer$CompositeSample@72441d9c}, HttpRequestMetric [initialPath=/access/facilidade/11111/2222/3333/55/77, currentRoutePath=null, templatePath=null, request=io.vertx.core.http.impl.Http1xServerRequest@6c14f5c5]
DEBUG [io.qua.mic.run.bin.ver.VertxHttpServerMetrics] (vert.x-eventloop-thread-5) requestRouted null HttpRequestMetric [initialPath=/access/facilidade/11111/2222/3333/55/77, currentRoutePath=null, templatePath=null, request=io.vertx.core.http.impl.Http1xServerRequest@6c14f5c5]
DEBUG [io.qua.mic.run.bin.ver.VertxHttpServerMetrics] (vert.x-eventloop-thread-5) requestRouted null HttpRequestMetric [initialPath=/access/facilidade/11111/2222/3333/55/77, currentRoutePath=null, templatePath=null, request=io.vertx.core.http.impl.Http1xServerRequest@6c14f5c5]
DEBUG [io.qua.mic.run.bin.ver.VertxHttpServerMetrics] (vert.x-eventloop-thread-5) requestRouted null HttpRequestMetric [initialPath=/access/facilidade/11111/2222/3333/55/77, currentRoutePath=null, templatePath=null, request=io.vertx.core.http.impl.Http1xServerRequest@6c14f5c5]
DEBUG [io.qua.mic.run.bin.ver.VertxHttpServerMetrics] (vert.x-eventloop-thread-5) requestRouted / HttpRequestMetric [initialPath=/access/facilidade/11111/2222/3333/55/77, currentRoutePath=null, templatePath=null, request=io.vertx.core.http.impl.Http1xServerRequest@6c14f5c5]
DEBUG [org.jbo.res.res.i18n] (executor-thread-0) RESTEASY002315: PathInfo: /access/facilidade/11111/2222/3333/55/77
DEBUG [io.sma.fau.cor.eve.loop] (executor-thread-0) No event loop integration found
After Error: socket hang up at the Client. This erro was after I interromp the Quarkus because did already more than 30 minutes the connection.
817 DEBUG [io.qua.mic.run.bin.ver.VertxHttpServerMetrics] (vert.x-eventloop-thread-5) requestReset HttpRequestMetric [initialPath=/access/facilidade/11111/2222/3333/55/77, currentRoutePath=/, templatePath=null, request=io.vertx.core.http.impl.Http1xServerRequest@6c14f5c5]
842 DEBUG [io.qua.resteasy] (vert.x-eventloop-thread-5) IO Exception : io.vertx.core.VertxException: Connection was closed```
遵循我的代码:
控制器类:
@GET
@Path("/facilidade/{id}/{cep}/{servico}/{os}/{tipo}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<ConfirmaFacilidadeCompletaOutput> confirmaFacilidadeCompleta(
@PathParam(value="id") Long id,
@PathParam(value="cep") String cep,
@PathParam(value="servico") String servico,
@PathParam(value="os") String os,
@PathParam(value="tipo") Long tipo)
{
List<ConfirmaFacilidadeCompletaOutput> confirmaFacilidadeCompleta = (List<ConfirmaFacilidadeCompletaOutput>) service.confirmaFacilidadeCompletaService(id,cep,servico,os,tipo);
return confirmaFacilidadeCompleta;
}
DAO Class:
@Inject
@Named("ORACLEDB")
AgroalDataSource dataSource;
public List<ConfirmaFacilidadeCompletaOutput> confirmaFacilidadeCompletaDAO(Long id, String cep, String servico, String os,
Long tipo)
{
Connection connection = null;
CallableStatement callableStatement = null;
try
{
connection = dataSource.getConnection();
callableStatement = connection.prepareCall("{ ? = call OWNER.PKG_CONFIRM(?,?,?,?,?,?,?,?,?) } ");
try
{
callableStatement.registerOutParameter(1, Types.NUMERIC);
callableStatement.setLong(2,id);
callableStatement.setString(3, cep);
callableStatement.setString(4, servico);
callableStatement.setString(5, os);
callableStatement.setLong(6, tipo);
callableStatement.setString(7, null);
callableStatement.setString(8, null);
callableStatement.registerOutParameter(9, Types.VARCHAR);
callableStatement.registerOutParameter(10,Types.VARCHAR);
callableStatement.execute();
logger.info("Procedure ou Function executada com sucesso.");
List<ConfirmaFacilidadeCompletaOutput> outPut = new ArrayList<ConfirmaFacilidadeCompletaOutput>();
((ConfirmaFacilidadeCompletaOutput) outPut).setRetornoFuncao(callableStatement.getInt(1));
((ConfirmaFacilidadeCompletaOutput) outPut).setVrRetorno(callableStatement.getString(9));
((ConfirmaFacilidadeCompletaOutput) outPut).setCodRetorno(callableStatement.getString(10));
return outPut;
}
catch (SQLException e)
{
logger.error(e.getMessage());
e.printStackTrace();
}
catch (Exception e)
{
logger.error(e.getMessage());
e.printStackTrace();
}
}
catch (Exception e)
{
logger.error(e.getMessage());
e.printStackTrace();
}
finally
{
try {
if (connection != null)
connection.close();
}
catch (Exception e)
{
logger.error(e.getMessage());
e.printStackTrace();
}
}
return null;
}