Hitachi Vantara Pentaho Community Forums
Results 1 to 9 of 9

Thread: JNDI with pan

  1. #1
    Join Date
    May 2007
    Posts
    4

    Question JNDI with pan

    Hi,

    I'm trying to execute a .ktr transform (attached) using pan.sh, and I get the following error:
    Invalid JNDI connection testconn : Cannot instantiate class: 'org.osjava.sj.SimpleContextFactory'

    The full output text is below. I'm using java 1.5 on linux. This error persists regardless of whether I have a simple-jndi jarfile (simple-jndi-0.11.2.jar) and a jndi.jar file in my classpath, so it would seem it is finding the SimpleContextFactory class somewhere in the Kettle libs.

    I was able to instantiate this class from my own test java code using the same classpath. I've put my testconn.properties file in $KETTLE_HOME/simple-jndi/. Lastly, I was also able to connect using a JDBC configuration in the .ktr transform and executing that with pan.sh.

    Can someone point me in the right direction with this error? I've done quite a bit of searching, and the best I've found is this thread where someone reports a similar problem but it is dismissed:
    http://jira.pentaho.org/browse/PDI-46

    Thanks!
    -flove


    $ ./pan.sh -file="test2.ktr"
    INFO 28-11 14:16:44,253 (LogWriter.java:println:403) -Pan - Start of run.
    2007/11/28 14:16:46:101 PST [INFO] DefaultFileReplicator - Using "/tmp/vfs_cache" as temporary files store.
    INFO 28-11 14:16:46,448 (LogWriter.java:println:403) -test - Dispatching started for transformation [test]
    INFO 28-11 14:16:46,449 (LogWriter.java:println:403) -test - Nr of arguments detected:0
    INFO 28-11 14:16:46,449 (LogWriter.java:println:403) -test - This is not a replay transformation
    INFO 28-11 14:16:46,463 (LogWriter.java:println:403) -test - This transformation can be replayed with replay date: 2007/11/28 14:16:46
    INFO 28-11 14:16:46,464 (LogWriter.java:println:403) -test - Initialising 2 steps...
    INFO 28-11 14:16:46,480 (LogWriter.java:println:403) -Text file output.0 - Opening output stream in default encoding
    ERROR 28-11 14:16:46,497 (LogWriter.java:println:400) -Table input.0 - An error occurred, processing will be stopped:
    Error occured while trying to connect to the database

    Invalid JNDI connection testconn : Cannot instantiate class: 'org.osjava.sj.SimpleContextFactory'


    ERROR 28-11 14:16:46,497 (LogWriter.java:println:400) -Table input - Error initializing step [Table input]
    ERROR 28-11 14:16:46,498 (LogWriter.java:println:400) -test - Step [Table input.0] failed to initialize!
    INFO 28-11 14:16:46,498 (LogWriter.java:println:403) -Table input.0 - Finished reading query, closing connection.
    Unable to prepare and initialize this transformation


    $ uname -a
    Linux monk 2.6.11.4-20a-smp #1 SMP Wed Mar 23 21:52:37 UTC 2005 i686 i686 i386 GNU/Linux


    $ /usr/java/jdk/bin/java -version
    java version "1.5.0_07"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
    Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)


    ## jndi.properties:
    java.naming.factory.initial='org.osjava.sj.SimpleContextFactory'
    org.osjava.sj.root='/<$KETTLE_HOME>/simple-jndi'
    org.osjava.sj.delimiter='/'
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    The problem is not dismissed at all, but since the guilty code is situated inside of the Pentaho platform code, I assigned it to the team in Orlando.
    I guess they take their time to get off their lazy *****.
    I'll talk to some people about it when I'm over there in a few weeks.

    Matt

  3. #3
    Join Date
    May 2007
    Posts
    4

    Default

    Ok, I see. Thanks, Matt. Would you happen to know where in the platform code? Please let me know if there are any updates or if there is a thread I should follow.

    Cheers,
    -f

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Actually, in version 3.0.0 of Kettle the code was simply copied to avoid the dependency with the rest of the platform.

    I believe it starts to get interesting in org.pentaho.di.core.database.util.DatabaseUtil.getDataSourceFromJndi();

    With that datasource name it creates a connection in Database.initWithJNDI()

    However, since there are plenty of factories and "hidden" code involved, I'm simply at a loss here.
    I just don't know enough about JNDI I guess.

    Matt

  5. #5

    Arrow JNDI with pan

    Hi Matt,

    I have a similar situation where I copied the kettle directory from my Windows pc to a Linux one. Everything was working fine in Windows, in Linux when I try to run a job I get a similar error

    "Invalid JNDI connection SourceSchema : Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial"


    Is this because of the 'jdbc.propertiesfile' path difference in Windows & Linux, I have my connection settings configured in this file. Is there anyway to get this working in Linux.

    Thanks in advance
    BiL

  6. #6
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    There is absolutely no reason I can think of to use JNDI in Pan and no, I would have no idea why you would change the path on Linux.

  7. #7

    Arrow

    Actually I was using the jdbc.properties file to set database connection across for all the transformations (I had two connections in, the source and the destination).. I am not sure how to run the transformation in Linux, I read the pan documentation then tried to run the transformation from command line
    ./pan.sh -file=test1lktr and hit with the error ..

    In this scenario I did not change anything in the jdbc.properties while moving it from Win to Linux.. what will be the proper way to specify db connections in Linux to run this transformation... ? (there is a source and destination database connections in the transfromation which has been specified in the jdbc.properties file inside the simple-jndi directory)

    Thanks
    BiL

  8. #8
    Join Date
    May 2007
    Posts
    4

    Default

    Hi Bil,

    I found that I could specify the java.naming.factory.initial property in a jndi.properties file located in $KETTLE_HOME. The examples I found online had the values as below. However, now I am running into an error where the SimpleContextFactory class cannot be instantiated. Let me know if you have better luck...

    -f

    ## jndi.properties:
    java.naming.factory.initial='org.osjava.sj.SimpleContextFactory'
    org.osjava.sj.root='/<$KETTLE_HOME>/simple-jndi'
    org.osjava.sj.delimiter='/'

  9. #9

    Default

    Hi,
    I tried with this....
    In Pan.bat, I added
    set OPT= -Djava.naming.factory.initial="org.osjava.sj.SimpleContextFactory" -Dorg.osjava.sj.root="D:/Kettle-3.0.2/simple-jndi" -Dorg.osjava.sj.delimiter="/"
    Now it is working fine.
    Thank You...

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.