6

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>

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
CoolBeans
  • 20,654
  • 10
  • 86
  • 101
Dave A
  • 2,780
  • 9
  • 41
  • 60

3 Answers3

7

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.

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.

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>

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)

This way you can avoid these XML parsing errors without having to find the exact XML schemas.

CoolBeans
  • 20,654
  • 10
  • 86
  • 101
4

Search subsystem and add this on jsp config

<subsystem xmlns="urn:jboss:domain:undertow:1.1"><br>. . . .<br>   <servlet-container name="default" default-buffer-cache="default" stack-trace-on-error="local-only">
   <jsp-config development="true" check-interval="1" modification-test-interval="1" recompile-on-fail="true"/>


Joan Sanchez
  • 331
  • 3
  • 8
1

Make sure you are loading the undertow extension. Otherwise the subsystem configuration can't load. Other than that your syntax is correct.

<extensions>
    <!-- other extensions here -->
    <extension module="org.wildfly.extension.undertow"/>
</extensions>
Tea Curran
  • 2,923
  • 2
  • 18
  • 22
  • I do not see `urn:jboss:domain:web:1.4` xml namespace under schemas for WildFly 9.0.1. So I am not sure how his syntax can be correct. Also `org.wildfly.extension.undertow` extension is loaded by default all out of the box configuration profiles (standalone or domain). – CoolBeans Aug 04 '15 at 13:00
  • It's under docs/schema/jboss-as-web_1_4.xsd it has schemas up to version 2.2, which I believe you can use as well. I tested your jsp configuration on 9.0.1 locally and it works fine for me. – Tea Curran Aug 04 '15 at 15:00
  • I see that now. May be it is tied to the selection of "web-containerType". I guess if you are using undertow, then you make changes in the undertow subsystem. – CoolBeans Aug 04 '15 at 15:35