2012-02-04 29 views
1

私はJavaアプリケーションを作成しています。 Spring MVC、Spring Security、Hibernate、Tilesを使用しています。私は私のプロジェクトでmavenを使用しています。トンの助けを、私はこの例外を得続ける。java - 設定ファイルをどこに置くか

0 [main] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started 
281 [main] INFO org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Sat Feb 04 03:15:50 IST 2012]; root of context hierarchy 
625 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [resources/security-app-context.xml] 
640 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed 
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [resources/security-app-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [resources/security-app-context.xml] cannot be opened because it does not exist 
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341) 
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) 
    at ........... 
    .............. 

は、私はどこでも私のセキュリティアプリ-のcontext.xmlを入れてみましたが、それはdoesnの:私は私のWebアプリケーションを実行するたびに、私は例外を取得します。ここで

は私のPOMファイルである:ここで

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 

    <modelVersion>4.0.0</modelVersion> 

    <groupId>success.green-wheels</groupId> 
    <artifactId>green-wheels-project</artifactId> 
    <version>1</version> 
    <packaging>war</packaging> 

    <name>web-app-module</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
     <org.springframework.version>3.1.0.RELEASE</org.springframework.version> 
     <org.apache.tiles.version>2.2.2</org.apache.tiles.version> 
     <org.hibernate.version>3.3.2.GA</org.hibernate.version> 
    </properties> 
    <dependencies> 
     ...Some dependencies to Spring, Hibernate and so 
    </dependencies> 

    <build> 
     <finalName>${artifactId}</finalName> 
     <sourceDirectory>src</sourceDirectory> 
     <resources> 
      <resource> 
       <directory>src/success/greenWheels/dataAccess/hibernate/resources</directory> 
      </resource> 
     </resources> 
     <plugins> 
       <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.2</version> 
       <configuration> 
        <webResources> 
        <resource> 
         <directory>web</directory> 
        </resource> 
        </webResources> 
       </configuration> 
       </plugin> 
     </plugins> 
    </build> 
</project> 

は私のディレクトリ構造です: enter image description here

間違っていますか?それを動作させるためにsecurity-app-context.xmlをどこに置くべきですか?

すべての設定ファイルを1つのフォルダに入れたいと思います。どうしたらいいですか?

答えて

0
INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [resources/security-app-context.xml] 

この例外はどのようにして取得しましたか? resourcesフォルダはどこですか?私はそれを見ません...

春の設定で<import resource="resources/security-app-context.xml" />を使用しましたか?はいの場合は、<import resource="security-app-context.xml" />を使用する必要があります。

SpringSource Tool Suite Maven project structure

は、私は私のMavenプロジェクトは、このような構造を有しているIntelliJ IDEAわからないんだけど、SpringSource Tool Suiteに(またはEclipse、関係ありません)

1

/resourcesディレクトリはWEB-INF/classesにするとCLASSPATHになります。

関連する問題