Java 创建名为“serviceController”的bean时出错:自动连线依赖项的注入失败;

Java 创建名为“serviceController”的bean时出错:自动连线依赖项的注入失败;,java,spring,spring-mvc,Java,Spring,Spring Mvc,我克隆了一个存储库。存储库在所有系统中都运行良好。但是,当我试图运行webApp时,自动连线依赖注入失败。下面是配置 Pom.xml <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.o

我克隆了一个存储库。存储库在所有系统中都运行良好。但是,当我试图运行webApp时,自动连线依赖注入失败。下面是配置

Pom.xml

<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/xsd/maven-4.0.0.xsd">
<!--<parent> <groupId>com.visa.cdisi.test</groupId> <artifactId>applepay-reg-parent</artifactId> 
    <version>1.0</version> <relativePath>../ApplePayRegistrationBuild/pom.xml</relativePath> 
    </parent> -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.visa.data.tranhist</groupId>
<artifactId>applepay-reg_svc</artifactId>
<version>1.0-SNAPSHOT</version>
<name>CDISI_ApplePay_Registration</name>
<properties>
    <hbase_version>2.0.2.3.1.0.0-78</hbase_version>
    <hadoop_version>3.1.1.3.1.0.0-78</hadoop_version>
    <htrace_version_apache>3.2.0-incubating</htrace_version_apache>
    <htrace_version_cloudera>3.0.4</htrace_version_cloudera>
    <zookeeper_version>3.4.6.3.1.0.0-78</zookeeper_version>
    <!-- <zookeeper_version>3.4.5</zookeeper_version> -->
    <htrace4_version_apache>4-4.0.1-incubating</htrace4_version_apache>
    <io_netty>4.0.29.Final</io_netty>
    <metric_core>2.2.0</metric_core>
</properties>
<packaging>war</packaging>
<dependencies>
    <dependency>
        <groupId>com.visa.data.tranhist</groupId>
        <artifactId>tranhist-svc-common</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>com.visa.cdisi.common</groupId>
        <artifactId>CDISICommon</artifactId>
        <version>18.1</version>
        <!--<scope>system</scope> <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/CDISICommon-1.0.jar</systemPath> -->
    </dependency>
    <dependency>
        <groupId>aopalliance</groupId>
        <artifactId>aopalliance</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.9</version>
    </dependency>
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
    </dependency>
    <!-- 0.1? 1.0 -->

    <dependency>
        <groupId>commons-configuration</groupId>
        <artifactId>commons-configuration</artifactId>
        <version>1.6</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.2</version>
    </dependency>
    <!-- NOT MATCH -->
    <dependency>

        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>12.0.1</version>
    </dependency>
    <!-- hadoop jars -->
<dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-auth</artifactId>
        <version>${hadoop_version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>${hadoop_version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-client</artifactId>
        <version>${hbase_version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-common</artifactId>
        <version>${hbase_version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-hadoop2-compat</artifactId>
        <version>${hbase_version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-protocol</artifactId>
        <version>${hbase_version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.zookeeper</groupId>
        <artifactId>zookeeper</artifactId>
        <version>${zookeeper_version}</version>
    </dependency>
    <!-- <dependency>
        <groupId>org.htrace</groupId>
        <artifactId>htrace-core</artifactId>
        <version>${htrace_version_cloudera}</version>
    </dependency>
  <dependency>
        <groupId>org.apache.htrace</groupId>
        <artifactId>htrace-core4</artifactId>
        <version>${htrace4_version_apache}</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/htrace-core${htrace4_version_apache}.jar</systemPath>
    </dependency> -->
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-all</artifactId>
        <version>${io_netty}</version>
        <!-- <scope>system</scope>
        <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/netty-all-${io_netty}.jar</systemPath> -->
    </dependency>

    <dependency>
        <groupId>com.yammer.metrics</groupId>
        <artifactId>metrics-core</artifactId>
        <version>${metric_core}</version>
        <!-- <scope>system</scope>
        <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/metrics-core-${metric_core}.jar</systemPath> -->
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>1.8.8</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.8.8</version>
    </dependency>
    <!-- visa artifatory does not have it -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20140107</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/json-20140107.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>kxml2</groupId>
        <artifactId>kxml2</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>
    <!-- visa artifatory does not have it -->
    <!-- <dependency> <groupId>io.netty</groupId> <artifactId>netty</artifactId> 
        <version>3.6.6.Final</version> <scope>system</scope> <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/netty-3.6.6.Final.jar</systemPath> 
        </dependency> -->
    <!-- spring jars -->

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <!-- dependency> <groupId>org.springframework</groupId> <artifactId>spring-asm</artifactId> 
        <version>4.0.0.RELEASE</version> </dependency -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-instrument-tomcat</artifactId> 
        <version>3.0.5.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> 
        <artifactId>spring-instrument</artifactId> <version>3.0.5.RELEASE</version> 
        </dependency> -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-oxm</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <!-- mis match -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>

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

    <!-- Micrometer Integration -->
    <dependency>
        <groupId>io.micrometer</groupId>
        <artifactId>micrometer-registry-influx</artifactId>
        <version>1.0.1</version>
    </dependency>

    <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java</artifactId>
        <version>2.5.0</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.5</version>
    </dependency>
    <!-- visa artifatory does not have it -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.5</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/slf4j-log4j12-1.7.5.jar</systemPath>
    </dependency>
    <!-- mismatch name -->

    <dependency>
        <groupId>com.atomikos</groupId>
        <artifactId>transactions-jta</artifactId>
        <version>3.9.3</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/transactions-osgi-3.9.3.jar</systemPath>
    </dependency>

    <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>1.8.6</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-jms_1.1_spec</artifactId>
        <version>1.1.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-core</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib-nodep</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.18.1-GA</version>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>1.10.19</version>
    </dependency>
    <dependency>
        <groupId>org.objenesis</groupId>
        <artifactId>objenesis</artifactId>
        <version>2.4</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
    </dependency>
</dependencies>

<build>
    <!--<finalName>${project.artifactId}-${project.version}-${maven.build.timestamp} 
        </finalName> -->
    <testSourceDirectory>src/test/java</testSourceDirectory>
    <resources>
        <resource>
            <directory>src/main/webapp</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>

        <!-- <resource> <directory>src/main/webapp</directory> <filtering>true</filtering> 
            </resource> -->

    </resources>

    <!--<filters> <filter>${basedir}/target/filter.properties</filter> </filters> -->




    <plugins>
        <!--<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> 
            <executions> <execution> <phase>generate-resources</phase> <goals> <goal>run</goal> 
            </goals> <configuration> <tasks> <mkdir dir="${project.build.directory}"/> 
            <tstamp> <format property="last.updated" pattern="yyyy-MM-dd hh:mm:ss"/> 
            </tstamp> <echo file="${basedir}/target/filter.properties" message="build.time=${last.updated}"/> 
            </tasks> </configuration> </execution> </executions> </plugin> -->

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>


        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <webXml>src\main\webapp\WEB-INF\web.xml</webXml>
                <!-- <useDefaultManifestFile>true</useDefaultManifestFile> -->
                <archive>
                    <manifestEntries>
                        <Specification-Title>${project.name}</Specification-Title>
                        <Specification-Version>${project.version}</Specification-Version>
                        <Implementation-Version>${build.number}</Implementation-Version>
                        <Build-Time>${maven.build.timestamp}</Build-Time>
                    </manifestEntries>
                </archive>

            </configuration>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.9</version>
            <executions>
                <execution>
                    <id>jacoco-initialize</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>jacoco-site</id>
                    <phase>package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>



    </plugins>
</build>
<profiles>
    <profile>
        <id>jenkins</id>
        <activation>
            <property>
                <name>env.BUILD_NUMBER</name>
            </property>
        </activation>
        <build>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>pre-unit-test</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
        <reporting>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>findbugs-maven-plugin</artifactId>
                    <version>${findbugs-maven-plugin.version}</version>
                    <configuration>
                        <findbugsXmlOutput>true</findbugsXmlOutput>
                        <xmlOutput>true</xmlOutput>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <configuration>
                        <failsOnError>false</failsOnError>
                        <includeResources>false</includeResources>
                        <includeTestResources>false</includeTestResources>
                    </configuration>
                    <reportSets>
                        <reportSet>
                            <reports>
                                <report>checkstyle-aggregate</report>
                            </reports>
                        </reportSet>
                    </reportSets>
                </plugin>
            </plugins>
        </reporting>
    </profile>
    <profile>
        <id>sonar-dp</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <sonar.host.url>http://code.dp.visa.com</sonar.host.url>
            <sonar.login>e3f4fd30ef422b7faed0b8c375a8d7c451ea3c13</sonar.login>
            <sonar.projectName> cdisi.applepayRegistration </sonar.projectName>
            <sonar.exclusions>src/main/java/com/visa/applepay/domain/*,src/main/java/com/visa/applepay/registration/util/ServiceConstants</sonar.exclusions>
        </properties>
    </profile>
    <profile>
        <id>sonar-dev</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <sonar.host.url>http://sl73jnksapd001/sonarqube-dpd/</sonar.host.url>
            <sonar.login>58286b69ecab775b52f213cb0bc460cff46de901</sonar.login>
        </properties>
    </profile>
    <profile>
        <id>sonar-local</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <sonar.host.url>http://localhost:9000/</sonar.host.url>
        </properties>
    </profile>
</profiles>
<!-- <properties> <maven.build.timestamp.format>yyyy-MM-dd-HH-mm-SS</maven.build.timestamp.format> 
    </properties> -->
<distributionManagement>
    <snapshotRepository>
        <id>artifactory.trusted.visa.com</id>
        <name>lta_tran_hist-snapshots</name>
        <url>http://artifactory.trusted.visa.com:8080/lta_tran_hist-snapshots</url>
    </snapshotRepository>
</distributionManagement>
我也尝试过添加,但没有成功。我无法找出问题所在,因为我刚刚克隆了一个正常工作的webApp。感谢您的帮助

<dependency>
    <groupId>org.apache.geronimo.specs</groupId>
    <artifactId>geronimo-jms_1.1_spec</artifactId>
    <version>1.1.1</version>
    <scope>provided</scope>
</dependency>
您声明运行应用程序的环境负责提供JMS API。但现在,你有:

嵌套异常为java.lang.NoClassDefFoundError: javax/jms/ObjectMessage

显然,您的运行环境(即Tomcat)尚未配置好以提供JMS功能

最可能的情况是,当您的应用程序工作正常时,它被部署到JavaEE应用程序服务器,默认情况下,该服务器将支持JMS。但是,您现在正在将该应用程序部署到Tomcat,它不提供现成的JMS


因此,您必须首先将Tomcat配置为支持JMS,例如,参考或使用已经支持JMS的应用程序服务器。

此错误堆栈跟踪清楚地显示,Bean myService不是由Spring管理的,检查myService类是否具有控制器或Service Spring注释如果您的项目将其他项目用作依赖项,请使用.m2目录中的settings.xml检查其他存储库访问。检查.m2目录中您所在学院的setting.xml。