How to control the order of files returned from OS in Java / JBoss classloading?
Issue
- We have two identical Red Hat Enterprise Linux (RHEL) Linux systems and we deployed the same apps on both servers. But when the jar files were uploaded to the lib directory, the sequence or orders are inconsistent, leading to classloading issues.
- Is there a way to control the order of class files returned by OS / RHEL?
- Is there a setting in a filesystem that when files are written, they are ordered by their names or even by timestamp?
-
From the
lsoutput below, the files are not ordered identically in same directory when using the same version of RHEL.-
From host1:
$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.1 (Maipo) $ uname -a Linux host1 3.10.0-327.13.1.el7.ppc64le #1 SMP Mon Feb 29 13:22:06 EST 2016 ppc64le ppc64le ppc64le GNU/Linux $ pwd /path/to/MyApp.ear/MyWeb.war/WEB-INF/lib $ ls -U | grep spring spring-asm-3.0.4.RELEASE.jar spring-beans-3.0.4.RELEASE.jar aet-spring-2.0.2.jar spring-expression-3.0.4.RELEASE.jar spring-context-3.0.4.RELEASE.jar spring-core-3.0.4.RELEASE.jar spring-context-support-3.0.4.RELEASE.jar spring-aop-3.0.4.RELEASE.jar -
From host2:
$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.1 (Maipo) $ uname -a Linux host2 3.10.0-327.13.1.el7.ppc64le #1 SMP Mon Feb 29 13:22:06 EST 2016 ppc64le ppc64le ppc64le GNU/Linux $ pwd /path/to/MyApp.ear/MyWeb.war/WEB-INF/lib $ ls -U | grep spring spring-context-support-3.0.4.RELEASE.jar spring-core-3.0.4.RELEASE.jar spring-asm-3.0.4.RELEASE.jar spring-context-3.0.4.RELEASE.jar spring-aop-3.0.4.RELEASE.jar spring-beans-3.0.4.RELEASE.jar aet-spring-2.0.2.jar spring-expression-3.0.4.RELEASE.jar
-
Environment
- Red Hat Enterprise Linux (RHEL)
- Red Hat JBoss Enterprise Application Platform (EAP)
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
