This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action servlet not found

 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you see any exception log messages on the server console or the log file? If yes, post the exception stacktrace.
 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic