찾다

 >  Q&A  >  본문

java - 现有spring项目整合cxf出现class not found cxfservlet

在原有ssh项目上整合cxf时报错

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

<code>严重: Servlet [HelloWorldService] in web application [/admin_iqiyi] threw load() exception

java.lang.ClassNotFoundException: org.apache.cxf.transport.servlet.CXFServlet

    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)

    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)

    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)

    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)

    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)

    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1133)

    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)

    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)

    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)

    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)

    at org.apache.catalina.core.StandardContext.reload(StandardContext.java:4138)

    at org.apache.catalina.startup.HostConfig.reload(HostConfig.java:1539)

    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1512)

    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1748)

    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:333)

    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)

    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)

    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1370)

    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1542)

    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1552)

    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1520)

    at java.lang.Thread.run(Thread.java:662)

</code>

查了半天都说是未导jar包或者未配置cxf servlet,但是我都引入了
web.xml

1

2

3

4

5

6

7

8

9

10

11

12

13

14

<code><servlet>   

        <servlet-name>HelloWorldService</servlet-name>   

        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>   

        <load-on-startup>1</load-on-startup>

        <init-param>

            <param-name>config-location</param-name>

            <param-value>/WEB-INF/beans.xml</param-value>

        </init-param>  

    </servlet>   

    <servlet-mapping>   

        <servlet-name>HelloWorldService</servlet-name>   

        <url-pattern>/service/*</url-pattern>   

    </servlet-mapping>

</code>

cxf配置文件

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

<code><?xml version="1.0" encoding="UTF-8"?>   

<beans xmlns="http://www.springframework.org/schema/beans"   

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"   

    xsi:schemaLocation="   

http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd   

http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">   

     

    <import resource="classpath*:META-INF/cxf/cxf.xml" />   

    <import resource="classpath*:META-INF/cxf/cxf-extension-soap.xml" />   

    <import resource="classpath*:META-INF/cxf/cxf-servlet.xml" />   

     

    <bean id="service1" class="com.admin.webservice.impl.CINotifyService"></bean>   

     

    <jaxws:endpoint id="hello" implementor="#service1" address="/HelloWorldService" />   

     

     

</beans>

</code>

实在是搞不明白是怎么回事,求指导

怪我咯怪我咯2815일 전863

모든 응답(3)나는 대답할 것이다

  • 天蓬老师

    天蓬老师2017-04-18 10:55:14

    소개되었다고 해서 거기에 있다는 의미는 아닙니다. lib 디렉토리에 있는지 확인하세요

    회신하다
    0
  • 迷茫

    迷茫2017-04-18 10:55:14

    이 가방이 있는지 확인해보세요. . ? ? cxf-rt-transports-http.jar

    회신하다
    0
  • PHPz

    PHPz2017-04-18 10:55:14

    CXF 객체는 Spring에서 관리되나요?

    회신하다
    0
  • 취소회신하다