我已经尝试了各种方法来使我的应用程序可以使用此依赖项。这是spring-beans-4.3.2.RELEASE或spring-boot-1.4.0.RELEASE中的错误吗?有办法解决这个问题吗?
以下是显示弹簧版本的堆栈跟踪:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createDocument': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/sun/xml/bind/v2/model/annotation/AnnotationReader
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at
此处有更多细节可以继续发布堆栈跟踪:
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at my.app.Application.main(Application.java:22) [classes/:na]
Caused by: java.lang.NoClassDefFoundError: com/sun/xml/bind/v2/model/annotation/AnnotationReader
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_92]
at java.lang.ClassLoader.defineClass(Unknown Source) ~[na:1.8.0_92]
at java.security.SecureClassLoader.defineClass(Unknown Source) ~[na:1.8.0_92]
at java.net.URLClassLoader.defineClass(Unknown Source) ~[na:1.8.0_92]
at java.net.URLClassLoader.access$100(Unknown Source) ~[na:1.8.0_92]
at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_92]
at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_92]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_92]
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_92]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_92]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_92]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_92]
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_92]
at java.lang.Class.privateGetDeclaredMethods(Unknown Source) ~[na:1.8.0_92]
at java.lang.Class.privateGetMethodRecursive(Unknown Source) ~[na:1.8.0_92]
at java.lang.Class.getMethod0(Unknown Source) ~[na:1.8.0_92]
at java.lang.Class.getMethod(Unknown Source) ~[na:1.8.0_92]
at javax.xml.bind.ContextFinder.newInstance(Unknown Source) ~[na:1.8.0_92]
at javax.xml.bind.ContextFinder.newInstance(Unknown Source) ~[na:1.8.0_92]
at javax.xml.bind.ContextFinder.find(Unknown Source) ~[na:1.8.0_92]
at javax.xml.bind.JAXBContext.newInstance(Unknown Source) ~[na:1.8.0_92]
at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:344) ~[cxf-core-3.1.10.jar:3.1.10]
at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:342) ~[cxf-core-3.1.10.jar:3.1.10]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_92]
at org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:342) ~[cxf-core-3.1.10.jar:3.1.10]
at org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:243) ~[cxf-core-3.1.10.jar:3.1.10]
at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:472) ~[cxf-rt-databinding-jaxb-3.1.10.jar:3.1.10]
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:327) ~[cxf-rt-databinding-jaxb-3.1.10.jar:3.1.10]
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86) ~[cxf-core-3.1.10.jar:3.1.10]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:425) ~[cxf-rt-wsdl-3.1.10.jar:3.1.10]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:527) ~[cxf-rt-wsdl-3.1.10.jar:3.1.10]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:262) ~[cxf-rt-wsdl-3.1.10.jar:3.1.10]
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) ~[cxf-rt-frontend-jaxws-3.1.10.jar:3.1.10]
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102) ~[cxf-rt-frontend-simple-3.1.10.jar:3.1.10]
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168) ~[cxf-rt-frontend-simple-3.1.10.jar:3.1.10]
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) ~[cxf-rt-frontend-jaxws-3.1.10.jar:3.1.10]
at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460) ~[cxf-rt-frontend-jaxws-3.1.10.jar:3.1.10]
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338) ~[cxf-rt-frontend-jaxws-3.1.10.jar:3.1.10]
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255) ~[cxf-rt-frontend-jaxws-3.1.10.jar:3.1.10]
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:543) ~[cxf-rt-frontend-jaxws-3.1.10.jar:3.1.10]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_92]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_92]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_92]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_92]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1706) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1645) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
... 16 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.model.annotation.AnnotationReader
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_92]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_92]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_92]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_92]
... 63 common frames omitted
答案 0 :(得分:0)
检查你的pom.xml并确保你导入了依赖项,例如:
H A B C D
------------------
X 1 10 2 11
Y 2 15 8 14
Z NA 23 NA 16
W 5 67 5 NA
X 4 1 6 2
Y 1 3 2 9
Z 2 NA 9 17
答案 1 :(得分:0)
For those trying to resolve this dependency. I finally found these to help with the versions seen in the above stack trace in the question. You may not need all of them depending on what you are trying to do.
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-jxc</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
<version>2.24</version>
</dependency>