TOM to BOSS #JAX-RS
I was comfortable with Tomcat because it was so simple and understandable and configurations were so easy, then moved on to JBoss, It was having some major features; along with those, come complex configurations and customizations, but if you understand them well then you will know that why JBoss is called as Application Server and Tomcat is in category of WebServer
I tried to deploy one of my functional Jersey Rest web service implementation on JBoss, but unfortunately the deployment failed.
I was surprised at first, because the services were working well on Tomcat. So was wandering that what went wrong with the JBoss. I searched and went through some articles over the internet and gathered some sequential steps to get my work done. While following the solutions , i came across few new errors/exceptions, so here goes the list and their solutions:
Only One JAX-RS application allowed
When my war file failed to deploy in JBoss, I ran an enquiry on logs and came across this line in the Server log, “Only One JAX-RS application allowed”. Its ambiguous message. It seems like it depicts that only one war file with JAX-RS application can be deployed, but this can become a major flaw of JBoss if it is unable to run multiple JAX-RS applications.
But the real issue was something else. The issue was the REST-EASY implementation already provided by JBoss. I was creating the Rest Services using jersey and hence deploying them on JBoss, but JBoss was already shipped with REST-EASY packages. So I need to tell JBoss by some way that use jersey and ignore the REST-EASY implementation. So for doing that, I added following lines in my web.xml file .
<context-param> <param-name>resteasy.scan</param-name> <param-value>false</param-value> </context-param> <context-param> <param-name>resteasy.scan.providers</param-name> <param-value>false</param-value> </context-param> <context-param> <param-name>resteasy.scan.resources</param-name> <param-value>false</param-value> </context-param>
By adding so, JBoss was atleast understanding that which implementation is needed now, but a new issue was awaiting.
java : Unsupported major.minor version 52.0
Now what?, I said to myself. One gone another came. But in an instant I asked myself, is there any difference between the JRE of client machine and the machine on which the webservices were compiled. And there was the resolution of this issue as well. I was compiling the services in JDK 1.8 and deploying them on a system having java 1.6. I recompiled my services and deployed them, and the error was gone. But this was not the end yet.
Package Scanning is not possible
As I progressed, I came across another issue in server log. There was no way the server is going to package scan my Java packages to know that which service classes I have implemented. In other words,for everything to work as expected We have to annotate our classes with some special annotations to let servlet container know that which are web service implementation classes. I had already done that. But this new issue came up along with a suggestion in the logs. The suggestion was to manually implement an application class by myself and register the Resource classes in it rather then depending on annotations. So I added something like following into my existing package.
and the error was gone.
Issue with the Filters
As explained in the above issue that I had to register my rest resources(classes) in application class itself, In similar way I registered my filters there and added them in the existing set. However the filters were not getting executed even after doing so. Hence I removed the filter from application class and mentioned them in web.xml of my project. Magically they started executing.
No more..........
After getting these issues and resolving them one by one,my half a day was spent but I was able to get them working and deliver the build on time. The more exciting thing about this chain of issues was that; this was my first rest deployment project and was an immediate requirement by the client. So, I was happy that I managed to get that in time and so I am sharing the my experience, so that if any of you may come across these will be able to solve them.
Thanks for reading...












