Miguel Angel Medina

Servicios Web

  • La forma de solucionar este problema es buscar los posibles conflictos entre las dependencias del proyecto. El conflicto puede darse entre
    las dependencias del mismo módulo o entre dependencias de distintos módulos que a su vez pueden dependen entre sí (en mi caso
    los conflictos entre dependencias se han dado en el mismo módulo).

    En este caso, el código es un módulo que alberga varios servicios web, que están generados (los objetos y dependencias) unos con Axis y otros con CXF.

    La traza generada por este conflicto de dependencias es el siguiente:

    Caused by: java.lang.NoSuchFieldError: QUALIFIED
        at org.apache.cxf.service.model.SchemaInfo.setSchema(SchemaInfo.java:146)
        at org.apache.cxf.wsdl11.SchemaUtil.extractSchema(SchemaUtil.java:136)
        at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:73)
        at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:65)
        at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:60)
        at org.apache.cxf.wsdl11.WSDLServiceBuilder.getSchemas(WSDLServiceBuilder.java:372)
        at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:339)
        at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:203)
        at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:175)
        at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:426)
        at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:546)
        at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263)
        at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
        at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
        at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
        at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
        at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:454)
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:537)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1608)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1549)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
       ... 53 more

     

       
    La forma de solucionarlo es mostrar las dependencias del módulo o proyecto. Si estamos utilizando maven, la orden que tendremos que ejecutar
    será la siguiente:
    mvn dependency:tree
    Si no tenemos el código compilado, podemos ejecutar para generar el arbol de dependencias:
    mvn compile dependency:tree
    Con la sentencia anterior obtendremos una salida parecida a la siguiente:

    	[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ miprosegur-ws ---
    	[INFO] com.prosegur.miprosegur:miprosegur-ws:war:1.0-SNAPSHOT
    	[INFO] +- com.prosegur.miprosegur:miprosegur-common:jar:1.0-SNAPSHOT:compile
    	[INFO] |  +- org.springframework:spring-core:jar:3.2.3.RELEASE:compile
    	[INFO] |  |  \- commons-logging:commons-logging:jar:1.1.1:compile
    	[INFO] |  +- org.springframework:spring-context:jar:3.2.3.RELEASE:compile
    	[INFO] |  |  +- org.springframework:spring-beans:jar:3.2.3.RELEASE:compile
    	[INFO] |  |  \- org.springframework:spring-expression:jar:3.2.3.RELEASE:compile
    	[INFO] |  +- org.springframework:spring-context-support:jar:3.2.3.RELEASE:compile
    	[INFO] |  +- org.springframework:spring-tx:jar:3.2.3.RELEASE:compile
    	[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
    	[INFO] |  +- org.springframework:spring-orm:jar:3.2.3.RELEASE:compile
    	[INFO] |  |  \- org.springframework:spring-jdbc:jar:3.2.3.RELEASE:compile
    	[INFO] |  +- org.springframework:spring-web:jar:3.2.3.RELEASE:compile
    	[INFO] |  +- org.springframework:spring-webmvc:jar:3.2.3.RELEASE:compile
    	[INFO] |  +- org.springframework:spring-aop:jar:3.2.3.RELEASE:compile
    	[INFO] |  +- org.springframework:spring-test:jar:3.2.3.RELEASE:compile
    	[INFO] |  +- org.springframework.mobile:spring-mobile-device:jar:1.1.0.M3:compile
    	[INFO] |  +- log4j:log4j:jar:1.2.16:compile
    	[INFO] |  +- org.apache.shiro:shiro-core:jar:1.2.2:compile
    	[INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.5:compile (version managed from 1.6.4)
    	[INFO] |  |  \- commons-beanutils:commons-beanutils:jar:1.8.0:compile (version managed from 1.8.3)
    	[INFO] |  +- org.apache.shiro:shiro-web:jar:1.2.2:compile
    	[INFO] |  +- org.apache.shiro:shiro-spring:jar:1.2.2:compile
    	[INFO] |  +- jstl:jstl:jar:1.2:compile
    	[INFO] |  +- org.dbunit:dbunit:jar:2.4.9:compile
    	[INFO] |  |  \- commons-collections:commons-collections:jar:3.1:compile (version managed from 3.2.1)
    	[INFO] |  +- commons-io:commons-io:jar:2.4:compile
    	[INFO] |  +- commons-fileupload:commons-fileupload:jar:1.2.2:compile
    	[INFO] |  +- org.apache.xmlbeans:xmlbeans:jar:2.4.0:compile
    	[INFO] |  +- javax.validation:validation-api:jar:1.0.0.GA:compile
    	[INFO] |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.12:compile
    	[INFO] |  |  \- org.codehaus.jackson:jackson-core-asl:jar:1.9.12:compile
    	[INFO] |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.12:compile
    	[INFO] |  +- org.codehaus.jackson:jackson-xc:jar:1.9.12:compile
    	[INFO] |  +- javax.servlet:jstl:jar:1.2:compile
    	[INFO] |  +- commons-dbcp:commons-dbcp:jar:1.2.2:compile
    	[INFO] |  |  \- commons-pool:commons-pool:jar:1.3:compile
    	[INFO] |  +- org.aspectj:aspectjrt:jar:1.7.3:compile
    	[INFO] |  +- org.aspectj:aspectjweaver:jar:1.7.3:compile
    	[INFO] |  +- commons-codec:commons-codec:jar:1.8:compile
    	[INFO] |  +- org.apache.axis2:axis2-transport-http:jar:1.6.1:compile
    	[INFO] |  |  \- org.apache.httpcomponents:httpcore:jar:4.0:compile
    	[INFO] |  +- org.apache.axis2:axis2-adb:jar:1.6.1:compile
    	[INFO] |  |  \- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0.2:compile
    	[INFO] |  +- org.apache.axis2:axis2-java2wsdl:jar:1.6.1:compile
    	[INFO] |  |  +- org.apache.ant:ant:jar:1.7.0:compile
        --> [INFO] |  |  +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.7:compile <-- ** Dependencia en conflicto **
    	[INFO] |  |  \- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.6:compile
    	[INFO] |  +- org.apache.axis2:axis2-adb-codegen:jar:1.6.1:compile
    	[INFO] |  |  \- commons-cli:commons-cli:jar:1.2:compile
    	[INFO] |  +- org.apache.axis2:axis2-ant-plugin:jar:1.6.1:compile
    	[INFO] |  |  +- wsdl4j:wsdl4j:jar:1.6.2:compile
    	[INFO] |  |  \- org.apache.neethi:neethi:jar:3.0.1:compile
    	[INFO] |  +- org.apache.axis2:axis2-clustering:jar:1.6.1:compile
    	[INFO] |  |  +- org.apache.tomcat:tribes:jar:6.0.16:compile
    	[INFO] |  |  \- org.apache.tomcat:juli:jar:6.0.16:compile
    	[INFO] |  +- org.apache.axis2:axis2-codegen:jar:1.6.1:compile
    	[INFO] |  +- org.apache.axis2:axis2-corba:jar:1.6.1:compile
    	[INFO] |  |  \- antlr:antlr:jar:2.7.7:compile
    	[INFO] |  +- org.apache.axis2:axis2-fastinfoset:jar:1.6.1:compile
    	[INFO] |  |  +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.7:compile
    	[INFO] |  |  \- commons-httpclient:commons-httpclient:jar:3.1:compile
    	[INFO] |  +- org.apache.axis2:axis2-jaxbri:jar:1.6.1:compile
    	[INFO] |  |  +- com.sun.xml.bind:jaxb-impl:jar:2.1.7:compile
    	[INFO] |  |  +- com.sun.xml.bind:jaxb-xjc:jar:2.1.7:compile
    	[INFO] |  |  \- javax.xml.bind:jaxb-api:jar:2.1:compile
    	[INFO] |  +- org.apache.axis2:axis2-jaxws:jar:1.6.1:compile
    	[INFO] |  |  +- org.apache.geronimo.specs:geronimo-annotation_1.0_spec:jar:1.1:compile
    	[INFO] |  |  +- org.apache.geronimo.specs:geronimo-jaxws_2.2_spec:jar:1.0:compile
    	[INFO] |  |  \- xalan:xalan:jar:2.7.0:compile
    	[INFO] |  +- org.apache.axis2:axis2-jibx:jar:1.6.1:compile
    	[INFO] |  |  +- org.jibx:jibx-bind:jar:1.2:compile
    	[INFO] |  |  |  \- bcel:bcel:jar:5.1:compile
    	[INFO] |  |  |     \- regexp:regexp:jar:1.2:compile
    	[INFO] |  |  \- org.jibx:jibx-run:jar:1.2:compile
    	[INFO] |  +- org.apache.axis2:axis2-json:jar:1.6.1:compile
    	[INFO] |  |  \- org.codehaus.jettison:jettison:jar:1.0-RC2:compile
    	[INFO] |  +- org.apache.axis2:axis2-kernel:jar:1.6.1:compile
    	[INFO] |  |  +- org.apache.ws.commons.axiom:axiom-api:jar:1.2.12:compile
    	[INFO] |  |  |  +- jaxen:jaxen:jar:1.1.1:compile
    	[INFO] |  |  |  \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
    	[INFO] |  |  +- org.apache.ws.commons.axiom:axiom-impl:jar:1.2.12:compile
    	[INFO] |  |  +- org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec:jar:1.1.2:compile
    	[INFO] |  |  +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1:compile
    	[INFO] |  |  +- org.apache.woden:woden-api:jar:1.0M9:compile
    	[INFO] |  |  +- org.apache.woden:woden-impl-dom:jar:1.0M9:compile
    	[INFO] |  |  |  \- org.apache.woden:woden-impl-commons:jar:1.0M9:compile
    	[INFO] |  |  \- javax.ws.rs:jsr311-api:jar:1.0:compile
    	[INFO] |  +- org.apache.axis2:axis2-metadata:jar:1.6.1:compile
    	[INFO] |  |  \- com.sun.xml.ws:jaxws-tools:jar:2.1.3:compile
    	[INFO] |  +- org.apache.axis2:axis2-mtompolicy:jar:1.6.1:compile
    	[INFO] |  +- org.apache.axis2:axis2-saaj:jar:1.6.1:compile
    	[INFO] |  |  +- org.apache.geronimo.specs:geronimo-saaj_1.3_spec:jar:1.0.1:compile
    	[INFO] |  |  \- org.apache.ws.commons.axiom:axiom-dom:jar:1.2.12:compile
    	[INFO] |  +- org.apache.axis2:axis2-soapmonitor-servlet:jar:1.6.1:compile
    	[INFO] |  +- org.apache.axis2:axis2-spring:jar:1.6.1:compile
    	[INFO] |  +- org.apache.axis2:axis2-transport-local:jar:1.6.1:compile
    	[INFO] |  +- org.apache.axis2:axis2-xmlbeans:jar:1.6.1:compile
    	[INFO] |  |  \- org.apache.ant:ant-launcher:jar:1.7.0:compile
    	[INFO] |  +- javax.jms:jms-api:jar:1.1-rev-1:compile
    	[INFO] |  \- com.tibco:jms:jar:1.0:compile
    	[INFO] +- com.prosegur.miprosegur:miprosegur-business:jar:1.0-SNAPSHOT:compile
    	[INFO] |  +- com.prosegur.miprosegur:miprosegur-v1:jar:1.0-SNAPSHOT:compile
    	[INFO] |  |  +- asm:asm-attrs:jar:2.2.3:compile
    	[INFO] |  |  +- org.hibernate:hibernate:jar:3.2.7.ga:compile
    	[INFO] |  |  |  +- net.sf.ehcache:ehcache:jar:1.2.3:compile
    	[INFO] |  |  |  +- javax.transaction:jta:jar:1.0.1B:compile
    	[INFO] |  |  |  +- dom4j:dom4j:jar:1.6.1:compile
    	[INFO] |  |  |  \- cglib:cglib:jar:2.2:compile (version managed from 2.1_3)
    	[INFO] |  |  +- c3p0:c3p0:jar:0.9.1.2:compile (version managed from 0.9.1)
    	[INFO] |  |  +- c3p0:c3p0-oracle-thin-extras:jar:0.9.0.2:compile
    	[INFO] |  |  +- org.hibernate:hibernate-core:jar:3.6.9.Final:compile
    	[INFO] |  |  |  +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
    	[INFO] |  |  |  \- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
    	[INFO] |  |  +- joda-time:joda-time:jar:2.1:compile
    	[INFO] |  |  +- joda-time:joda-time-hibernate:jar:0.8:compile
    	[INFO] |  |  +- commons-lang:commons-lang:jar:2.6:compile
    	[INFO] |  |  +- org.json:json:jar:20070829:compile
    	[INFO] |  |  +- com.lowagie:itext:jar:2.1.7:compile
    	[INFO] |  |  |  +- bouncycastle:bcmail-jdk14:jar:138:compile
    	[INFO] |  |  |  +- bouncycastle:bcprov-jdk14:jar:138:compile
    	[INFO] |  |  |  \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile
    	[INFO] |  |  |     +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
    	[INFO] |  |  |     \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
    	[INFO] |  |  +- javax.mail:mail:jar:1.4:compile
    	[INFO] |  |  +- javax.xml:jaxrpc-api-osgi:jar:1.1-b01:compile
    	[INFO] |  |  +- xerces:xercesImpl:jar:2.8.1:compile
    	[INFO] |  |  |  \- xml-apis:xml-apis:jar:1.3.03:compile
    	[INFO] |  |  +- org.jdom:jdom:jar:1.1:compile
    	[INFO] |  |  +- net.sourceforge.jexcelapi:jxl:jar:2.6.12:compile
    	[INFO] |  |  +- org.ostermiller:utils:jar:1.07.00:compile
    	[INFO] |  |  +- org.apache.poi:poi:jar:3.0-FINAL:compile
    	[INFO] |  |  +- displaytag:displaytag:jar:1.2:compile
    	[INFO] |  |  +- org.ajaxtags:ajaxtags:jar:1.1.5:compile
    	[INFO] |  |  |  \- net.htmlparser:jericho-html:jar:1.5-dev1:compile
    	[INFO] |  |  +- taglibs:standard:jar:1.1.2:compile
    	[INFO] |  |  +- com.google.code.gson:gson:jar:1.7.1:compile
    	[INFO] |  |  \- net.sourceforge.javacsv:javacsv:jar:2.0:compile
    	[INFO] |  \- com.prosegur.miprosegur:miprosegur-persistence:jar:1.0-SNAPSHOT:compile
    	[INFO] |     +- org.mybatis:mybatis:jar:3.2.2:compile
    	[INFO] |     +- org.mybatis:mybatis-spring:jar:1.2.0:compile
    	[INFO] |     +- com.oracle:ojdbc6:jar:11.2.0.3:compile
    	[INFO] |     \- org.hibernate:hibernate-validator:jar:4.2.0.Final:compile
    	[INFO] +- junit:junit:jar:4.8.2:test
    	[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.7.5:compile
    	[INFO] |  +- xml-resolver:xml-resolver:jar:1.2:compile
    	[INFO] |  +- asm:asm:jar:3.3.1:compile
    	[INFO] |  +- org.apache.cxf:cxf-api:jar:2.7.5:compile
    	[INFO] |  |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.2.0:compile
    	[INFO] |  |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.1:compile
    -->	[INFO] |  |  \- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.3:compile <-- ** Dependencia en conflicto **
    	[INFO] |  +- org.apache.cxf:cxf-rt-core:jar:2.7.5:compile
    	[INFO] |  +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.7.5:compile
    	[INFO] |  |  \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.7.5:compile
    	[INFO] |  +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.7.5:compile
    	[INFO] |  +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.7.5:compile
    	[INFO] |  \- org.apache.cxf:cxf-rt-ws-addr:jar:2.7.5:compile
    	[INFO] |     \- org.apache.cxf:cxf-rt-ws-policy:jar:2.7.5:compile
    	[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:2.7.5:compile
    	[INFO] |  \- javax.ws.rs:javax.ws.rs-api:jar:2.0-m10:compile
    	[INFO] +- org.apache.cxf:cxf-rt-transports-http:jar:2.7.5:compile
    	[INFO] +- org.apache.cxf:cxf-rt-transports-http-jetty:jar:2.7.5:compile
    	[INFO] |  +- org.eclipse.jetty:jetty-server:jar:8.1.7.v20120910:compile
    	[INFO] |  |  +- org.eclipse.jetty:jetty-continuation:jar:8.1.7.v20120910:compile
    	[INFO] |  |  \- org.eclipse.jetty:jetty-http:jar:8.1.7.v20120910:compile
    	[INFO] |  |     \- org.eclipse.jetty:jetty-io:jar:8.1.7.v20120910:compile
    	[INFO] |  |        \- org.eclipse.jetty:jetty-util:jar:8.1.7.v20120910:compile
    	[INFO] |  +- org.eclipse.jetty:jetty-security:jar:8.1.7.v20120910:compile
    	[INFO] |  \- org.apache.geronimo.specs:geronimo-servlet_3.0_spec:jar:1.0:compile
    	[INFO] \- org.codehaus.woodstox:wstx-asl:jar:3.2.8:compile
    	[INFO]    \- stax:stax-api:jar:1.0.1:compile
    Con los símbolos --> y <-- he han señalado las dependencias que entran en conflicto en este caso, ya que la clases contenidas en
    org.apache.ws.commons.schema:XmlSchema:jar:1.4.7 ya se encuentran en org.apache.ws.xmlschema:xmlschema-core:jar:2.0.3.

    La forma de solucionarlo es añadiendo una etiqueta <exclusion> en el pom para evitar la inclusión de la dependencia conflictiva.
     
    Podremos ver en el árbol de dependencias que las que entran en conflicto están en diferentes módulos, y además éstos son dependencias del módulo
    que contiene los servicios web, por lo que para evitar el conflicto se excluye la que nos interese, en este caso excluímos la dependencia de Axis.

    Incluyendo las siguientes entiquetas en el pom solucionaremos el problema:

            <dependency>
                <groupId>com.prosegur.miprosegur</groupId>
                <artifactId>miprosegur-common</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.ws.commons.schema</groupId>
                        <artifactId>XmlSchema</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>      
Logo M4 ERP
Developer

Seguridad de la página de inicio

© 2018 Miguel Ángel Medina. Todos los derechos reservados

Please publish modules in offcanvas position.