如何在Wildfly 9中启用JSP的即时编译? [英] How do I enable on-the-fly compilation of JSPs in Wildfly 9?
问题描述
我正在使用Wildfly 9.0.0.CR2.如何启用JSP的即时编译?我在另一个线程中找到了此配置
I’m using Wildfly 9.0.0.CR2. How do I enable on-the-fly compilation of JSPs? I found this configuration in another thread
<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">
<configuration>
<jsp-configuration development="true" check-interval="1" modification-test-interval="1" recompile-on-fail="true"/>
</configuration>
</subsystem>
但是可惜,它不起作用,当我重新启动JBoss服务器时会导致杜松子酒出现以下异常……
but alas, it doesn’t work, result in gin the below exception when I restart my JBoss server …
14:23:05,224 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:131)
at org.jboss.as.server.ServerService.boot(ServerService.java:350)
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:271)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[442,2]
Message: Unexpected element '{urn:jboss:domain:web:1.4}subsystem'
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:108)
at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69)
at org.jboss.as.server.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:1199)
at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_4(StandaloneXml.java:457)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:144)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:106)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123)
... 3 more
推荐答案
这是XML解析问题,此错误消息javax.xml.stream.XMLStreamException: ParseError
显而易见.此特定行Unexpected element{urn:jboss:domain:web:1.4}subsystem
的解析失败.
This is a XML parsing issue as evident by this error message javax.xml.stream.XMLStreamException: ParseError
. The parsing failed for this particular line Unexpected element{urn:jboss:domain:web:1.4}subsystem
.
您可以查看XML模式文档以找出这些类型的XML解析问题.模式位于WildFly的docs文件夹下.
You can look at the XML schema documents to figure out these types of XML parsing issues. The schemas are located under the docs folder of WildFly.
通过这种方式,您应该使用WildFly-9.0.1.Final
构建版本,因为这是最新发行的候选版本.
By the way you should use WildFly-9.0.1.Final
build version as that is the latest release candidate build.
您很可能需要对下拖子系统进行更改.我更新了以下示例:
You will most likely need to make the changes to the undertow subsystem. I have updated an example below:
<subsystem xmlns="urn:jboss:domain:undertow:2.0">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config development="true" check-interval="1" modification-test-interval="1" recompile-on-fail="true"/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/9"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
</filters>
</subsystem>
我强烈建议您使用CLI进行此类更改:
I highly recommend using CLI to make such changes:
/subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=development,value=true)
/subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=recompile-on-fail,value=true)
/subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=check-interval,value=1)
/subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=modification-test-interval,value=1)
这样,您可以避免这些XML解析错误,而不必查找确切的XML模式.
This way you can avoid these XML parsing errors without having to find the exact XML schemas.
这篇关于如何在Wildfly 9中启用JSP的即时编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!