2017-09-10 27 views
0

私は、春の起動時にGradleを使用してApache Tilesを持つサンプルアプリケーションを作成しようとしています。実行時にエラーが発生するようになりました。春の起動時にGradleが動作しないApache Tiles

2017-08-29 22:58:08 [http-nio-8080-exec-3] TRACE o.s.w.s.h.BeanNameUrlHandlerMapping - No handler mapping found for [/WEB-INF/view/layout/main.jsp] 
2017-08-29 22:58:08 [http-nio-8080-exec-3] TRACE o.s.web.servlet.DispatcherServlet - Testing handler map [[email protected]5f84d53b] in DispatcherServlet with name 'dispatcherServlet' 
2017-08-29 22:58:08 [http-nio-8080-exec-3] DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - Matching patterns for request [/WEB-INF/view/layout/main.jsp] are [/**] 
2017-08-29 22:58:08 [http-nio-8080-exec-3] DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - URI Template variables for request [/WEB-INF/view/layout/main.jsp] are {} 
2017-08-29 22:58:08 [http-nio-8080-exec-3] DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - Mapping [/WEB-INF/view/layout/main.jsp] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[[email protected]abf713]]] and 1 interceptor 
2017-08-29 22:58:08 [http-nio-8080-exec-3] TRACE o.s.web.servlet.DispatcherServlet - Testing handler adapter [org.springframework[email protected]5c48030d] 
2017-08-29 22:58:08 [http-nio-8080-exec-3] TRACE o.s.web.servlet.DispatcherServlet - Testing handler adapter [org.springframework.web.servlet.mvc.HttpRequestHandlerAdapt[email protected]] 
2017-08-29 22:58:08 [http-nio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - Last-Modified value for [/WEB-INF/view/layout/main.jsp] is: -1 
2017-08-29 22:58:08 [http-nio-8080-exec-3] TRACE o.s.w.s.r.ResourceHttpRequestHandler - Applying "invalid path" checks to path: WEB-INF/view/layout/main.jsp 
2017-08-29 22:58:08 [http-nio-8080-exec-3] TRACE o.s.w.s.r.ResourceHttpRequestHandler - Path contains "WEB-INF" or "META-INF". 
2017-08-29 22:58:08 [http-nio-8080-exec-3] TRACE o.s.w.s.r.ResourceHttpRequestHandler - Ignoring invalid resource path [WEB-INF/view/layout/main.jsp] 
2017-08-29 22:58:08 [http-nio-8080-exec-3] TRACE o.s.w.s.r.ResourceHttpRequestHandler - No matching resource found - returning 404 
2017-08-29 22:58:08 [http-nio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling 
2017-08-29 22:58:08 [http-nio-8080-exec-3] TRACE o.s.web.servlet.DispatcherServlet - Cleared thread-bound request context: [email protected] 
2017-08-29 22:58:08 [http-nio-8080-exec-3] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request 

gradleプロジェクトをmavenに置き換えてもうまくいきました。私はgradle & mavenビルドスクリプトの両方を作成しました。サンプルプロジェクトはthisにあります。私は問題がgradleの提供スコープであると思う。

build.gradleファイル、何とか

// Apply the java-library plugin to add support for Java Library 
apply plugin: 'java' 
apply plugin: 'war' 
apply plugin: 'eclipse' 


configurations { 
    provided 
} 



// In this section you declare where to find the dependencies of your project 
repositories { 
    // Use jcenter for resolving your dependencies. 
    // You can declare any Maven/Ivy/file repository here. 
    mavenCentral() 
} 

dependencies { 
    // This dependency is exported to consumers, that is to say found on their compile classpath. 

    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.5.2.RELEASE' 
    compile group: 'org.apache.tiles', name: 'tiles-jsp', version: '3.0.7' 
    provided group: 'javax.servlet', name: 'jstl', version: '1.2' 
    //compile group: 'org.apache.tiles', name: 'tiles-jsp', version: '3.0.7' 
    provided 'org.springframework.boot:spring-boot-starter-tomcat:1.5.2.RELEASE' 
    provided 'org.apache.tomcat.embed:tomcat-embed-jasper' 



} 

sourceSets { 
    main.compileClasspath += configurations.provided 
    //test.compileClasspath += configurations.provided 
    //test.runtimeClasspath += configurations.provided 
} 

eclipse.classpath.plusConfigurations += [configurations.provided] 

取り組んで動作しないのpom.xml

<?xml version="1.0" encoding="UTF-8"?> 
<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.5.2.RELEASE</version> 
    </parent> 

    <version>1.0</version> 
    <packaging>war</packaging> 

    <name>spring-boot-web-mvc</name> 
    <description> 
     Configure spring boot starter project for Web MVC as a WAR file, still self executing. 
    </description> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <start-class>com.mvmlabs.springboot.Application</start-class> 
     <java.version>1.7</java.version> 
     <main.basedir>${basedir}/../..</main.basedir> 
     <m2eclipse.wtp.contextRoot>/</m2eclipse.wtp.contextRoot> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>jstl</artifactId> 
     </dependency> 

     <!-- Added to allow configuration as a web MVC, built as a WAR file (still 
      executable) --> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-tomcat</artifactId> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.tomcat.embed</groupId> 
      <artifactId>tomcat-embed-jasper</artifactId> 
      <scope>provided</scope> 
     </dependency> 

     <!-- Add Apache Tiles into the mix --> 
     <dependency> 
      <groupId>org.apache.tiles</groupId> 
      <artifactId>tiles-jsp</artifactId> 
      <version>3.0.4</version> 
     </dependency> 


     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-test</artifactId> 
      <scope>test</scope> 
     </dependency> 

    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </build> 

    <groupId>idp</groupId> 
    <artifactId>com.proginators.idp</artifactId> 
</project> 

すべてのヘルプや示唆が高く評価されています。

答えて

0

私はgradleプロジェクトで作業している間、同じ問題がありました。

ただ、次の依存関係に

providedRuntime 'org.apache.tomcat.embed:Tomcatの-埋め込む-碧玉' を追加

2017年11月29日11:44:08.302 INFO 5760 --- [NIOを-8081-exec-1] oaccC [Tomcat]。[localhost]。[/]:Spring FrameworkServlet 'dispatcherServlet'の初期化 2017-11-29 11:44:08.302 INFO 5760 --- [nio-8081-exec-1] ] osweb.servlet.DispatcherServlet:FrameworkServlet 'dispatcherServlet':初期化が開始されました 2017-11-29 11:44:08.323 INFO 5760 --- [nio-8081-exec-1] osweb.servlet.DispatcherServlet:FrameworkServlet 'dispatcherServlet ':21msで初期化完了 2017-11-29 11:47:52.678 WARN 5760 --- [nio-8081-exec-1] osweb.servlet.PageNotFound:URI [/ WEB-INF/jsp/layout/「dispatcherServlet」という名前のDispatcherServletの「basic.jsp」

関連する問題