gpt4 book ai didi

Tomcat 似乎没有在我的 WEB-INF/lib 文件夹中提取 jar

转载 作者:行者123 更新时间:2023-11-28 23:52:57 25 4
gpt4 key购买 nike

我有一个 maven pom,它将我所有需要的库构建到我的 WEB-INF/lib 文件夹中,然后将其打包为一个 war。当我尝试部署这场 war 时,Tomcat 抛出了许多 ClassNotFoundExceptions - 最新的一个是“java.lang.ClassNotFoundException:javax.xml.bind.annotation.AccessorOrder”;我发现修复它的唯一方法是从我的 WEB-INF/lib 文件夹中复制所需的库文件并将它们扔到 tomcat/lib 中,但这不是正确的方法。

我必须对 tomcat 做些什么才能让它出现在我的 WEB-INF/lib 文件夹中吗?在我的源代码中我必须做些什么来告诉 tomcat 看那里吗?我是否必须让我的 tomcat/lib 文件夹充满 50 多个 jar ?

也许它是相关的,但我正在使用 CXF 和 Spring-MVC 技术。

我会发布源代码,但我不知道该放哪个文件,所以我会发布这个当前错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'publisher' defined in ServletContext resource [/WEB-INF/forum-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [publisher.Publisher]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/AccessorOrder    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)  at java.security.AccessController.doPrivileged(Native Method)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [publisher.Publisher]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/AccessorOrder
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
... 36 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/AccessorOrder
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createClassInfo(RuntimeModelBuilder.java:59)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createClassInfo(RuntimeModelBuilder.java:41)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:123)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:204)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:327)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:198)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

感谢您的帮助

最佳答案

正确使用 Maven:使用“war”打包并将所有需要的库作为依赖项。

关于Tomcat 似乎没有在我的 WEB-INF/lib 文件夹中提取 jar ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5628501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com