• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error:cannot find getDataSource(req)

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my action class i get this error
cannot find symbol
symbol : method getDataSource(javax.servlet.http.HttpServletRequest)
My code
How to fix this error
Thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you've upgraded to the latest version of Struts(1.3.5), the getDataSource method has been removed from the Action class. Support for the Struts DataSource utility has also been removed from Version 1.3 of the DTD used by the Struts-config.xml file.

Anyone who follows this forum regularly is probably tired of my continually telling people not to use the Struts DataSource utility. One of the reasons I've been telling people not to use it is that the Struts authors did not guarantee that it would be supported in future versions. Well, guess what? The most recent version doesn't support it.

The best practice for setting up a DataSource in a Struts application or any J2EE application is to define it as a JNDI resource using your application server's interface for defining such resources. In your application code, you then do a JNDI lookup to retrieve the DataSource.
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I am using tomcat server, how I can define datasource in tomcat.

thanks,
kapil patel
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The process is different for versions 4 and 5. Assuming you're using version 5, here is the link.
 
Lookout! Runaway whale! Hide behind this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic