2010-12-01 2 views
1

У них есть древовидные модули для моего проекта, сервера, клиента и ядра. Основной модуль должен быть импортирован как зависимость jar в других модулях. На затмении я не вижу никаких предупреждений, но если я запуск приложения я получаю следующее сообщение об ошибке:Модуль Maven как зависимость от веб-приложения

Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [at.ac.tuwien.inso.verteilte.service.HelloServiceImpl] for bean with name 'helloServiceImpl' defined in ServletContext resource [/WEB-INF/appContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: at/ac/tuwien/inso/verteilte/services/IHelloService 

Caused by: java.lang.ClassNotFoundException: at.ac.tuwien.inso.verteilte.services.IHelloService 

этого интерфейс импортируется на HelloServiceImpl. HelloServiceImpl создается на бобах следующим образом:

<jaxws:endpoint id="helloService" implementorClass="at.ac.tuwien.inso.verteilte.service.HelloServiceImpl"> 

я извлекал пространства имен из-за защиты линии от StackOverflow :) Кстати, мои pom.xml являются:

для ядра:

<project> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <artifactId>verteiltepaxen-parent</artifactId> 
     <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> 
    <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
    <artifactId>core</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <name>core</name> 
    <packaging>jar</packaging> 
    <description>Verteilte Praxen - core</description> 
    <build> 
     <finalName>core-1.0-SNAPSHOT</finalName> 
    </build> 
</project> 

Сервер:

<project> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <artifactId>verteiltepaxen-parent</artifactId> 
     <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> 
    <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
    <artifactId>server</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <name>server</name> 
    <description>Verteilte Praxen - Server</description> 
    <dependencies> 
     <dependency> 
      <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
      <artifactId>core</artifactId> 
      <version>1.0-SNAPSHOT</version> 
      <type>jar</type> 
      <scope>compile</scope> 
      <exclusions> 
       <exclusion> 
        <artifactId>core</artifactId> 
        <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
    </dependencies> 
    <dependencyManagement> 
     <dependencies> 
     </dependencies> 
    </dependencyManagement> 
    <build> 
     <finalName>server-1.0-SNAPSHOT</finalName> 
    </build> 
</project> 

Клиент:

<project> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <artifactId>verteiltepaxen-parent</artifactId> 
     <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> 
    <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
    <artifactId>client</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <name>client</name> 
    <description>Verteilte Praxen - Client</description> 
    <dependencies> 
     <dependency> 
      <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
      <artifactId>core</artifactId> 
      <version>1.0-SNAPSHOT</version> 
      <type>jar</type> 
      <scope>compile</scope> 
     </dependency> 
    </dependencies> 
    <dependencyManagement> 
     <dependencies> 
     </dependencies> 
    </dependencyManagement> 
    <build> 
     <finalName>client-1.0-SNAPSHOT</finalName> 
    </build> 
</project> 

И родитель POM:

<project> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
    <artifactId>verteiltepaxen-parent</artifactId> 
    <packaging>pom</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>verteiltepaxen Maven Webapp</name> 
    <properties> 
     <cxf.version>2.2.3</cxf.version> 
     <spring.version>2.5.6.SEC02</spring.version> 
    </properties> 
    <dependencies> 
     ... other dependencies ... 
    </dependencies> 
    <repositories> 
     ... Repositories ... 
    </repositories> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-eclipse-plugin</artifactId> 
       <version>2.8</version> 
       <configuration> 
        <projectNameTemplate>verteiltepaxen-parent-1.0-SNAPSHOT</projectNameTemplate> 
        <wtpmanifest>true</wtpmanifest> 
        <wtpapplicationxml>true</wtpapplicationxml> 
        <wtpversion>2.0</wtpversion> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.0.2</version> 
       <configuration> 
        <source>1.5</source> 
        <target>1.5</target> 
        <encoding>UTF-8</encoding> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.mortbay.jetty</groupId> 
       <artifactId>maven-jetty-plugin</artifactId> 
       <version>6.1.8</version> 
       <configuration> 
        <!-- Configure the webapp --> 
        <contextPath>/verteiltepaxen</contextPath> 
       </configuration> 
      </plugin> 
     </plugins> 
     <finalName>verteiltepaxen-parent-1.0SNAPSHOT</finalName> 
    </build> 
    <modules> 
     <module>client</module> 
     <module>server</module> 
     <module>core</module> 
    </modules> 
</project> 

Спасибо вам большое за ваш помогает :)


Спасибо ваше для вашей помощи, я удалил его, но ошибка то же самое

<dependencies> 
    <dependency> 
     <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
     <artifactId>core</artifactId> 
     <version>1.0-SNAPSHOT</version> 
     <type>jar</type> 
     <scope>compile</scope> 
    </dependency> 
</dependencies> 

ответ

0

Я не уверен, что т это будет на самом деле, но в POM сервера вы перечисляете ядро ​​как зависимость, а затем и его исключения:

<dependency> 
    <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
    <artifactId>core</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <type>jar</type> 
    <scope>compile</scope> 
    <exclusions> 
     <exclusion> 
      <artifactId>core</artifactId> 
      <groupId>at.ac.inso.tuwien.verteiltepraxen</groupId> 
     </exclusion> 
    </exclusions> 
</dependency> 

Почему вы это делаете? Исключения используются, чтобы сказать Maven игнорировать некоторые зависимости, затянутые другими зависимостями в вашей сборке. Попробуйте исключить исключение.

0

Возможно, вам понадобится mvn clean install в родительском каталоге, чтобы получить свежий файл войны. В противном случае, уточните, что вы подразумеваете под «если я запускаю приложение»: используя плагин maven для причала? Развертывание в Tomcat? Что-то другое?