• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Error in configuring JDBC Datasource

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Springsource Tool Suite 2.5.1 and tc server 2.1. I am trying to configure a data source to PostgresSql. I followed the steps outlined in Apache JDBC Set-up.

1. I tried to add data source resource in $CATALINA_BASE/conf/Catalina/localhost/<myappcontextfilename>.xml file similar to the one below. Unfortunately, Springtool suite keeps overwriting this file and the <Resource name...> definition given is lost. Springsuite overwrites it with <Context docBase.... source=..../>


2. Then I attempted to define it as a global resource though the Apache link warns that it some time does not work. The definition is given below.


3. Then I add the resource reference in web.xml as below.


4. But when the spring tc server comes up, it gives the below error


5. Finally I configured the data source using Data Source Explorer. I set-up with the same parameters as given above in <GlobalNamingResources>. When I click on Test Connection, I get Ping Successful message. When I expand the 'jdbc/postgres' connection in Data Source Explorer, I am able to see myapp database.

6. But when I use the below code snippet to obtain data source, I still get the error.


I get the below error.



Please Help! I have been struggling with this for almost 3 days . Thanks in advance for all your help.

 
jayapra ramsar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to debug using the below code. To obtain list of all context, I used the below code. Please review and help



But I get the below error.

 
Saloon Keeper
Posts: 28482
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You do not need the "GlobalNamingResources", just the context definition for the connection pool.

Make sure that your postgresql driver jar is placed in the TOMCAT_HOME/lib directory. Do not place it in the WAR.

I don't guarantee you don't have other things that need adjustments, but these 2 items should help a lot.
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic