book fight by Qunar!
time for booking flight is 200 seconds
booking flight succeeded!
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/ResolvableTypeProvider
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.tmy.aopdemo.App.smartBossGoSomewhere(App.java:25)
at com.tmy.aopdemo.App.main(App.java:16)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.ResolvableTypeProvider
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 14 more
Spring JDBC has a DataSource initializer feature. Spring Boot enables it by default and loads SQL from the standard locations schema.sql and data.sql (in the root of the classpath).
book fight by Qunar!
time for booking flight is 200 seconds
booking flight succeeded!
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/ResolvableTypeProvider
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.tmy.aopdemo.App.smartBossGoSomewhere(App.java:25)
at com.tmy.aopdemo.App.main(App.java:16)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.ResolvableTypeProvider
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 14 more
book fight by Qunar!
time for booking flight is 200 seconds
booking flight succeeded!
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/ResolvableTypeProvider
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.tmy.aopdemo.App.smartBossGoSomewhere(App.java:25)
at com.tmy.aopdemo.App.main(App.java:16)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.ResolvableTypeProvider
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 14 more
报错信息:
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/ResolvableTypeProvider
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.lc.App.smartApplicationgowhere(App.java:22)
at com.lc.App.main(App.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.ResolvableTypeProvider
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 19 more
需要更完整的异常信息,以代码的格式贴上来。
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/ResolvableTypeProvider
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor': Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
@bryant519 “javax.servlet.ServletException: Circular view path [login]: would dispatch back to the current handler URL [/login] again”错误的原因在这个地方,也就是试图渲染设置的不太对。
package com.example.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Created by Administrator on 2016/4/8 0008.
*/
@Controller
public class HelloController {
@RequestMapping("/index")
public String hello(){
return "login";
}
}
@David 对了,浏览器输入地址后,控制台报错信息是:javax.servlet.ServletException: Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
登录发表评论 登录 注册
为什么实战任务都打不开欸
我敲这个为什么没有显示错误?
最后少了@ResponseBody注解
可是依赖注入之后,调用的时候并没有说调用了谁的服务?
你应该是一直在一个项目中做的吧,
maven中去掉spring-boot-starter-web
试了一下,App类上至少要加入
注解,
否则报错
谢谢你的分析!
加上@ResponseBody表示返回JSON字符串,线不是不了页面肯定不是这个原因。
class AppController 里面是少了@ResponseBody吗 ?为什么我一直进不到localhost:8080/posts/create呢?
再试试
"你可以阅读 这篇经验“打不开,报错”Cannot GET /tutorial/maven-basic
没碰到这种情况,把错误信息Google一下吧,看看StackOverflow上有没有类似的情况。
我是在Apache上下载的最新的Maven3.3.9版本,windows版本和liunx版本都下载过。
我说下我现在的所有操作:
1、通过Apaches上下载3.3.9版本Maven
2、配置好了环境变量JDK7 和mavan,通过DOS窗口或者shell 执行mvn -v/ mvn help:system 都能成功
3、本身下载的Myeclipse2014版本,第一步在maven下面重新设置了maven的地址为下载的mavan项目,user_settings上也是设置为了自己定义的地址
4、新建maven项目(webApp)成功,配置阿里云的代理,项目能下载所有包,也能通过发布tomcat8发布,成功访问。
5、同时也在JAVA安装JDK的地方设置了-Dmaven....=$M2_HOME,但是在使用run-as这里每次运行都报错说M2_HOME这个问题,windows和liunx下都是这个问题,我在网上看到很多配置都很简单,但是我安装上述配置下来都不行,不知道是我操作错了还是哪里有问题
重新安装下Maven插件?
用的是自带的maven还是自己安装的,配置成自己安装的Maven路径了吗?
右键执行run as 执行maven install始终提示
-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.
但是我的环境在DOS命令能执行的,环境变量也是正常,很奇怪
JAVA JDK下面也配置
-Dmaven.multiModuleProjectDirectory=$M2_HOME
环境变量下面就是这个名称
为什么课程任务打开页面是404啊?
as
多了行【HttpSession session = request.getSession();】
通过鼠标新建文件夹或者在命令行操作都可以
windows在哪创建src/main/java/hello目录结构
如果网络有问题Maven下载依赖会有问题,导致不能正常编译,这是刚用Maven的人经常碰到的一个问题,。
用来解释的例子非常好!
出错信息是?
mvn compile 失败了怎么办
Thymeleaf模板默认放在templates目录下,JSP模板需要配置
templates
是Spring Boot的默认约定目录,如果你没有显式地指定其他目录作为模板目录,那么Spring Boot自动在这个目录下搜寻模板。如果想显式指定其他文件夹,以Thymeleaf模板引擎为例,可以修改配置属性
spring.thymeleaf.prefix
。其他的模板引擎也有相应的配置,请查阅文档。必须放在目录templates下吗?约定好了的?
试了一下,好像要加上这两个标注:
直接创建
AnnotationConfigApplicationContext
应该不需要。@Toder
IOC场景中class APP需要加入以下annotation
这个场景才可以运行吧?
在自己.m2文件夹内删除掉parent相关的文件,然后重新执行下载一下试试。
进入parent POM之后是这样的
劳烦您解答
已解决,十分感谢
把1.2.3改成1.4.0试试
1. 表单对应于后台的一个Bean
2. 使用Model中的
post
对象渲染或者获取表单数据Spring JDBC has a DataSource initializer feature. Spring Boot enables it by default and loads SQL from the standard locations schema.sql and data.sql (in the root of the classpath).
将SQL语句放在schema.sql中之后应该如何去执行
bean-backed表单是什么意思
th:object="{post}"
这有什么用啊
说得对!修改过来了~
按照代码
<mainClass>hello.HelloWorld</mainClass>
应该修改成
<mainClass>com.tianmaying.mavendemo.HelloWorld</mainClass>
最终生成jar才能执行。
哦哦,好的,不然不太方便!
(找遍整个页面也没发现收藏按钮)
以前应该做过课程的收藏功能,后来干掉了,最近加上
怎么没有收藏按钮
可能是Spring的版本冲突
这样算正常吗
谢谢!我找到原因了,是因为我一直用的一个项目,前面在配置xml中加了
这样导致我更改spring-context版本为4.2时,maven中依旧为我之前试过的4.15,这个
我查了下是spring4.2之后才有的,所以4.15不行,谢谢了!
是的,我是用的idea,maven是自带的,有可能是版本问题。
@maktub 是用maven管理项目吗? spring的版本是否正确?可能是版本冲突导致。
需要更完整的异常信息,以代码的格式贴上来。
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/ResolvableTypeProvider
请问怎么解决?
@chn126943 就是本身这套课程啊
抱歉我没表达清楚。我想问的是:整个这套课程,看起来是基于一个博客开发的教学项目,那这个教学项目对应的是咱们哪一套课程里的呢?
讲的是如何为博客编辑输入框替换为Makrdown编辑器。
这篇课程是基于其它课程的基础吧?Spring boot那个么?
那看看更基础的课程吧
@michaelxie3
完全看不懂。
写的挺简要的,天码营的课程貌似都是这个风格,不过给的路径还是很不错,要配合Google和其它资料。
这些教程需要一定的javaWeb基础啊 新手不推荐看
这个课程不错!
参考代码没有了
刚刚在项目下面加上
之后就可以成功运行了,但是不太明白具体原因 @Ricky
这是右边的错误信息,至于代码是和教程完全一样
项目编译版本1.8,运行版本1.8,maven版本和系统jdk版本是3.3和1.8 @Ricky
以及你的代码是否可以放在github上?我们一起看看
异常信息右边还有一段文字,可以贴出来看看嘛?
@Ricky 第一次用这个组件,求解决
玩了一下午,这个就是跑不起,还是建议把源码也给出
目光如炬啊!
最后那里应该是google吧?
很不错
什么不好使?
不好使
test
@iHelin 你的截图右边是不是还有一些日志?现在这一部分看不出问题,最后把右边的也提供一下
运行不起来
已修改,谢谢!@杜琪-NKU
最后一段是笔误吧:web开发的目的,便是实现上述过程中Google服务器所做的事情。
谢谢勘误,太感谢了!
@最王座
@David @Ricky
配置java开发环境的地方就出错了。
1. 在变量和值中分别输入JAVA_HOME、C:\Program Files\Java\jsk1.8.0,应该改为:C:\Program Files\Java\jdk1.8.0
2. 在系统变量中找到【Path】,双击进行编辑,在值的最后加入:
;%JAVA_HOME%\lib,应该为:;%JAVA_HOME%\bin
注意修改吧。
@wojiangkai05 你是怎么运行应用的?直接运行main函数吗?
装了maven的话,试试
mvn spring-boot:run
大。
我的运行代码是这样的 和我运行代码有关么,我用你们第一课给的MAVEN包可以运行,但是输入id没有用,用这个模板就没法编译
@Ricky
@wojiangkai05 用spring boot的话,默认把classpath上的templates目录作为模板的位置,你检查一下src/main/resources文件夹下有没有templates这个文件夹
Caused by: java.lang.IllegalStateException: Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
用了那个Thymeleaf 模板编译的时候就会出现这个问题,希望大大解答一下
@David
@Ricky 感谢大大,问题解决了,确实是模板引擎没有设置正确,现在好了,感谢!!
@bryant519 这个错误异常有几个信息:
1. Circular view path [login],也就是你的view路径是login没错
2. would dispatch back to the current handler URL [/login] again,这个意思是:login这个view会被重定向到/login对应的Controller,而这个Controller里又会把重新返回"login"视图
问题可能:
1. 模板引擎的设置可能不正确,没有正确的设置thymeleaf模板引擎,导致Spring使用了默认行为(把login试图forward给/login继续处理,造成循环”
2. 按你的描述,你并没有定义"/login"这个url以及对应的controller,那么是不是你之前定义过?修改后没有重新build或者是因为缓存的原因导致/login对应的controller类没有删干净,不妨试试gradle clean build一下整个项目再用gradle bootRun运行
@Ricky 我用的thymeleaf
@bryant519 “javax.servlet.ServletException: Circular view path [login]: would dispatch back to the current handler URL [/login] again”错误的原因在这个地方,也就是试图渲染设置的不太对。
你现在用的是哪一种模板引擎?可以把pom.xml或者build.gradle里的依赖贴出来看看
@Ricky 没有 我是希望让localhost:8080/index 这个路径上显示我的login.html页面,/login路径为什么也需要Controller呢
@bryant519
/login
路径有对应的Controller吗?@Ricky 好的
@bryant519 能把你的Controller(路由)代码贴出来看一看吗?
@David 对了,浏览器输入地址后,控制台报错信息是:javax.servlet.ServletException: Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
@David 也配置了路由的,其他页面查询数据库信息都是正常的,就是不能返回这个login.html
你在controller里面配置路由了吗? @bryant519
@David 自己写了一个login.html文件放在了templates文件夹下,也引入了模板引擎,可是打开浏览器显示的却是Whitelabel Eror Page
@David 嗯 那样也挺好
改过来了,谢谢!
你说我们是不是可以出一个针对特定一节的讨论区? 可以针对某一节课程来评论? 求建议
@moonsun523
Test Scope 在测试的时候使用,在编译和测试的时候都需要。
谢谢提醒,稍微改了一下描述。
@moonsun523
第4小节 选择【file】->【import】,找到【Git】->【Projects from Git】,
第2小节的定义依赖部分是不是有个地方有误?
provided是编译和测试
test只是测试
谢谢关注,我们会考虑加上,并且把源码开源出来。不过可能得等一段时间,暂时没时间搞这一块。
@dellch
很好的教程!
请问一共是26课么?
最后能不能讲解一个小型实例呢?例如注册、登录、用户信息、发表话题、回复话题等等的
谢谢~~
@Ricky
@panxchina 免费课程我们没有在天码营上提供Git仓库。可以自己在本地新建一个Git仓库练习Git操作,参考http://course.tianmaying.com/git-basics
【初学提问】
3.Eclipse使用
导入Git项目
选择【file】->【import】,找到【Maven】->【Projects from Git】,点击【next】,选择从本地目录或者直接通过天码营提供的课程代码仓库地址来导入Git项目。
课程代码仓库地址是什么哦?
太棒了!!!
课程近期会大幅更新,更有料,更有趣!
@wangqikecy 参考http://tianmaying.com/qa/205
简单来说——Spring MVC可以自己单独使用,部署到应用服务器中。但是Spring Boot开发Web应用则必须依赖于Spring MVC
@Ricky 想问一下spring boot与spring mvc之间的关系,可以同时使用么
@喆喆 Spring现在已经演化成为了一个Full-Stack框架(类似Rails和Django),能够完整的支持Web应用的开发。如果你想要深入学习Spring,那么可以先了解Spring框架中依赖注入的相关知识。Spring Web模块能够基本满足Web应用开发的大部分要求。
另外自己搭建基于Spring框架的Web应用可能是非常复杂的,Spring Boot项目正是为了解决这一问题而生,使用Spring Boot只用十几行Java代码就可以搭建一个Hello World的Web应用,强烈推荐使用它。
当然说到Web开发,前端(HTML/CSS/JavaScript)的知识也是必不可少的。可以参考我们天码营的前端入门公开课,和Harttle学习如何优雅的开发前端页面。
以上基本就是Web应用的知识点,本课程中都会详细的讲解(可以参考课程目录)以及基于这些知识点的实训项目,欢迎加入~
现在的WEB开发 一个Spring框架可以满足吗? 刚接触WEB不久 老师指点一下 还有那些知识是需要涉猎的? 细节的和大方向上的.