As far as I know, there's no easy way to control the order of jar files in the server/xxx/lib directory or even the WEB-INF/lib directory of a webapp.
For webapps, you can place your overridden classes in WEB-INF/classes, as WEB-INF/classes must come before any jars in WEB-INF/lib in the classpath according to the servlet spec.
If you want to override classes that are in JBoss' server/xxx/lib/*.jar, you can try this. Create folder server/xxx/classes. Modify server/xxx/conf/jboss-service.xml. Add a line before
<classpath codebase="lib" archives"*"/>like this
<classpath codebase="classes"/> <classpath codebase="lib" archives"*"/>. I haven't tried this myself so I'm not sure if this would work. In particular, I'm not sure if JBoss obeys the ordering of classpath elements in jboss-service.xml.