Ozark is the reference implementation of MVC 1.0 (JSR 371) and will be part of Java EE 8. This post is not about MVC features. It contains a few tips on how to try out Ozark on WildFly 10. The problem is Ozark currently depends on Jersey JAX-RS implementation. And so if you want to test it on a EE container other than GlassFish4 (and possibly others which bundle Jersey) you'll run into troubles. The good news is it's quite easy to add some additional configuration and run your MVC experiments on WildFly 10. Three additional steps are required:
- Bundle some Jersey artifacts
- Exclude JAX-RS subsystem (powered by RESTEasy)
- Suppress implicit bean archives without beans.xml - WildFly must ignore bundled hk2 libraries using JSR-330 @Inject
1. Bundle Jersey artifacts
We will need to add:
org.glassfish.jersey.containers:jersey-container-servlet
org.glassfish.jersey.ext.cdi:jersey-cdi1x
org.glassfish.jersey.ext:jersey-bean-validation
(and also excludehibernate-validator
for this dependency)
See also the wildfly profile in https://github.com/mkouba/todo-mvc/blob/wildfly/pom.xml#L117.
2. Exclude JAX-RS subsystem
Let's exclude the jaxrs subsystem by means of jboss-deployment-structure.xml
descriptor:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"> <deployment> <exclude-subsystems> <subsystem name="jaxrs" /> </exclude-subsystems> </deployment> </jboss-deployment-structure>
3. Suppress implicit bean archives without beans.xml
You could either supress implicit bean archives globally or per-deployment with jboss-all.xml
descriptor in WEB-INF:
<jboss xmlns="urn:jboss:1.0"> <weld xmlns="urn:jboss:weld:1.0" require-bean-descriptor="true"/> </jboss>
After this setup the MVC application should start working. Note that it's no proper integration but a simple workaround to allow you to test MVC RI on WildFly 10.