请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

6-4 校验工具-BeanValidator开发 报错

老师请教个问题,在6-4中按照你的代码敲的,启动debug后输入以下命令报错,不知道应该从什么地方下手,麻烦指导一下,谢谢。

另外,提个建议,感觉课程敲了太多代码才会有验证,这样报错不太好找,最好敲一小部分验证一下。

输入命令curl http://localhost:8080/permission_war_exploded/test/validate.json,报错如下:
09-Dec-2019 11:34:29.630 警告 [http-nio-8080-exec-2]

org.springframework.web.context.support.XmlWebApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0’: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException
09-Dec-2019 11:34:29.631 严重 [http-nio-8080-exec-2] org.springframework.web.servlet.DispatcherServlet.initServletBean Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0’: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:628)atorg.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:628)atorg.apache.tomcat.util.threads.TaskThreadWrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException
at org.hibernate.validator.internal.engine.ConfigurationImpl.
(ConfigurationImpl.java:129)
at org.hibernate.validator.internal.engine.ConfigurationImpl.(ConfigurationImpl.java:96)
at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:31)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationException
at
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)

>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0': Invocation of init m
ethod failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationException

正在回答 回答被采纳积分+3

1回答

Jimin 2019-12-09 23:28:15

你好,你看一下你的pom.xml里的依赖是否正确,看报错是依赖有问题,可能是某些包被重复引用了。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信