私は以下のように春のXMLファイルにClass-Path属性を使用し、プロパティは、アプリケーションでファイルをサーバが見えない。この場合クラスパス
<bean class="com.fritolay.suppliernet.common.lastresorthandler.impl.SingletonPropertiesRepository">
<property name="propertiesFile" value="classpath:ecr/sample.properties" />
</bean>
?
私の質問は、2つのモジュール[1.Web Project 2.Java Project]があることです。あなたは二つの異なるプロジェクトを持っている場合は
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'propertiesFile' threw exception; nested exception is java.io.FileNotFoundException: class path resource [ecr/sample.properties] cannot be resolved to absolute file path because it does not reside in the file system: zip:C:/Oracle/Middleware/user_projects/domains/sample/servers/AdminServer/tmp/_WL_user/_appsdir_supplier-net_ear/6e86rt/sample-service.jar!/ecr/sample.properties
'ecr'パッケージのプロパティファイルはありますか? Bean自体がクラスパスリソースを処理していますか? –
はいプロパティファイルはecrパッケージにあります。Beanクラスの中のその処理リソースファイルは以下のとおりです。 public void setPropertiesFile(resource propertiesFile)throws IOException { this.repository.setPropertiesFiles(Collections.singletonMap( DEFAULT_KEY、propertiesFile)); } – Ran
/WEB-INF/classesディレクトリに展開されているプロパティファイル、またはクラスがパックされているJARファイル(存在する場合)の中に配置されているプロパティファイルを確認しましたか? –