gpt4 book ai didi

grails - 如何使用Grails WebXmlConfig插件将属性添加到WEB.XML文件?

转载 作者:行者123 更新时间:2023-12-02 14:25:19 26 4
gpt4 key购买 nike

我正在使用Grails的WebXmlConfig Plugin。我使用插件的1.4.1版本。我做了:

grails create-web-xml-config

生成grails-app / conf / WebXmlConfig.groovy文件。当我尝试添加一个简单的属性,如:
sessionConfig.sessionTimeout = 30

我收到以下错误:
 java.lang.IllegalArgumentException: <session-config> element is limited to 1 occurrence
at org.apache.catalina.startup.SetSessionConfig.begin(WebRuleSet.java:769)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1890)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1259)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

当我执行grails install-templates并从生成的web.xml文件中删除 session 超时后,它就可以工作了。如何在不修改原始web.xml的情况下配置WebXmlConfig.groovy?

最佳答案

为什么不使用grails安装模板并修改默认的web.xml文件作为解决方法?

关于grails - 如何使用Grails WebXmlConfig插件将属性添加到WEB.XML文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16878782/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com