Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
492 views
in Technique[技术] by (71.8m points)

java - web.xml validation in Weblogic throws error because of cookie-config

I have the follwing web.xml for an application.

<?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..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The <cookie-config> is introduced in Servlet 3.0 and not supported in older versions such as 2.5. Your web.xml is declared conform Servlet 2.5.

You've 2 options:

  1. 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).

  2. 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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...