linux - How can symlink affect loading persistence.xml -


in project there're 2 different persistence.xml appearing in 2 different jar files after building. if run application using command this

/jre/v1.7.0_21/bin/java -cp patch:/path_to_app_jars/*:. org.somepath.mainclass 

one of them loaded if run using symlink 1 peaked up

bin/ -> path_to_app_jars /jre/v1.7.0_21/bin/java -cp patch:/bin/*:. org.somepath.mainclass 

and result consistent regardless of else change. how be?

my guess expanded jars returned in different order when using symlink, , loading persistence.xml first jar listed.

as described in java documentation, order in jar files returned when using directory wildcard (*) unpredictable. in order have same jar loaded first, solution list jars explicitly in classpath instead of using directory wildcard:

the order in jar files in directory enumerated in expanded class path not specified , may vary platform platform , moment moment on same machine. well-constructed application should not depend upon particular order. if specific order required jar files can enumerated explicitly in class path.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -