This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Datasource config

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use the Datasource config in the struts-config.xml file and I am having some issues.
[struts-config.xml Datasource]

[Test Action for Connection]

And here is the lovely error I am recieving

I thought that since I told it to use DBCP that it wouldn't try and use Stut's Datasource class. And yes, I have the DBCP jar file in my WEB-INF/lib folder.
Anyone know what is going on?
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, this isn't the answer you are looking for, but I feel compelled to offer my unsolicited opinion anyway. That test action... in production, it is uber-bad practice to be doing database stuff ("database stuff", that's the technical term) in your Action. *YECH* *GAG* I can honestly say that I've never used the datasource element as my webapp has never had to have access to it. Now my business objects... that's a different story. I know, I know, it's only a test. I just had to get that off my chest though as that test action just made me go into a frenzy and start breaking things in a violent rage. *Hulk Smash Puny Action Class!!!*
I now return you to your regularly scheduled topic.
 
Praveen Teegala
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check if struts-legacy.jar is in you lib, along with other sturts jars.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jason Menard:
Ok, this isn't the answer you are looking for, but I feel compelled to offer my unsolicited opinion anyway. That test action... in production, it is uber-bad practice to be doing database stuff ("database stuff", that's the technical term) in your Action. *YECH* *GAG* I can honestly say that I've never used the datasource element as my webapp has never had to have access to it. Now my business objects... that's a different story. I know, I know, it's only a test. I just had to get that off my chest though as that test action just made me go into a frenzy and start breaking things in a violent rage. *Hulk Smash Puny Action Class!!!*
I now return you to your regularly scheduled topic.

I know, I know. In fact, I have even dropped the use of the Struts defined datasource. The Struts docs even say you shouldn't use it. So I am using a Tomcat defined datasource that works via JNDI lookup just like any other webapp I have worked on.
Thanks for you amusing opinion though.
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gregg Bolinger:
Thanks for you amusing opinion though.

That's what I'm here for.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic