2016-04-22 134 views
0

我已經經過調研拋出java.lang.ClassNotFoundException:

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

     <dependency> 
      <groupId>commons-logging</groupId> 
      <artifactId>commons-logging</artifactId> 
      <version>1.1.1</version> 
     </dependency> 

罐子

的屏幕截圖添加在pom.xml文件下面依賴於服務器啓動org.springframework.web.method.support.CompositeUriComponentsContributor

enter image description here

而且我仍然有上述錯誤。請問有什麼可能是錯的?

+0

你是否創建了一個包含上述依賴關係的war文件? – khmarbaise

+0

我用maven build – Blaze

+0

這個類應該是spring-web Project的一部分。你可以驗證罐子是否在類路徑中 – Jens

回答

-1
<?xml version="1.0" encoding="UTF-8"?> 
<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>bookstore</groupId> 
    <artifactId>bookstore</artifactId> 
    <name>bookstore</name> 
    <packaging>war</packaging> 
    <version>1.0.0-BUILD-SNAPSHOT</version> 
    <properties> 
     <java-version>1.8</java-version> 
     <org.springframework-version>4.0.3.RELEASE</org.springframework-version> 
     <spring.security.version>4.0.3.RELEASE</spring.security.version> 
     <org.aspectj-version>1.7.4</org.aspectj-version> 
     <org.slf4j-version>1.7.5</org.slf4j-version> 
     <hibernate.version>4.3.5.Final</hibernate.version> 
    </properties> 
    <dependencies> 
     <!-- Spring --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context</artifactId> 
      <version>${org.springframework-version}</version> 
      <exclusions> 
       <!-- Exclude Commons Logging in favor of SLF4j --> 
       <exclusion> 
        <groupId>commons-logging</groupId> 
        <artifactId>commons-logging</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-log4j12</artifactId> 
      <version>${slf4j-version}</version> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-webmvc</artifactId> 
      <version>${org.springframework-version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-api</artifactId> 
      <version>1.6.4</version> 
     </dependency> 

     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-log4j12</artifactId> 
      <version>1.6.4</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-tx</artifactId> 
      <version>${org.springframework-version}</version> 
     </dependency> 

     <!-- Hibernate --> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>${hibernate.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-entitymanager</artifactId> 
      <version>${hibernate.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-web</artifactId> 
      <version>${spring.security.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-config</artifactId> 
      <version>${spring.security.version}</version> 
     </dependency> 

     <!-- Apache Commons DBCP --> 
     <dependency> 
      <groupId>commons-dbcp</groupId> 
      <artifactId>commons-dbcp</artifactId> 
      <version>1.4</version> 
     </dependency> 
     <!-- Spring ORM --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-orm</artifactId> 
      <version>${org.springframework-version}</version> 
     </dependency> 

     <!-- AspectJ --> 
     <dependency> 
      <groupId>org.aspectj</groupId> 
      <artifactId>aspectjrt</artifactId> 
      <version>${org.aspectj-version}</version> 
     </dependency> 

     <!-- Logging --> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-api</artifactId> 
      <version>${org.slf4j-version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>jcl-over-slf4j</artifactId> 
      <version>${org.slf4j-version}</version> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-log4j12</artifactId> 
      <version>${org.slf4j-version}</version> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
      <exclusions> 
       <exclusion> 
        <groupId>javax.mail</groupId> 
        <artifactId>mail</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>javax.jms</groupId> 
        <artifactId>jms</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>com.sun.jdmk</groupId> 
        <artifactId>jmxtools</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>com.sun.jmx</groupId> 
        <artifactId>jmxri</artifactId> 
       </exclusion> 
      </exclusions> 
      <scope>compile</scope> 
     </dependency> 

     <!-- @Inject --> 
     <dependency> 
      <groupId>javax.inject</groupId> 
      <artifactId>javax.inject</artifactId> 
      <version>1</version> 
     </dependency> 
     <dependency> 
      <groupId>cglib</groupId> 
      <artifactId>cglib</artifactId> 
      <version>2.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.aspectj</groupId> 
      <artifactId>aspectjweaver</artifactId> 
      <version>1.6.11</version> 
     </dependency> 
     <!-- Servlet --> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>servlet-api</artifactId> 
      <version>2.5</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet.jsp</groupId> 
      <artifactId>jsp-api</artifactId> 
      <version>2.1</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>jstl</artifactId> 
      <version>1.2</version> 
     </dependency> 

     <!-- Test --> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.7</version> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-ehcache</artifactId> 
      <version>4.3.8.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>net.sf.ehcache</groupId> 
      <artifactId>ehcache-core</artifactId> 
      <version>2.6.10</version> 
     </dependency> 
     <dependency> 
      <groupId>org.codehaus.jackson</groupId> 
      <artifactId>jackson-mapper-asl</artifactId> 
      <version>1.9.13</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.activemq</groupId> 
      <artifactId>activemq-spring</artifactId> 
      <version>5.10.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-jms</artifactId> 
      <version>4.0.3.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.activemq</groupId> 
      <artifactId>activemq-kahadb-store</artifactId> 
      <version>5.13.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.activemq</groupId> 
      <artifactId>activemq-broker</artifactId> 
      <version>5.13.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.activemq</groupId> 
      <artifactId>activemq-all</artifactId> 
      <version>5.1.0</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-jms</artifactId> 
      <version>3.1.0.RELEASE</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.caucho</groupId> 
      <artifactId>hessian</artifactId> 
      <version>4.0.7</version> 
     </dependency> 


    </dependencies> 
    <build> 
     <plugins> 
      <plugin> 
       <artifactId>maven-eclipse-plugin</artifactId> 
       <version>2.9</version> 
       <configuration> 
        <additionalProjectnatures> 
         <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature> 
        </additionalProjectnatures> 
        <additionalBuildcommands> 
         <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand> 
        </additionalBuildcommands> 
        <downloadSources>true</downloadSources> 
        <downloadJavadocs>true</downloadJavadocs> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.5.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
        <compilerArgument>-Xlint:all</compilerArgument> 
        <showWarnings>true</showWarnings> 
        <showDeprecation>true</showDeprecation> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <version>1.2.1</version> 
       <configuration> 
        <mainClass>org.test.int1.Main</mainClass> 
       </configuration> 
      </plugin> 
     </plugins> 
     <finalName>bookstore</finalName> 
    </build> 
</project> 
+0

採取上述pom.xml並複製到你做一個maven>更新項目和運行爲> maven build – LearningPhase

+0

我應該overrite我的現有pom.xml與上述 – Blaze

+0

是的但在此之前,使舊的副本,並保持安全 – LearningPhase

相關問題