Spring项目无法启动:未导入Jwt依赖

时间:2019-09-11 11:52:13

标签: spring maven jwt classloader

我正在一个小组项目中工作,在我的本地分支上工作之后(一切都很好),我试图获取该项目的最新版本并将其与我的本地分支合并。该项目编译正常,但是启动时:我有

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authRestService': Unsatisfied dependency expressed through field 'contextService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextServiceImpl': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [fr.project.ui.components.services.core.ContextUiServiceImpl] from ClassLoader [ParallelWebappClassLoader
  context: ROOT
delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@12843fce
]
2019-09-11 13:22:07.688 [NS5] [] [DESKTOP-6JB7LEQ] [ERROR] o.s.web.context.ContextLoader.initWebApplicationContext:312 -
                [:] [] [/] - Context initialization failed

>     Caused by: java.lang.IllegalStateException: Failed to introspect Class [fr.project.ui.components.services.core.ContextServiceImpl] from
> ClassLoader [ParallelWebappClassLoader   context: ROOT   delegate:
> false
>     ----------> Parent Classloader: java.net.URLClassLoader@12843fce ]    at
> org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:507)
>   at
> org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:404)
>   at
> org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:389)
>   at
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:248)
>   ... 72 common frames omitted Caused by:
> java.lang.NoClassDefFoundError: com/auth0/jwt/algorithms/Algorithm    at
> java.lang.Class.getDeclaredMethods0(Native Method)    at
> java.lang.Class.privateGetDeclaredMethods(Class.java:2701)    at
> java.lang.Class.getDeclaredMethods(Class.java:1975)   at
> org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489)
>   ... 75 common frames omitted Caused by:
> java.lang.ClassNotFoundException: com.auth0.jwt.algorithms.Algorithm
>   at
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
>   at
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1136)
>   ... 79 common frames omitted

我像其他所有依赖项一样,在项目的pom.xml上添加了auth0-jwt版本3.3.0。 PS:我尝试删除.m2 repostiroy文件夹的依赖项,清除缓存reimoprt .. 似乎没有任何作用。

我的问题是:该错误是否真的表示缺少jwt依赖关系,或者是由于上下文问题而无法创建bean的项目本身

当我删除所有依赖项并重新导入jwt:时,它们以jar而不是librarie的形式添加到外部库中

如图所示 enter image description here

谢谢

0 个答案:

没有答案