I have tried DeploymentException & Class Not Found on WebLogic Admin Server 11g among other examples, but I have not been able to get Spring to read external properties file.
I have this code, which read a properties file. Putting the file (PROPERTIES_FILES) in src/main/resources, the app i deployed fine. Moving it to an external folder in the file system, it failes to deploy.
I tried http://www.mkyong.com/java/how-to-print-out-the-current-project-classpath/ to pribt the classpaths and get:
/C:/Oracle/Middleware/patch_wls1034/profiles/default/sys_manifest_classpath/weblogic_patch.jar
/C:/Oracle/Middleware/patch_oepe1040/profiles/default/sys_manifest_classpath/weblogic_patch.jar /C:/Oracle/Middleware/patch_ocp360/profiles/default/sys_manifest_classpath/weblogic_patch.jar
/C:/Oracle/Middleware/jdk160_21/lib/tools.jar
/C:/Oracle/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar
/C:/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar
/C:/Oracle/Middleware/modules/features/weblogic.server.modules_10.3.4.0.jar
/C:/Oracle/Middleware/wlserver_10.3/server/lib/webservices.jar
/C:/Oracle/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar
/C:/Oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar
/C:/Oracle/Middleware/wlserver_10.3/common/derby/lib/derbyclient.jar
/C:/Oracle/Middleware/wlserver_10.3/server/lib/xqrl.jar
Trying to read test.properties
Found false
Could not find properties file: test.properties
My implementation looks like this:
ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader)cl).getURLs();
for(URL url: urls){
logger.debug(url.getFile());
}
logger.debug("Trying to read {}", PROPERTIES_FILES);
Resource resource = new ClassPathResource(PROPERTIES_FILES);
logger.debug("Found {}", resource.exists());
try {
props = PropertiesLoaderUtils.loadProperties(resource);
} catch (IOException e) {
logger.error("Could not find properties file: " + PROPERTIES_FILES, e);
}
I have the same problem to move another properties file from in servlet-dispatcher:
<context:property-placeholder location="classpath*:test.properties"/>
But I guess it’s the same problem.
I am on Windows.
Can anybody help me?
Did a full system restart and it worked.