Java 由于 cookie-config,Weblogic 中的 web.xml 验证会引发错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18536503/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
web.xml validation in Weblogic throws error because of cookie-config
提问by user6123723
I have the follwing web.xml for an application.
我有一个应用程序的以下 web.xml。
<?xml version="1.0"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>..</display-name>
<description>..</description>
<session-config>
<cookie-config>
<name>SESSIONDEBUG_JSESSIONID</name>
</cookie-config>
</session-config>
</web-app>
I get the following error upon deployment
部署时出现以下错误
Caused By: weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND
problem: cvc-complex-type.2.4a: Expected element 'session-timeout@http://java.sun.com/xml/ns/javaee' instead of 'cookie- config@http://java.sun.com/xml/ns/javaee' here in element session- config@http://java.sun.com/xml/ns/javaee:<null>
Not sure I fully understand the error. I see that it wants me to declare session-timeout in there. I'll give that a try..
不确定我是否完全理解错误。我看到它希望我在那里声明会话超时。我试试看。。
采纳答案by BalusC
The <cookie-config>
is introducedin Servlet 3.0and not supported in older versions such as 2.5. Your web.xml
is declared conform Servlet 2.5.
在<cookie-config>
被介绍在的Servlet 3.0和老版本如2.5不支持。您web.xml
已声明符合 Servlet 2.5。
You've 2 options:
您有 2 个选择:
Redeclare
web.xml
conform Servlet 3.0 (which implicitly also requires a Servlet 3.0 compatible target container such as Tomcat 7, Glassfish 3, WebLogic 12, etc).If you can't upgrade, then forget it and solve it using a custom servlet filter or container-specific configuration (e.g. a
Valve
in Tomcat/JBoss; can't answer off top of head for WebLogic as I've never really used it, consider asking a new question for that part).
Redeclare
web.xml
符合 Servlet 3.0(这也隐含地要求兼容 Servlet 3.0 的目标容器,例如 Tomcat 7、Glassfish 3、WebLogic 12 等)。如果你不能升级,那就忘记它并使用自定义 servlet 过滤器或特定
Valve
于容器的配置来解决它(例如Tomcat/JBoss 中的一个;无法直接回答 WebLogic,因为我从未真正使用过它,考虑为该部分提出一个新问题)。