JAXWS和Metro WS的Spring命名空间问题

时间:2014-01-13 22:31:26

标签: java spring web-services

我正在尝试使用Spring 3.0 + JAX-WS(METRO)实现Web服务,但是在启动服务器时出错...

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 148 in XML    
document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid;   
nested exception is org.xml.sax.SAXParseException; lineNumber: 148; columnNumber: 64; 
cvc-complex-type.2.4.c:The matching wildcard is strict, but no declaration can be found 
for element 'wss:binding'

我只需要在我的webservices中注入spring注释(@Autowired和@PersistenceContext),所以我使用的是wss:binding ...

我的applicationContext.xml是......

<?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:p="http://www.springframework.org/schema/p"
   xmlns:aop="http://www.springframework.org/schema/aop"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:ws="http://jax-ws.java.net/spring/core"
   xmlns:wss="http://jax-ws.java.net/spring/servlet"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:mvc="http://www.springframework.org/schema/mvc"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/aop
   http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
   http://www.springframework.org/schema/tx
   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
   http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
   http://jax-ws.java.net/spring/core
   http://jax-ws.java.net/spring/core.xsd
   http://jax-ws.java.net/spring/servlet
   http://jax-ws.java.net/spring/servlet.xsd">


<context:annotation-config />
<context:component-scan base-package="br.com.mmm.application" />

<mvc:annotation-driven />

<bean id="placeHolderConfig"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="ignoreResourceNotFound" value="false" />
    <property name="ignoreUnresolvablePlaceholders" value="false" />
    <property name="location" value="classpath:mvsaudews.properties" />
</bean>

<!-- Configuracao do DataSource para o pool de conexões Oracle -->
<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource"
    destroy-method="close">
    <property name="URL" value="${jdbc.url}" />
    <property name="user" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />

    <property name="connectionCachingEnabled" value="true" />
    <property name="connectionCacheProperties">
        <value>
            MinLimit = 5
            MaxLimit = 60
            InactivityTimeout = 600
            TimeToLiveTimeout = 600
            PropertyCheckInterval = 180
            InitialLimit = 5
            MaxStatementsLimit = 5000
            ValidateConnection = true
        </value>
    </property>
</bean>

<!-- Entity Manager do JPA 2.0 -->
<bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

    <!-- <property name="persistenceUnitName" value="mvsaudews" /> -->
    <!-- <property name="persistenceXmlLocation" value="/META-INF/persistence.xml"/> -->
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan" value="br.com.mmm.application.model" />
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
    </property>
    <property name="jpaProperties">
        <props>

            <prop key="hibernate.connection.driver_class">${jdbc.driverClassName}</prop>
            <prop key="hibernate.dialect">${jdbc.dialect}</prop>
            <prop key="hibernate.default_schema">${jdbc.default_schema}</prop>
            <prop key="hibernate.archive.autodetection">${hibernate.autodetection}</prop>
            <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
            <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
            <prop key="use_sql_comments">true</prop>
            <prop key="hibernate.query.substitutions">${hibernate.substitutions}</prop>
        </props>
    </property>
</bean>

<!-- Gerenciador de transacoes by JPA -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>


<!-- the transactional advice (what 'happens'; see the <aop:advisor/> bean below) -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
    <!-- the transactional semantics... -->
    <tx:attributes>
        <!-- all methods starting with 'get' are read-only -->
        <tx:method name="get*" read-only="true" />
        <!-- other methods use the default transaction settings (see below) -->
        <tx:method name="*" />
    </tx:attributes>
</tx:advice>

<bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/views/" />
    <property name="suffix" value=".jsp" />
</bean>

<!-- DataSourceManager -->
<bean id="dataSourceManager" class="br.com.mmm.library.DataSourceManager">
    <property name="dataSource" ref="dataSource" />
</bean>

<tx:annotation-driven transaction-manager="transactionManager" />

<!--  WebServices -->
<wss:binding url="/services/v/verificaElegibilidade">
    <wss:service>
        <ws:service bean="#verificaElegibilidade"/>
    </wss:service>
</wss:binding>

<bean id="verificaElegibilidade" class="br.com.mmm.webservices.v.verificaElegibilidade"/>   

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

试试这个:

xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"