Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 调用init方法失败;嵌套异常是org.apache.cxf.service.factory.ServiceConstructionException_Spring_Maven_Spring Security_Cxf - Fatal编程技术网

Spring 调用init方法失败;嵌套异常是org.apache.cxf.service.factory.ServiceConstructionException

Spring 调用init方法失败;嵌套异常是org.apache.cxf.service.factory.ServiceConstructionException,spring,maven,spring-security,cxf,Spring,Maven,Spring Security,Cxf,Bean.xml web.xml cxf 上下文配置位置 WEB-INF/beans.xml org.springframework.web.context.ContextLoaderListener cxf org.apache.cxf.transport.servlet.CXFServlet 1. cxf /服务/* springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy spring

Bean.xml


web.xml


cxf
上下文配置位置
WEB-INF/beans.xml
org.springframework.web.context.ContextLoaderListener
cxf
org.apache.cxf.transport.servlet.CXFServlet
1.
cxf
/服务/*
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
我正在使用ApacheCXF并开发一个RESTWeb服务示例
我的程序中出现了上述错误。还发布了bean.xml和web.xml 关于错误,请提供帮助,我正在使用maven和spring,我只是想验证一个用户。

您的主要错误是

    <?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">
        <display-name>cxf</display-name>

        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>WEB-INF/beans.xml</param-value>
        </context-param>

        <listener>
            <listener-class>
                org.springframework.web.context.ContextLoaderListener
            </listener-class>
        </listener>

        <servlet>
            <servlet-name>cxf</servlet-name>        
            <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>        
            <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
            <servlet-name>cxf</servlet-name>
            <url-pattern>/services/*</url-pattern>
        </servlet-mapping>

        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    </web-app> 

I am working on apache cxf and developing a rest web service example
此相关问题可能会帮助您找到解决方案:

请给我任何建议。请回答我。请给我任何解决方案
    <beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
       xmlns:security="http://www.springframework.org/schema/security"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://cxf.apache.org/jaxrs
       http://cxf.apache.org/schemas/jaxrs.xsd
       http://www.springframework.org/schema/security
       http://www.springframework.org/schema/security/spring-security-3.1.xsd">

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

        <!-- define the jackson provider for JAXB/JSON support --> 
        <bean id="jacksonProvider" class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider" />

        <jaxrs:server id="myService" address="/">
            <jaxrs:serviceBeans>
                <ref bean="serviceImpl" />
            </jaxrs:serviceBeans>
            <jaxrs:providers>
                <ref bean='jacksonProvider' />
        </jaxrs:providers>
        </jaxrs:server>

        <bean id="serviceImpl" class="com.rs.UserServiceImpl" />

        <security:http>
            <security:http-basic></security:http-basic>
            <security:intercept-url pattern="/**" access="ROLE_USER" />
        </security:http>

        <security:authentication-manager  alias="authenticationManager">
            <security:authentication-provider>
            <security:user-service>            
                <security:user name="bob" password="bobspassword" authorities="ROLE_USER" />
            </security:user-service>
        </security:authentication-provider>
        </security:authentication-manager>   
    </beans>
    <?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">
        <display-name>cxf</display-name>

        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>WEB-INF/beans.xml</param-value>
        </context-param>

        <listener>
            <listener-class>
                org.springframework.web.context.ContextLoaderListener
            </listener-class>
        </listener>

        <servlet>
            <servlet-name>cxf</servlet-name>        
            <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>        
            <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
            <servlet-name>cxf</servlet-name>
            <url-pattern>/services/*</url-pattern>
        </servlet-mapping>

        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    </web-app> 

I am working on apache cxf and developing a rest web service example
org.apache.cxf.BusException: No binding factory for namespace http://apache.org/cxf/binding/jaxrs registered.