验证期间Struts2超时

时间:2015-09-28 13:55:29

标签: java struts2 timeout struts-validation

当我尝试验证登录表单时,我收到了一个TimeOut错误,但这是第一次。你能告诉我我做错了吗?

我的[...] - validation.xml:

<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" 
                            "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
<validators>
     <field name="identifiant">
         <field-validator type="requiredstring">
              <message>Veuillez saisir votre identifiant</message>
         </field-validator>
    </field>
    <field name="motDePasse">
         <field-validator type="requiredstring">
              <message>Veuillez saisir votre mot de passe</message>
         </field-validator>
    </field>
</validators>

stackTrace:

[com.opensymphony.xwork2.validator.AnnotationActionValidatorManager]
**Caught exception while loading file com/myApp/action/LoginAction-validation.xml
    Connection timed out** - [unknown location]
            at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:119)
            at com.opensymphony.xwork2.validator.DefaultValidatorFileParser.parseActionValidatorConfigs(DefaultValidatorFileParser.java:82)
            at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:394)
            [...]
    Caused by: java.net.ConnectException: Connection timed out
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            {...]

1 个答案:

答案 0 :(得分:2)

服务器无法访问Internet。因此必须在本地复制和引用DTD。

感谢Roman C.的线索。