Results 1 to 2 of 2

Thread: JNDI from Spring Batch issue

  1. #1
    Join Date
    Nov 2009
    Posts
    6

    Default Can Spring Batch access external JNDI?

    Hi!

    All of our applications run in Tomcat (tcServer) and use JNDI datasources.

    We want to reuse some of our business logic for a batch job.

    I would like to use Spring Batch, but how does Spring Batch get a JNDI resource when it doesn't run inside Tomcat? There is no JNDI server on the box that runs our batch jobs.

    If I install Tomcat on our box, can a batch job running OUTSIDE of Tomcat access the JNDI datasource factory running INSIDE Tomcat?

    Thanks!

    Robert
    Last edited by trulore; Nov 8th, 2012 at 04:53 PM.

  2. #2
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    351

    Default

    This really isn't a batch question as it is just a question about setting up your data sources. To utilize the JNDI registry inside tomcat from your batch jobs (and not have the batch jobs run within the container), you'll have to configure your jobs to use tomcat as the JNDI provider.

    I have to ask, why is the business logic coupled to the use of JNDI datasources? Can't you just package that up separately (as a jar) and import it into your batch projects?
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •