Spring Petclinic is a very good demo application to experiment with - it is simple enough, yet demonstrates quite a good number of features. Usually I deploy it to Tomcat and obviously don't have any issues with it - it just deploys, runs, and works as expected.
Recently, however, for demonstration purposes, I needed to deploy this application to JBoss (or WildFly). And this is not as straightforward as one might expect.
First I tried with JBossAS 7.1.1.Final. The deployment fails with the following exception:
11:42:38,247 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/petclinic]] (MSC service thread 1-3) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/business-config.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568) [spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540) [spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE]
...
The latest Petclinic application (as of October 2014) uses JPA 2.1 and JBoss 7.1.1 bundles JPA 2.0 APIs. So I decided that it should probably work out of the box on WildFly since it comes with JPA 2.1 jars. And it did - the application deployed just fine, but then there's another library that prevents the application from operating properly -
Dandelion:
Exception starting filter dandelionFilter: com.github.dandelion.core.DandelionException: The protocol vfs is not supported.
at com.github.dandelion.core.utils.ResourceScanner.scanForResourcePaths(ResourceScanner.java:204) [classes:]
at com.github.dandelion.core.utils.ResourceScanner.findResourcePaths(ResourceScanner.java:138) [classes:]
at com.github.dandelion.core.bundle.loader.spi.AbstractBundleLoader.loadBundles(AbstractBundleLoader.java:89) [dandelion-core-0.10.0.jar:]
The issue was
reported but at the time of writing this post the
fix wasn't published yet.
So hopefully Dandelion v0.11.0 will be capable to be deployed on WildFly.
So to overcome this and deploy Spring Petclinic (at the state of October 2014) to WildFly 8.1 one would have to get rid of the dependency on Dandelion, and rewrite some of the JSPs not to use Dandelion taglibs. Then the application deploys and works just fine.
So after making all the fixes I got Spring Petclinic running deployed to WildFly and could monitor it with
XRebel: