我正在尝试运行包含 Spring 安全性的示例,但我从web.xml
. 现在看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/cxf.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<display-name>CXF Servlet</display-name>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<!--
<init-param><param-name>contextConfigLocation</param-name><param-value>
WEB-INF/cxf.xml
WEB-INF/applicationContext-security.xml
</param-value></init-param>
-->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>fsmsc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>spring.profiles.active</param-name>
<param-value>test-profile</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/static/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/cxf/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>fsmsc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
部署时,我收到此错误:
严重:向 org.springframework.web.context.ContextLoaderListener java.lang.NoClassDefFoundError 类的侦听器实例发送上下文初始化事件的异常:org/codehaus/jettison/mapped/TypeConverter 在 java.lang.Class.getDeclaredConstructors0(Native Method) 在 java.lang.Class.privateGetDeclaredConstructors(Class.java:2398) 在 java.lang.Class.getDeclaredConstructors(Class.java:1838) 在 org.springframework.beans.factory .annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:229) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:962) at org.springframework.beans.factory.support.AbstractAutowireableCapableBeanFactory.create .java:935) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) 在 org.springframework.beans.factory.support.AbstractBeanFactory 的 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) $1.getObject(AbstractBeanFactory.java:294) 在 org.springframework。 beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) 在 org.springframework.beans.factory.support.AbstractBeanFactory。 getBean(AbstractBeanFactory.java:193) 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) 在 org.springframework.context.support.AbstractApplicationContext。finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) at org.springframework .web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) 在 org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) 在 org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java :4887) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在 org.apache.catalina.core.org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381)。ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org .apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655) at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:439) 在 java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 在 java.util.concurrent.FutureTask.run(FutureTask.java:138) 在 java.util.concurrent。 ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) 在 java.lang.Thread.run(Thread.java:662)引起:java.lang.ClassNotFoundException:org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)的org.codehaus.jettison.mapped.TypeConverter在org.apache.catalina.loader.WebappClassLoader。 loadClass(WebappClassLoader.java:1558) ... 32 更多