I have a web application deployed to jboss eap 7.0 on linux.
Within my java code I am using javax.json.JsonValue.asJsonArray method.
When I run locally on tomcat all runs fine.
Once I deploy to Jboss I get a nosuchmethod error on asJsonArray method. within my WEB-INF\lib folder I have the necessary json jar with that method javax.json-1.1.4.jar. I have discovered that under modules within Jboss it has its own version of javax.json \jboss-eap-7.0\modules\system\layers\base\org\glassfish\javax\json\main\javax.json-1.0.3.redhat-1.jar.
It is my speculation that when I run my application it is first looking at jar within the Jboss modules directory rather than the jar within the WEB-INF\lib folder in the war file. How do I direct the application to reference the jar within the WEB-INF\lib and not the jar withing the jboss modules?
You can exclude the JBoss provided dependency using jboss-deployment-structure.xml file which you need to place under the WEB-INF directory of your war. You have to specify the exclusion dependencies something like below.
e.g.
<module name="javax.json.api"/>