JNDI datasource for standalone application?

From: Mike Kienenberger (mkienen..laska.net)
Date: Fri Jul 23 2004 - 14:47:25 EDT

  • Next message: Jonathan Carlson: "Re: Schema Evolution"

    This isn't quite a cayenne question, but I don't know a better place to ask
    it.

    I'm using Cayenne with Oracle Application Server and have defined a JNDI
    datasource in OAS for Cayenne to use.

    However, I also have some batch processes that run out of the web
    application directory as standalone applications.

    Obviously, running them gives me a JNDI lookup error (which is what I'd
    expect).

    Cayenne DEBUG [main 07-23 14:29:41] QueryLogger: Connecting. JNDI path:
    jdbc/CachedDS
    Cayenne DEBUG [main 07-23 14:29:42] QueryLogger: *** Connecting: FAILURE.
    javax.naming.NoInitialContextException: 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
            at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
            at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
            at
    javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
            at javax.naming.InitialContext.lookup(InitialContext.java:347)
            at
    org.objectstyle.cayenne.conf.JNDIDataSourceFactory.getDataSource(JNDIDataSourceFactory.java:104)

    I'm already using FileConfiguration to set up Cayenne in my standalone
    application, and I suppose I could specify an alternate JDBC DataSource in
    an alternate Cayenne.xml file, but what I'd really like to do is define some
    JNDI datasources external to my standalone application just like they're
    defined externally to the web application. Ideally, they'd share the same
    definitions with Oracle Application Server, but I suspect that's probably
    asking too much.

    So...

    Is there any way to do this? Or is the cdeploy ant task the only choice?

    Another possibility I'm considering is writing a flat-file DataSourceFactory
    that parses Oracle's xml data files to read the JNDI datasource setup info.

    -Mike



    This archive was generated by hypermail 2.0.0 : Fri Jul 23 2004 - 14:47:04 EDT