Results 1 to 3 of 3

Thread: Ignoring missing Jndi DataSource within IDE?

  1. #1
    Join Date
    Oct 2004
    Posts
    5

    Default Ignoring missing Jndi DataSource within IDE?

    Hi all,

    I have been running unit tests through my JBuilder IDE using a DBCP datasource defined in the Spring config. At deployment time, I need the application to use a datasource bound to JNDI. My problem is that when I add the bean definition for the JNDI datasource to the Spring config, I can't run my unit tests since Spring seems to expect the datasource to be in JNDI even though it is not needed at the time.

    Is there a way around this, preferrably asking Spring to ignore the fact that the Jndi datasource is not present? I will have a similar issue when moving from the EJB layer to the Web layer, as I would prefer to use the DBCP datasource there as well.

    If it is not possible for Spring to ignore the missing datasource, is there a better setup I might use?

    Thanks for any suggestions.

  2. #2
    Join Date
    Aug 2004
    Location
    Amsterdam, Netherlands
    Posts
    450

    Default

    I suggest you start using different context files for the two different environments. I usually put all environment-dependant beans in separate context files. And load the one for the unit tests in my tests and the one with the Jndi datasource when on the server. Name them both the same, place them in a different directory and in your and build, depending on what environment you're building for, use one or the other.

    Hope this helps.

    Alef Arendsen
    Alef Arendsen
    SpringSource
    http://www.springsource.com

  3. #3
    Join Date
    Oct 2004
    Posts
    5

    Default

    Thanks Alef. I did not notice the constructor to the context taking an array of files. That seems to be the answer I need. Thanks again.

Similar Threads

  1. Replies: 13
    Last Post: Feb 5th, 2010, 12:31 AM
  2. JBoss DataSource not found
    By moacsjr in forum Data
    Replies: 10
    Last Post: Aug 25th, 2005, 01:26 PM
  3. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  4. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM
  5. Replies: 1
    Last Post: Feb 12th, 2005, 07:30 AM

Posting Permissions

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