2011-06-10 173 views
0

我在我的應用程序中使用jboss6,消息驅動bean,hibernate和maven2,當我嘗試使用maven2編譯我的mdb並在jboss6上部署時,出現以下錯誤:無法在Jboss上部署Maven jar(MDB)6

Failed to create Resource MessageBean.jar - cause: java.lang.Exception:Failed to start deployment [vfs:///opt/jboss6/server/default/deploy/MessageBean.jar] during deployment of 'MessageBean.jar' - cause: java.lang.RuntimeException:org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS MISSING DEPENDENCIES: Deployment "jboss.j2ee:jar=MessageBean.jar,name=MessageBean,service=EJB3" is missing the following dependencies: Dependency "interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory" (should be in state "Installed", but is actually in state "Instantiated") DEPLOYMENTS IN ERROR: Deployment "interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory" is in error due to the following reason(s): Instantiated -> org.jboss.deployers.client.spi.IncompleteDeploymentException:Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS MISSING DEPENDENCIES: Deployment "jboss.j2ee:jar=MessageBean.jar,name=MessageBean,service=EJB3" is missing the following dependencies: Dependency "interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory" (should be in state "Installed", but is actually in state "Instantiated") DEPLOYMENTS IN ERROR: Deployment "interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory" is in error due to the following reason(s): Instantiated 

這裏是我的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/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.mycompany</groupId> 
    <artifactId>MessageBean</artifactId> 
    <packaging>ejb</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>MessageBean Java EE 6 EJB</name> 
    <url>http://maven.apache.org</url> 

    <dependencies> 
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.12</version> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.ejb3</groupId> 
      <artifactId>jboss-ejb3-timerservice-spi</artifactId> 
      <version>1.0.4</version> 
     </dependency> 

     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate</artifactId> 
      <version>3.0</version> 
      <type>jar</type> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.ejb3</groupId> 
      <artifactId>jboss-ejb3-ext-api</artifactId> 
      <version>1.0.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>jcl-over-slf4j</artifactId> 
      <version>1.5.6</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-api</artifactId> 
      <version>1.5.6</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax</groupId> 
      <!-- 
      <artifactId>javaee-web-api</artifactId> 
      --> 
      <artifactId>javaee-api</artifactId> 

      <version>6.0</version> 
      <!-- Added below --> 
      <type>jar</type> 
<!--      modified by varsha --> 
      <scope>provided</scope> 
      <!-- end --> 
     </dependency> 
<!--  <dependency> 
      <groupId>org.jboss.ejb3</groupId> 
      <artifactId>jboss-ejb3-ext-api-impl</artifactId> 
      <version>1.1.1</version> 
     </dependency>--> 

     <dependency> 
      <groupId>javax</groupId> 
      <artifactId>javaee-api</artifactId> 
      <version>6.0</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.2</version> 
      <scope>test</scope> 
     </dependency> 

    </dependencies> 

    <repositories> 
     <repository> 
      <id>java.net2</id> 
      <name>Java.Net Maven2 Repository, hosts the javaee-api dependency</name> 
      <url>http://download.java.net/maven/2</url> 
     </repository> 
     <repository> 
      <id>jboss-public-repository-group</id> 
      <name>JBoss Public Maven Repository Group</name> 
      <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url> 
      <layout>default</layout> 
      <releases> 
       <enabled>true</enabled> 
       <updatePolicy>never</updatePolicy> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
       <updatePolicy>never</updatePolicy> 
      </snapshots> 
     </repository> 
     <repository> 
      <id>jboss</id> 
      <url>http://repository.jboss.com/maven2</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </repository> 
     <repository> 
      <id>jboss-snapshot</id> 
      <url>http://snapshots.jboss.org/maven2</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 

    </repositories> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.0.2</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-ejb-plugin</artifactId> 
       <version>2.1</version> 
       <configuration> 
        <ejbVersion>3.1</ejbVersion> 
       </configuration> 
      </plugin> 


      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.5</source> 
        <target>1.5</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.0</version> 
      </plugin> 

<!--   <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>jboss-maven-plugin</artifactId> 
       <version>1.5.0</version> 
       <configuration> 

        <jbossHome>/opt/jboss6/server/default/deploy</jbossHome> 

        <jbossHome>/home/varsha/Downloads/jboss-6.0.0.Final/</jbossHome> 
        <serverName>default</serverName> 
        <fileName>target/MessageBean.jar</fileName> 
        <path>/UltimateSMS</path> 
       </configuration> 
      </plugin>--> 
     </plugins> 
     <finalName>MessageBean</finalName> 
    </build> 
    <profiles> 
     <profile> 
      <id>endorsed</id> 
      <activation> 
       <property> 
        <name>sun.boot.class.path</name> 
       </property> 
      </activation> 
      <build> 
       <plugins> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-compiler-plugin</artifactId> 
         <version>2.0.2</version> 
         <dependencies> 
          <dependency> 
           <groupId>javax</groupId> 
           <artifactId>javaee-endorsed-api</artifactId> 
           <version>6.0</version> 
          </dependency> 
         </dependencies> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 
</project> 

我不使用EJB3記在我的應用程序,截至目前

出了什麼問題? 請幫助:(

回答

0

在已經實例化TimerServiceFactory

檢查依賴你的.jar部署的東西時的樣子,我曾經有過類似的問題,在罐子裏的一個我作爲一個maven依賴關係在其META-INF文件夾中實際上有一個jboss.xml,並且綁定了一個我正在使用的JNDI名稱的bean,我已經在使用它。

它很痛苦地搜索你的依賴關係,但是這看起來像是與某些東西相沖突。

它可能是你的依賴之一ncies取決於舊版本的interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory,它在你的之前被實例化。

檢查您的.m2文件夾,看看您是否有2個版本的jboss-ejb3-timerservice-spi下載。

2

這個錯誤「jboss-ejb3-timerservice-spi」很可能是你的問題。不確定爲什麼你需要依賴它,但你當然不應該將它包含在你的部署中。如果你由於某種原因需要它作爲依賴項,它應該被標記爲範圍「提供」。所有這些jboss依賴項以及jboss lib目錄中的任何其他jar應該被標記爲scope「provided」。一般來說,你的應用程序不應該包含任何jboss服務器的jar包。