File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Datasources Problem-Servlet action is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Datasources Problem-Servlet action is not available" Watch "Datasources Problem-Servlet action is not available" New topic
Author

Datasources Problem-Servlet action is not available

khurram kureshi
Greenhorn

Joined: Dec 28, 2005
Posts: 4
hi,
i'm new to struts and have been facing a problem for quite some time now have gone through almost every listing regarding this problem on this forum and others and still my problem isnt solved.

HTTP Status 404 - Servlet action is not available this is the proble

"type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available."

following is the entry in my web.xml:

<!-- Standard Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

<init-param>
<param-name>mapping</param-name>
<param-value>org.apache.struts.action.RequestActionMapping</param-value>
</init-param>

<init-param>
<param-name>config/admin</param-name>
<param-value>/WEB-INF/admin/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>


<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern> <!-- *.do /do/*-->
</servlet-mapping>

the following is the entry in the struts-config.xml:

<data-sources>
<data-source type="org.apache.tomcat.dbcp.BasicDataSource">
<set-property
property="driverClassName"
value="com.mysql.jdbc.Driver" />
<set-property
property="url"
value="jdbc:mysql://localhost:3306/refinery" />
<set-property
property="username"
value="root" />
<set-property
property="password"
value="root" />
<set-property
property="maxActive"
value="10" />
<set-property
property="maxWait"
value="5000" />
<set-property
property="defaultAutoCommit"
value="false" />
<set-property
property="defaultReadOnly"
value="false" />
<set-property
property="key"
value="refineryDS" />
</data-source>
</data-sources>

when i comment the datasources entry in the struts-config.xml the application starts but if i enable the datasources entry above i get the mentioned error!

<global-forwards>
<forward name="welcome" path="/welcome.do"/>
<forward name="home" path="/welcome.do"/>
</global-forwards>

<action-mappings>
<action
path="/welcome"
type="org.apache.struts.actions.ForwardAction"
parameter="/WEB-INF/user/home.jsp"/>
</action-mappings>

so plz help me out becoz i cant seem to tackle this error! remember if i comment out the datasources entry the app starts but i need it because i have to connect to the db to make a option list. thnx for ure time....... and yes the entry in the log file is like this:

2005-12-28 20:01:20 StandardWrapperValve[action]: Servlet action is currently unavailable


thats abt it sorry for the long post but i've tried everything and i want u guys to look at it and teme wots wrong. thnx in advance!

p.s- follwoing r the files:

In Re-finery\Sources\Site\WEB-INF\ the following files r present:
struts-bean.tld, struts-html.tld, struts-logic.tld, struts-nested.tld, struts-template.tld, struts-tiles.tld, copy of struts config.xml, struts-config.xml, tiles-defs.xml, validation.xml, validator-rules.xml, web.xml

In Re-finery\Sources\Site\WEB-INF\lib\ the following files r present:
commons-beanutils.jar, commons-collections.jar, commons-dbcp.jar, commons-digester.jar, commons-fileupload.jar, commons-lang.jar, commons-logging.jar, commons-logging-api.jar, commons-pool.jar, commons-resources.jar, commons-validator.jar, mysql-connector-java-3.0.8-s...jar,struts.jar, quartz.jar

and ive made sure that all other files r in thr respective folders, i've made another app that doesnt use struts to check that it connects to the db and it does! so.......?

p.p.s- i have the following code too in my web.xml:

<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/refineryDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

???

[ December 28, 2005: Message edited by: khurram kureshi ]

[ December 28, 2005: Message edited by: khurram kureshi ]

[ December 28, 2005: Message edited by: khurram kureshi ]
[ December 28, 2005: Message edited by: khurram kureshi ]
Rob Morning
Greenhorn

Joined: Jan 02, 2006
Posts: 4
I think your data source element is wrong ..

<data-source type="org.apache.tomcat.dbcp.BasicDataSource">

should be

<data-source type="org.apache.commons.dbcp.BasicDataSource">
khurram kureshi
Greenhorn

Joined: Dec 28, 2005
Posts: 4
thnx the application has started to run since i made the change but i still am stuck at something:

<jsp:useBean id="auctionviewbean" class="com.cst.auction.beans.ViewHelperBean"/>

<logic:iterate id="gender" name="auctionviewbean" property="genders" type="com.cst.auction.dataobjects.Gender" >

<html ption value="<%= SQLUtil.checkNull(gender.getGender()) %>"><%= SQLUtil.checkNull(gender.getGender()) %></html ption >

<html ption value="<%= gender.getGender() %>"><%= gender.getGender() %></html ption >

</logic:iterate>

the application stops at the above mentioned logice:iterate tag,
i have all the files and supposedly thr paths r correct too since i am trying to run this application only i dont have access to the beans and the class files as in i dont have access to the code but i can seee the directory structure and everything seems to be in place.....the error lof file has no entries! so what could be wrong with the logic iterate tag in this code? thnx for ure help and hope to hear from u soon.
Rob Morning
Greenhorn

Joined: Jan 02, 2006
Posts: 4
<jsp:useBean id="auctionviewbean" class="com.cst.auction.beans.ViewHelperBean"/>

<logic:iterate id="gender" name="auctionviewbean" property="genders" type="com.cst.auction.dataobjects.Gender" >

<html ption value="<%= SQLUtil.checkNull(gender.getGender()) %>"><%= SQLUtil.checkNull(gender.getGender()) %></html ption >

<html ption value="<%= gender.getGender() %>"><%= gender.getGender() %></html ption >

</logic:iterate>

Hi again,

I looked thru you JSP .. Is it complete ? The <html ption/> tag is ONLY valid when nested in an <html:select/> tag. Are you just posting an extract of your JSP ? If you are can you post the enclosing <html:select/> so i can see better what may be happening.
Jigs Shah
Greenhorn

Joined: Mar 08, 2006
Posts: 3
I am a bit confused. I guess you guys have deployed the app on Tomcat.
I am trying to deploy the app on WebSphere and this is what my Data source looks as of now ...

<data-sources>
<data-source type="org.apache.tomcat.dbcp.BasicDataSource">
<set-property
property="driverClassName"
value="org.gjt.mm.mysql.Driver" />
<set-property
property="url"
value="jdbc:mysql://localhost:3306/dev" />
<set-property
property="username"
value="dev" />
<set-property
property="password"
value="dev" />
<set-property
property="defaultAutoCommit"
value="false" />
<set-property
property="defaultReadOnly"
value="false" />
<set-property
property="key"
value="refineryDS" />
</data-source>
</data-sources>

I am not sure what the "type" attribute should be and what the key attribute should be. Also does Struts to JNDI lookups for the datasources regd in struts-config.xml ?

Thanks

Jigs
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'd suggest setting up the data source through the WebSphere Admin Console, rather than through struts.

Here is a link that explains how to do it for MYSQL.


Merrill
Consultant, Sima Solutions
swarupa sss
Greenhorn

Joined: Nov 27, 2009
Posts: 1
hi people,,

jus check if necessary jars are added ..

check for
commons-dbcp-1.2.2.jar
commons-pool-1.4.jar
mysql-connector-java-5.1.6.bin.jar

bye
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9307
    
  17

Hi Swarupa, welcome to javaranch.

Please check your private messages for some administrative matter.

Please Dont Wake The Zombies, this thread is 3 years old, the person won't be looking for a answer this long...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Datasources Problem-Servlet action is not available