In deploying web services to an old version of JBoss, I ran into a few problems. The web services are developed using the following Maven archetype
org.apache.cxf.archetype / cxf-javaws-javafirst / 2.7.2
The archetype will create a WAR file containing SOAP-based web services. There is a Hello World implementation that will echo back an input message.
Off-the-shelf, this archetype produces two errors when deploying to JBoss 5. Note that the archetype may work without modification on other platforms. For example, the WAR deployed successfully to Tomcat 7 prior to my suggested modifications.
These are the two deployment errors and the resolutions.
1. Bad version of SLF4J.
It seems like there is a conflict with the logging subsystem in JBoss. Although CXF uses Java Logging by default, something in JBoss 5 was causing the CXF code to use SLF4J. When the CXF did this, I got the following error
This was solved by explicitly adding the latest SLF4J as a dependency in Maven. Add this to the pom.xml that was generated by the archetype.
2. Spring beans.xml and CDI
beans.xml is a reserved file in the later versions of Java EE, starting with 6. Although JBoss 5 doesn't implement 6, there appears to be a conflict. (Maybe with Seam or CDI included in JBoss 5.) The CXF archetype I used creates a Spring beans file called "beans.xml". This causes the following error
javax.inject.DefinitionException: Could not find 'import'
JBoss 5 is interpreting the beans.xml file as a CDI file instead of a Spring file. To resolve this, rename the beans.xml to anything and update the web.xml file. For example, rename 'beans.xml' to 'appContext.xml'. See the following from web.xml.
To test the deployment, search the log file for errors, particularly stack traces. You should be able to hit the following URL and call the web service.