I\'ve got a problem running a batch job on my server, whereas it runs fine from Eclipse on my development workstation.
I\'ve got my Spring environment set up using R
The cause of problem is -Djava.endorsed.dirs=$PROJECTHOME/target/lib
org.springframework.beans.factory.support.DefaultListableBeanFactory
contains the following code:
static {
ClassLoader cl = DefaultListableBeanFactory.class.getClassLoader();
try {
javaxInjectProviderClass = cl.loadClass("javax.inject.Provider"); //Line 103
}
catch (ClassNotFoundException ex) {
// JSR-330 API not available - Provider interface simply not supported then.
}
}
It causes a NullPointerException
, because getClassLoader()
returns null
when class is loaded via -Djava.endorsed.dirs
. From javadoc:
Some implementations may use null to represent the bootstrap class loader.
So, use -classpath
(with explicit specification of all jars) instead of -Djava.endorsed.dirs