我有一个在eclipse中运行得很好的程序,但是当作为jar导出时,spring初始化失败了,因为它声称找不到
file:/C:/BLM/UMC_CLI/umc_cli.jar!/mydir/umc.properties
我尝试了在app-config.xml中使用和不使用前导斜杠。没什么区别。如我所说,它在震动之前在eclipse中工作,当我将测试代码放入时,我可以通过系统类加载器找到umc.properties。我可以看到它在jar中…和app-config.xml在同一个目录中。
确切消息:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'localPropertyFile' defined in class path resource [mydir/app-config.xml]: Cannot resolve reference to bean 'sysProperties' while setting bean property 'properties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysProperties' defined in class path resource [mydir/app-config.xml]: Cannot resolve reference to bean 'DatabaseConfiguration' while setting bean property 'targetObject'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DatabaseConfiguration' defined in class path resource [mydir/app-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'java.io.File' for property 'propertyFile'; nested exception is java.lang.IllegalArgumentException: Could not retrieve file for class path resource [mydir/umc.properties]: class path resource [mydir/umc.properties] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/C:/BLM/UMC_CLI/umc_cli.jar!/mydir/umc.properties
java命令行:
java -Dcom.sun.jndi.ldap.object.disableEndpointIdentification=true -Djava.ext.dirs=.;.\umc_cli_lib\ -jar umc_cli.jar
暂无答案!
目前还没有任何答案,快来回答吧!