wood burning stoves 2.0*
The moose likes Struts and the fly likes Error:cannot find getDataSource(req) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error:cannot find getDataSource(req)" Watch "Error:cannot find getDataSource(req)" New topic
Author

Error:cannot find getDataSource(req)

amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
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
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
kapil patel
Ranch Hand

Joined: Sep 30, 2005
Posts: 33
If I am using tomcat server, how I can define datasource in tomcat.

thanks,
kapil patel
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The process is different for versions 4 and 5. Assuming you're using version 5, here is the link.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Error:cannot find getDataSource(req)