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 Action servlet not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action servlet not found" Watch "Action servlet not found" New topic
Author

Action servlet not found

amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
When my struts-cnfig is this it gives error
action servlet not found
<struts-config>
<form-beans>

<form-bean name="submitForm"
type="SubmitForm"/>

</form-beans>
<action-mappings>
<action path="/login" type="com.javapro.struts.LoginAction"/>
<action path="/logout" type="com.javapro.struts.LogoutAction"/>
<action path="/viewSecret" type="com.javapro.struts.ViewSecretAction"/>
<action path="/temp"
type="SubmitAction"
name="submitForm"
input="/submit.jsp"
scope="session">
<forward name="success" path="/temp1.jsp"/>
<forward name="failure" path="/temp.jsp"/>
</action>
</action-mappings>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>
but when i remove <plug-in></plugin-in>
it works fine
What wrong with the setting
Thanks
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10290
    
168

Do you see any exception log messages on the server console or the log file? If yes, post the exception stacktrace.


[My Blog] [JavaRanch Journal]
amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
I get this error in my log file when i restart my tomcat ./dhar is my context
- Parse Error at line 27 column 67: Element type "plug-in" must be declared.
org.xml.sax.SAXParseException: Element type "plug-in" must be declared.
.........................
- Parse Error at line 32 column 17: The content of element type "struts-config" must match "(data-sources?,form-beans?,global-forwards?,action-mappings?)".
org.xml.sax.SAXParseException: The content of element type "struts-config" must match "(data-sources?,form-beans?,global-forwards?,action-mappings?)".
....................
- Loading validation rules file from '/WEB-INF/validator-rules.xml'
- Skipping validation rules file from '/WEB-INF/validator-rules.xml'. No stream could be opened.
javax.servlet.ServletException: Skipping validation rules file from '/WEB-INF/validator-rules.xml'. No stream could be opened.
...........................
- Marking servlet action as unavailable
- Servlet /dhar threw load() exception
javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'
....................
AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@1a28362)
LogAbandoned: false
RemoveAbandoned: true
RemoveAbandonedTimeout: 300
- Unable to find config file. Creating new servlet engine config file: /WEB-INF/server-config.wsdd
- org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Here is the most significant message:

javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'


This is telling you that Struts can't find /WEB-INF/validator-rules.xml or /WEB-INF/validation.xml. My guess is you didn't include these files in your WAR file. If you're going to configure the Struts validator, you must have correctly configured xml files to go with it. If aren't using the Struts validator, take out the <plug-in> tag for the validator.
[ July 31, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
This is my struts-config file is there is any error in it
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">

<struts-config>
<form-beans>

<form-bean name="submitForm"
type="SubmitForm"/>

</form-beans>
<action-mappings>
<action path="/login" type="com.javapro.struts.LoginAction"/>
<action path="/logout" type="com.javapro.struts.LogoutAction"/>
<action path="/viewSecret" type="com.javapro.struts.ViewSecretAction"/>
<action path="/temp"
type="SubmitAction"
name="submitForm"
input="/submit.jsp"
scope="session">
<forward name="success" path="/temp1.jsp"/>
<forward name="failure" path="/temp.jsp"/>
</action>
</action-mappings>

</struts-config>

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Didn't you say in your first post that it works fine if you remove the <plug-in> tag? Now that you've removed that tag, is it still not working?

In answer to your question, I do see one possible problem with your struts-config.xml file. In your submitForm form bean definition, you list "SubmitForm" as the type. This should be a fully qualified class name including the package. If SubmitForm is in the default package, that's a mistake also. In web applications, classes should always be in a package other than the default package.
[ August 01, 2006: Message edited by: Merrill Higginson ]
amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
When i remove plugin it works fine .
Can anyone please tell me what i have to do from scratch to use struts validator.I downloaded struts 1.2 what files i need to copy to web-inf folder
what is the settings in web.xml ,struts-config.xml .Can anyone please suggest
any useful link
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action servlet not found