I'm runnning a Pentaho PDI/Kettle job in a Play for Scala application server. I added kettle-core-7.0.0-12.jar
and kettle-engine-7.0.0-12.jar
to the classpath and it works fine the first time, but the second time it throws an error:
ClassNotFoundException: org.osjava.sj.SimpleContextFactory
The first question is why the class is found (or not used) the first time? After some research, I found that the jar simple-jndi
needs to be added to the classpath along with a simple-jndi
directory that contains a jdbc.properties
file. But after doing so, none of my application JNDI connections work, I get:
Error injecting constructor, org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
There seems to be a conflict between Pentaho's and Play's JNDI connections. Not clear why Pentaho needs the simple-jndi
jar as the first time it's not using it and it runs fine. I don't want Pentaho to use JNDI to connect to the repository, just plain JDBC.
This is how I run the job, any ideas will be welcome.
KettleEnvironment.init
val databaseMeta = new DatabaseMeta("ETL", dbType, "JDBC", host,
db, port, dbUserName, dbPassword)
val repository = new KettleDatabaseRepository
val repositoryMeta = new KettleDatabaseRepositoryMeta
repositoryMeta.setConnection(databaseMeta)
repository.init(repositoryMeta)
val conn = repository.connect(repUserName, repPassword)
// load the job
val dir = repository.findDirectory("/some dir")
val jobMeta = repository.loadJob("General ETL", dir, null, null)
val job = new Job(repository, jobMeta)
// run the ETL job
jobMeta.setParameterValue("INPUT_DATE", dateStr)
job.start
job.waitUntilFinished
val result = job.getResult
UPDATE
I added the following line to force the connection to native JDBC, but get the same error:
databaseMeta.setAccessType(DatabaseMeta.TYPE_ACCESS_NATIVE)