java - 发现从元素 'jaxrs:servicebeans' 开始的无效内容”

标签 java xml web-services cxf jax-rs

我正在尝试运行 JAX-RS 服务。尝试启动 Tomcat 服务器时,出现错误“发现以元素 'jaxrs:servicebeans' 开头的无效内容

详细错误是 -

* 发现以元素“jaxrs:servicebeans”开头的无效内容。 '{“http://cxf.apache.org/jaxrs”:executor、“http://cxf.apache.org/jaxrs”:features、“http://cxf.apache.org/jaxrs”:绑定(bind)、“http://cxf.apache.org/jaxrs”:dataBinding、“http://cxf.apache.org/jaxrs”:inInterceptors、“http://cxf.apache.org/jaxrs”:inFaultInterceptors、“http://cxf.apache.org/jaxrs”:invoker、“http://cxf.apache.org/jaxrs”之一: serviceFactories、“http://cxf.apache.org/jaxrs”:outInterceptors、“http://cxf.apache.org/jaxrs”:outFaultInterceptors、“http://cxf.apache.org/jaxrs”:properties、http://cxf.apache.org/jaxrs”:serviceBeans、“http://cxf.apache.org/jaxrs”:modelBeans、“http://cxf.apache.org/jaxrs”:模型、“http://cxf.apache.org/jaxrs”:providers 、“http://cxf.apache.org/jaxrs”:extensionMappings、“http://cxf.apache.org/jaxrs”:languageMappings、“http://cxf.apache.org/jaxrs”:schemaLocations、“http://cxf.apache.org/jaxrs”:resourceComparator}' 是预期的。 *

我的spring配置文件是-

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:addressing="http://cxf.apache.org/ws/addressing"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:beans="http://cxf.apache.org/configuration/beans"
    xmlns:configuration="http://cxf.apache.org/transports/http/configuration"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
    xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    xmlns:p="http://www.springframework.org/schema/p" xmlns:parameterized-types="http://cxf.apache.org/configuration/parameterized-types"
    xmlns:soap="http://cxf.apache.org/bindings/soap" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:webservice="http://sf.icptp.springextensions/schema/webservice" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws/addressing.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
        http://cxf.apache.org/configuration/beans http://cxf.apache.org/schemas/configuration/cxf-beans.xsd
        http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
        http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
        http://cxf.apache.org/configuration/parameterized-types http://cxf.apache.org/schemas/configuration/parameterized-types.xsd
        http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd 
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
        http://sf.icptp.springextensions/schema/webservice http://sf.icptp.springextensions/schema/webservice/webservice.xsd" >

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

    <bean id="order" class="com.example.rest.OrderInfoImpl" />

    <jaxrs:server address="/" id="connectionService">
        <jaxrs:servicebeans>
            <ref bean="order"></ref>
        </jaxrs:servicebeans>
        <jaxrs:extensionmappings>
            <entry key="xml" value="application/xml" ></entry>
        </jaxrs:extensionmappings>
    </jaxrs:server>

</beans>

我无法弄清楚为什么它无法识别 jaxrs:server 标记内的“jaxrs:servicebeans”标记。不确定是否是cxf-rt-frontend-jaxrs版本的问题;虽然我确实尝试过版本 2.5.2 和 2.7.3。

最佳答案

文件区分大小写。将 servicebeans 替换为 serviceBeans。

关于java - 发现从元素 'jaxrs:servicebeans' 开始的无效内容”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16177240/

相关文章:

java - 在标准 Java 中迭代 XML DOM 文档

java - 如何在 Java 中将 SOAP 模板加载到 SOAP 消息中?

java - 如果字符串中的所有字母都相同,则尝试返回 true

java - 如何使用 Retrofit 2 获取字符串响应?

java - 播放不间断的声音声音池

Java 网络应用程序

java - 以编程方式使用现有相机应用程序拍照,而不是使用预览捕获按钮

xml - odoo- 'Field origin does not exist'

asp.net - 在表单例份验证 cookie 中存储密码 - ASP.NET 和 WCF 调用

node.js - 在 NodeJS 中向外行用户隐藏 Web 服务