引起:java.lang.NoSuchMethodError:org.apache.cxf.transport.AbstractTransportFactory

当我在将webservices集成到其中后尝试构建我的spring时,我得到了以下错误 . 可以帮助这些吗?以下是错误

org.springframework.beans.factory.BeanCreationException:创建名为'XDREndpoint'的bean时出错:init方法的调用失败;嵌套异常是javax.xml.ws.WebServiceException:org.apache.cxf.service.factory.ServiceConstructionException:无法创建服务 . 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)在org.springframework.beans.factory .support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:304)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton( DefaultSingletonBeanRegistry.java:228)org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)at org org.spr上的.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700)位于org.springframework.wetext.Context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader)的org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)中的ingframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760) . java:403)org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)位于org.apache.catalina.core的org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) .standardContext.listenerStart(StandardContext.java:4853)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)引起:javax.xml.ws.WebServiceException:org.apache.cxf.bus.extension .ExtensionException:无法创建扩展类org.apache.cxf.binding.soap.SoapTransportFactory的对象 . org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)atg.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)org.apache.cxf.jaxws.EndpointImpl.publish (EndpointImpl.java:543)在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)的sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at at java.lang.reflect.Method.invoke(Method.java:497)位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory的org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1681) . 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)中的invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1620)引起:java.lang.NoSuchMethodError:org.apache.cxf.transport.AbstractTr ansportFactory . (Ljava / UTIL /列表; Lorg /阿帕奇/ CXF /总线;)V

回答(2)

2 years ago

问题是您的CXF依赖项有不同的版本 . 为所有CXF依赖项设置相同的版本将解决您的问题 . 请注意,某些依赖项已从一个版本移动,更改,替换或删除到另一个版本:您可能需要调整依赖项以使一切正常 .

2 years ago

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.glenwood.glaceemr</groupId>
    <artifactId>glaceemr</artifactId>
    <packaging>war</packaging>
    <version>5.0-SNAPSHOT</version>
    <name>GlaceEMR Backend</name>
    <url>http://maven.apache.org</url>
    <properties>
        <spring.version>4.0.1.RELEASE</spring.version>
        <jackson.version>2.5.0</jackson.version>
        <version.org.json>20080701</version.org.json>
        <junit.version>4.11</junit.version>
        <postgresqljdbc.version>9.1-901.jdbc4</postgresqljdbc.version>
        <servlet.version>3.0.1</servlet.version>
        <dbcp.version>1.4</dbcp.version>


        <!-- Maven -->
        <maven-surefire-plugin.version>2.9</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>2.12</maven-failsafe-plugin.version>
        <maven-compiler-plugin.version>2.5.1</maven-compiler-plugin.version>
        <maven-war-plugin.version>2.2</maven-war-plugin.version>
        <maven-deploy-plugin.version>2.7</maven-deploy-plugin.version>
        <tomcat-maven-plugin.version>2.0</tomcat-maven-plugin.version>
        <jetty-plugin.version>8.1.0.v20120127</jetty-plugin.version>

        <target.jdk>1.7</target.jdk>
        <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <project.deployment.encoding>UTF-8</project.deployment.encoding>

    </properties>
    <dependencies>

        <!-- Spring Servlet -->

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
        </dependency>

        <!-- javax validation -->

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
        </dependency>

        <!-- Swagger integration -->
        <!-- <dependency>
            <groupId>com.mangofactory</groupId>
            <artifactId>swagger-springmvc</artifactId>
            <version>0.8.8</version>
        </dependency>
        <dependency>
            <groupId>com.mangofactory</groupId>
            <artifactId>swagger-springmvc</artifactId>
            <version>0.5.2</version>
        </dependency>

        <dependency>
            <groupId>com.mangofactory</groupId>
            <artifactId>swagger-springmvc</artifactId>
            <version>0.9.5</version>
        </dependency> -->

        <!-- Spring 4 dependencies -->
        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-core</artifactId>
            <version>2.4.0.RELEASE</version>
        </dependency>
    <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.santuario</groupId>
            <artifactId>xmlsec</artifactId>
            <version>2.0.7</version>
        </dependency>
        <dependency>
            <groupId>org.apache.wss4j</groupId>
            <artifactId>wss4j-ws-security-dom</artifactId>
            <version>2.1.8</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring.version}</version>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>3.2.3.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>3.2.3.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>3.2.3.RELEASE</version>
            <scope>test</scope>
        </dependency>



        <!-- Spring Data REST -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-rest-webmvc</artifactId>
            <version>2.0.0.RC1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.hateoas</groupId>
            <artifactId>spring-hateoas</artifactId>
            <version>0.9.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.5.0.RC1</version>
        </dependency>

        <!-- Hibernate / JPA -->
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.0.Final</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.5.6-Final</version>
        </dependency>

        <!-- Postgresql jdbc -->

        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresqljdbc.version}</version>
        </dependency>

        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>${dbcp.version}</version>
        </dependency>

        <!-- Jackson JSON Mapper -->

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- jackson lazy loading serializer -->
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-hibernate4</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>${version.org.json}</version>
        </dependency>

        <!-- Junit Testing -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>1.9.5</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>1.3.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
    <dependency>
        <groupId>com.github.springtestdbunit</groupId>
        <artifactId>spring-test-dbunit</artifactId>
        <version>1.0.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.dbunit</groupId>
        <artifactId>dbunit</artifactId>
        <version>2.4.8</version>
        <scope>test</scope>
    </dependency>

        <!-- Joda time -->

        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.3</version>
        </dependency>

        <dependency>
            <groupId>org.jadira.usertype</groupId>
            <artifactId>usertype.core</artifactId>
            <version>3.2.0.GA</version>
        </dependency>

        <dependency>
            <groupId>org.jadira.usertype</groupId>
            <artifactId>usertype.jodatime</artifactId>
            <version>2.0.1</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-joda</artifactId>
            <version>2.4.0-rc2</version>
        </dependency>
        <!-- Query dsl -->
        <dependency>
            <groupId>com.mysema.querydsl</groupId>
            <artifactId>querydsl-core</artifactId>
            <version>3.5.0</version>
        </dependency>

        <dependency>
            <groupId>com.mysema.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>
            <version>3.5.0</version>
        </dependency>

        <dependency>
            <groupId>com.mysema.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
            <version>3.5.0</version>
        </dependency>
        <!-- CXF -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>3.1.10</version>
        </dependency>
        <dependency>

            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-security</artifactId>
            <version>3.1.10</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>2.4.10</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-core</artifactId>
            <version>3.1.10</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-policy</artifactId>
            <version>3.1.10</version>
        </dependency>
         <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-bindings-soap</artifactId>
        <version>2.5.2</version>
    </dependency>

        <!-- Misc -->

        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <version>0.9.1</version>
        </dependency>
<dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>0.12.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <!-- Generate compiled stuff in the folder used for developing mode -->
        <finalName>glaceemr</finalName>
        <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${target.jdk}</source>
                    <target>${target.jdk}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <proc>none</proc>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                </configuration>
            </plugin>


    <!-- querydsl -->

            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.1</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <!-- Specifies the directory in which the query types are generated -->
                            <outputDirectory>target/generated-sources</outputDirectory>
                            <!-- States that the APT code generator should look for JPA annotations -->
                            <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <processor>lombok.core.AnnotationProcessor,org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
                    </compilerArguments>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-jpamodelgen</artifactId>
                        <version>1.3.0.Final</version>
                        <scope>compile</scope>
                    </dependency>
                </dependencies>
            </plugin>


        </plugins>
    </build>

    <pluginRepositories>
        <pluginRepository>
            <id>apache.snapshots</id>
            <name>Apache Snapshots</name>
            <url>https://repository.apache.org/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
    <repositories>
        <repository>
            <id>spring-milestone</id>
            <name>Spring Maven MILESTONE Repository</name>
            <url>http://repo.springsource.org/libs-milestone</url>
        </repository>


        <!-- Swaggger Based Repository -->
        <repository>
            <id>jcenter-release</id>
            <name>jcenter</name>
            <url>http://oss.jfrog.org/artifactory/oss-release-local/</url>
        </repository>

    </repositories>
</project>