我正在尝试捕获VDB部署时抛出的异常,但无法捕获,而是在teiid记录器中记录。
byte[] vdbBytes = vdbHelper.getVdbByteArray(theVDB);
try {
// Deployment name for vdb must end in '-vdb.xml'.
String deploymentName = vdbName + Constants.DYNAMIC_VDB_SUFFIX;
// Deploy the VDB
clientAccessor.getClient().deploy(deploymentName, new ByteArrayInputStream(vdbBytes));
// Wait for VDB to finish loading
long timeSt = new Date().getTime();
//logger.info("deployVdb(VDBMetaData theVDB, String vdbName, int deploymentTimeout) entering.. date "+new Timestamp(new Date().getTime()));
waitForVDBLoad(vdbName, 1, deploymentTimeout);
long timeEnd = new Date().getTime();
//logger.info("deployVdb(VDBMetaData theVDB, String vdbName, int deploymentTimeout) entering.. date "+new Timestamp(new Date().getTime()) + " time in long - " + ((timeEnd-timeSt)));
//logger.info(METHOD_NAME + " Exiting.");
}catch(Exception e) {
System.err.println(e);
}
由于我正在尝试通过创建vdb来测试连接参数,并尝试部署vdb。如果所有参数都是正确的,那么这很好,但如果有任何参数是错误的,那么期望对相应的错误参数进行正确的异常处理,例如未知主机异常,。
在WildFly中,部署过程是异步的,因此您无法捕获异常,但您可以通过Admin API请求VDB来检查错误,并显示错误。