Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Transformation cannot use JNDI Datasource from Tomcat

  1. #1

    Default Transformation cannot use JNDI Datasource from Tomcat


    I'm trying to run Kettle Jobs from within a servlet deployed on a Tomcat 7.0

    The connection to the database is defined as a JNDI resource in Tomcat's conf/context.xml

    However when I run the Job inside my Servlet, I get the following exception:

    javax.naming.NoInitialContextException: Cannot instantiate class: [Root exception is java.lang.ClassNotFoundException:]
    Cannot instantiate class:
    Why is it trying to instantiate the SimpleJndi environment? Tomcat does supply the proper JNDI DataSource already.

    When I add simple-jndi.jar to my Webapplication then I don't get the ClassNotFoundException but PDI tries to use "" to find the connection details (which of course isn't there) instead of the DataSource supplied by the Tomcat container.

    This is how I initialize the Job in my Servlet:

    File kjb = new File("my_job_definition.kjb");
    JobMeta jobMeta = new JobMeta(kjb.getAbsolutePath(), null, null);
    Job job = new Job(null, jobMeta);
    job.setVariable("foo", someValue);
    Do I need to tell the Job that it's running in a Servlet Container and that it doesn't need the SimpleJndi stuff?
    If so, how can I do that?

    I'm aware that I could supply the file, but I don't want to maintain the DB connection information in two different places.

    Am I missing something?

  2. #2


    Found it myself.

    Instead of calling:
    I have to call
    to initialize the Kettle Environment in my Servlet.

    The parameter controls the usage of the SimpleJNDI Library and false means "do not use it"

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.