问题描述:在开发环境,启动carte执行节点,运行trans,可以通过/kettle/transStatus接口查看实时日志。当打包完成之后,运行任务,接口/kettle/transStatus返回500异常。
解决方案:kettle-core/src/main/java/org/pentaho/di/cluster/HttpUtil.java
原生代码:
public static String encodeBase64ZippedString( String in ) throws IOException {
Charset charset = Charset.forName( Const.XML_ENCODING );
ByteArrayOutputStream baos = new ByteArrayOutputStream( 1024 );
try ( Base64OutputStream base64OutputStream = new Base64OutputStream( baos );
GZIPOutputStream gzos = new GZIPOutputStream( base64OutputStream ) ) {
gzos.write( in.getBytes( charset ) );
}
return baos.toString();
}
修改为:
public static String encodeBase64ZippedString( String in ) throws IOException {
Charset charset = Charset.forName( Const.XML_ENCODING );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = new GZIPOutputStream( baos );
gzos.write( in.getBytes( charset ) );
gzos.close();
return new String( Base64.encodeBase64( baos.toByteArray() ) );
}