【发布时间】:2016-11-19 20:05:52
【问题描述】:
我正在尝试将spring-boot 与gradle 构建系统和jetty 一起使用。现在jsp没有渲染,我得到这个错误消息
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sun Jul 17 00:31:05 CEST 2016
There was an unexpected error (type=Internal Server Error, status=500).
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/jasper/runtime/JspSourceImports
它似乎依赖于 build.gradle 文件。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE"
classpath 'org.springframework:springloaded:1.2.5.RELEASE'
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'rebel'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.zeroturnaround', name: 'gradle-jrebel-plugin', version: '1.1.3'
}
}
jar {
baseName = 'gs-spring-boot'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
// tag::jetty[]
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
// end::jetty[]
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("javax.servlet:javax.servlet-api")
compile('org.eclipse.jetty:jetty-webapp')
compile('org.eclipse.jetty:jetty-jsp')
runtime 'javax.servlet:javax.servlet-api'
runtime 'javax.servlet:jstl'
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("junit:junit")
}
// change default IntelliJ output directory for compiling classes
idea {
module {
inheritOutputDirs = false
outputDir = file("$buildDir/classes/main/")
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
如果我使用 maven,那么如果我从命令行使用 mvn jetty:run 启动它,我可以渲染 jsp
<?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>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-samples</artifactId>
<version>1.4.0.BUILD-SNAPSHOT</version>
</parent>
<artifactId>spring-boot-sample-jetty-jsp</artifactId>
<packaging>war</packaging>
<name>Spring Boot Jetty JSP Sample</name>
<description>Spring Boot Jetty JSP Sample</description>
<url>http://projects.spring.io/spring-boot/</url>
<organization>
<name>Pivotal Software, Inc.</name>
<url>http://www.spring.io</url>
</organization>
<properties>
<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>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<!--<scope>provided</scope>-->
</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>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
</build>
</project>
为什么还要将构建系统与运行时混合在一起,为什么我必须手动组合一个码头服务器来运行一些 jsp 和 servlet?我不明白为什么 Java 项目必须使简单的事情变得不可能。以前用jsp和servlet很容易,现在想用jsp,几天就遇到2个问题。
这种类型的任务甚至没有一个使用 gradle 的工作示例吗?你知道我想要做什么吗?
用 Jetty 查看 JSP 应该是最基本的事情,为什么我要用 Java 服务器来实现其他东西呢?没有人将 Jetty 仅用于静态内容或仅用于 RestAPI - Jetty 的主要功能是查看 JSP,那么为什么让简单的任务变得不可能呢?
我也用python做web开发,用python这种类型的问题是不可理解的——查看模板就可以了,即使我们尝试了也无法解决这种类型的问题。现在,Java 浪费了我整个周末的时间,因为指令错误或没有指令、错误的构建文件和不完整的项目。我希望我留在 C、汇编和 python。至少我们可以在那里调试东西并且我们有替代方案。每次我尝试用 Java 做一些事情时,我们都会遇到这个问题,一堆令人困惑的堆栈跟踪,你必须链接到最模糊的 4 GB jar 和 xml 地狱。我将回到汇编编程,在那里可以知道你在做什么,而且你不需要 4 GB 的 XML 来运行一个只会造成混乱的服务器。
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/jasper/runtime/JspSourceImports
at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1305) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:979) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) ~[javax.servlet-api-3.1.0.jar:3.1.0]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:224) ~[websocket-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:281) ~[spring-boot-actuator-1.3.6.RELEASE.jar:1.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:115) ~[spring-boot-actuator-1.3.6.RELEASE.jar:1.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103) ~[spring-boot-actuator-1.3.6.RELEASE.jar:1.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) [jetty-security-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.Server.handle(Server.java:499) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) [jetty-io-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: java.lang.NoClassDefFoundError: org/apache/jasper/runtime/JspSourceImports
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_91]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_91]
at java.lang.ClassLoader.defineClass(ClassLoader.java:642) ~[na:1.8.0_91]
at org.apache.jasper.servlet.JasperLoader.findClass(JasperLoader.java:232) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:193) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:125) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
at org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:656) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:202) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:595) [jetty-security-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:191) ~[jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:72) ~[jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1246) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1029) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:973) ~[spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]
... 48 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.jasper.runtime.JspSourceImports
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_91]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_91]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_91]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_91]
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:187) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:125) ~[javax.servlet.jsp-2.3.2.jar:2.3.2]
... 92 common frames omitted
我的文件结构是
dac@dac-Latitude-E7450 ~/p/s/s/spring-boot-sample-jetty-jsp> tree
.
├── build
│ ├── classes
│ │ ├── main
│ │ │ ├── application.properties
│ │ │ ├── rebel.xml
│ │ │ └── sample
│ │ │ └── jetty
│ │ │ └── jsp
│ │ │ ├── MyException.class
│ │ │ ├── MyRestResponse.class
│ │ │ ├── SampleJettyJspApplication.class
│ │ │ └── WelcomeController.class
│ │ └── test
│ ├── dependency-cache
│ ├── libs
│ │ ├── gs-spring-boot-0.1.0.jar
│ │ └── gs-spring-boot-0.1.0.jar.original
│ ├── resources
│ │ └── main
│ │ ├── application.properties
│ │ └── rebel.xml
│ └── tmp
│ ├── compileJava
│ │ └── emptySourcePathRef
│ ├── compileTestJava
│ │ └── emptySourcePathRef
│ └── jar
│ └── MANIFEST.MF
├── build.gradle
├── build.log
├── classes
│ └── production
│ └── spring-boot-sample-jetty-jsp
│ ├── application.properties
│ └── rebel.xml
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── pom.xml
├── spring
│ ├── gradle
│ │ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── pom.xml
│ └── src
│ ├── main
│ │ ├── java
│ │ │ └── sample
│ │ │ └── jetty
│ │ │ └── jsp
│ │ │ ├── MyException.java
│ │ │ ├── MyRestResponse.java
│ │ │ ├── SampleJettyJspApplication.java
│ │ │ └── WelcomeController.java
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ └── rebel.xml
│ │ └── webapp
│ │ └── WEB-INF
│ │ └── jsp
│ │ └── welcome.jsp
│ └── test
│ └── java
│ └── sample
│ └── jetty
│ └── jsp
│ └── SampleWebJspApplicationTests.java
├── spring-boot-sample-jetty-jsp.iml
├── spring-boot-sample-jetty-jsp.ipr
├── spring-boot-sample-jetty-jsp.iws
├── src
│ ├── main
│ │ ├── java
│ │ │ └── sample
│ │ │ └── jetty
│ │ │ └── jsp
│ │ │ ├── MyException.java
│ │ │ ├── MyRestResponse.java
│ │ │ ├── SampleJettyJspApplication.java
│ │ │ └── WelcomeController.java
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ └── rebel.xml
│ │ └── webapp
│ │ └── WEB-INF
│ │ └── jsp
│ │ └── welcome.jsp
│ └── test
│ └── java
│ └── sample
│ └── jetty
│ └── jsp
│ └── SampleWebJspApplicationTests.java
└── target
├── classes
│ ├── application.properties
│ ├── rebel.xml
│ └── sample
│ └── jetty
│ └── jsp
│ ├── MyException.class
│ ├── MyRestResponse.class
│ ├── SampleJettyJspApplication.class
│ └── WelcomeController.class
├── generated-sources
│ └── annotations
├── generated-test-sources
│ └── test-annotations
├── maven-archiver
│ └── pom.properties
├── maven-status
│ └── maven-compiler-plugin
│ ├── compile
│ │ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
│ └── testCompile
│ └── default-testCompile
│ ├── createdFiles.lst
│ └── inputFiles.lst
├── spring-boot-sample-jetty-jsp-1.4.0.BUILD-SNAPSHOT
│ ├── META-INF
│ └── WEB-INF
│ ├── classes
│ │ ├── application.properties
│ │ ├── rebel.xml
│ │ └── sample
│ │ └── jetty
│ │ └── jsp
│ │ ├── MyException.class
│ │ ├── MyRestResponse.class
│ │ ├── SampleJettyJspApplication.class
│ │ └── WelcomeController.class
│ ├── jsp
│ │ └── welcome.jsp
│ └── lib
│ ├── classmate-1.3.1.jar
│ ├── hibernate-validator-5.2.4.Final.jar
│ ├── jackson-annotations-2.8.0.jar
│ ├── jackson-core-2.8.0.jar
│ ├── jackson-databind-2.8.0.jar
│ ├── jboss-logging-3.3.0.Final.jar
│ ├── jcl-over-slf4j-1.7.21.jar
│ ├── jstl-1.2.jar
│ ├── jul-to-slf4j-1.7.21.jar
│ ├── log4j-over-slf4j-1.7.21.jar
│ ├── logback-classic-1.1.7.jar
│ ├── logback-core-1.1.7.jar
│ ├── slf4j-api-1.7.21.jar
│ ├── snakeyaml-1.17.jar
│ ├── spring-aop-4.3.2.BUILD-SNAPSHOT.jar
│ ├── spring-beans-4.3.2.BUILD-SNAPSHOT.jar
│ ├── spring-boot-1.4.0.BUILD-SNAPSHOT.jar
│ ├── spring-boot-autoconfigure-1.4.0.BUILD-SNAPSHOT.jar
│ ├── spring-boot-starter-1.4.0.BUILD-SNAPSHOT.jar
│ ├── spring-boot-starter-logging-1.4.0.BUILD-SNAPSHOT.jar
│ ├── spring-boot-starter-validation-1.4.0.BUILD-SNAPSHOT.jar
│ ├── spring-boot-starter-web-1.4.0.BUILD-SNAPSHOT.jar
│ ├── spring-context-4.3.2.BUILD-SNAPSHOT.jar
│ ├── spring-core-4.3.2.BUILD-SNAPSHOT.jar
│ ├── spring-expression-4.3.2.BUILD-SNAPSHOT.jar
│ ├── spring-web-4.3.2.BUILD-SNAPSHOT.jar
│ ├── spring-webmvc-4.3.2.BUILD-SNAPSHOT.jar
│ └── validation-api-1.1.0.Final.jar
├── spring-boot-sample-jetty-jsp-1.4.0.BUILD-SNAPSHOT.war
├── spring-boot-sample-jetty-jsp-1.4.0.BUILD-SNAPSHOT.war.original
├── surefire-reports
│ ├── sample.jetty.jsp.SampleWebJspApplicationTests.txt
│ └── TEST-sample.jetty.jsp.SampleWebJspApplicationTests.xml
└── test-classes
└── sample
└── jetty
└── jsp
└── SampleWebJspApplicationTests.class
85 directories, 95 files
【问题讨论】:
-
请显示您的项目的结构树。
-
为什么会有一个 pom.xml 文件和一个 build.gradle 文件,为什么在每个文件中配置不同的依赖关系?
-
@AndyWilkinson 我正在尝试将构建系统从 maven 更改为 gradle 以学习 gradle。我应该放弃并改用maven吗?它适用于 maven,我想让它适用于 gradle。我还尝试制作
gradle init来翻译pom.xml,但直接失败了。 -
运行应用的 gradle 命令行是什么?
-
让我们通过使用 Gradle 启动应用程序来使用 spring-boot-gradle-plugin:./gradlew clean bootRun 或(省略 ./),如下所示:gradlew clean bootRun
标签: spring-boot gradle jetty jsp intellij-idea gradle spring-boot jetty