我试图在Java中集成Kettle并执行一个转换。这些软件包被正确下载。但是,当我试图以Java应用程序的形式运行转换时,我会收到以下异常:
Unable to find plugin with ID 'Kettle'. If this is a test, make sure kettle-core tests jar is a dependency. If this is live make sure a kettle-password-encoder-plugins.xml exits in the classpath
at org.pentaho.di.core.encryption.Encr.init(Encr.java:61)
at org.pentaho.di.core.KettleClientEnvironment.init(KettleClientEnvironment.java:124)
at org.pentaho.di.core.KettleClientEnvironment.init(KettleClientEnvironment.java:80)
at org.pentaho.di.core.KettleEnvironment.init(KettleEnvironment.java:134)
at org.pentaho.di.core.KettleEnvironment.init(KettleEnvironment.java:101)
at org.pentaho.di.core.KettleEnvironment.init(KettleEnvironment.java:82)
at com.marc.TFG.test.pentaho.EjecutarTransformaciones.main(EjecutarTransformaciones.java:13)文件:EjecutarTransformaciones.java
package com.marc.TFG.test.pentaho;
import org.pentaho.di.core.KettleEnvironment;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.logging.LogLevel;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
public class EjecutarTransformaciones {
public static void main(String[] args) throws KettleException {
KettleEnvironment.init();
TransMeta transMeta = new TransMeta("D:\\PROYECTO_TFG\\KJB\\Prueba.ktr");
Trans trans = new Trans(transMeta);
trans.setLogLevel(LogLevel.BASIC);
trans.execute(null);
trans.waitUntilFinished();
if(trans.getErrors() > 0){
System.out.println("Han habido errores");
}
}
}pom.xml
<repositories>
<repository>
<id>pentaho-releases</id>
<url>https://nexus.pentaho.org/content/groups/omni</url>
</repository>
</repositories>
<!-- PENTAHO KETTLE DEPENDENCIES -->
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-core</artifactId>
<version>9.1.0.0-324</version>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-engine</artifactId>
<version>9.1.0.0-324</version>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-ui-swt</artifactId>
<version>9.1.0.0-324</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>pentaho-library</groupId>
<artifactId>libformula</artifactId>
<version>7.0.0.6-95</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle5-log4j-plugin</artifactId>
<version>7.1.0.31-241</version>
</dependency>我正在运行Java 8,希望有一个简单的解决方案
发布于 2022-10-05 09:50:15
经过几天的调查,我终于找到了一个解决办法
我添加了一个新的Source文件夹,其中包含‘kettle-password-编码器-plugins.xml’文件。
UPDATE:您可以轻松地删除资源上的文件,因此它包含在类路径中。
即:
<password-encoder-plugins>
<password-encoder-plugin id="Kettle">
<description>Kettle Password Encoder</description>
<classname>org.pentaho.support.encryption.KettleTwoWayPasswordEncoder</classname>
</password-encoder-plugin>
</password-encoder-plugins>而且看起来挺好的。
在项目中为这个文件创建一个文件夹,然后在IDE (在我的例子中是Eclipse)中,您应该可以看到在中创建的文件夹。然后右击->生成路径->用作源文件夹
https://stackoverflow.com/questions/73914032
复制相似问题