Java Can';t在JBoss6上部署Maven jar(MDB)

Java Can';t在JBoss6上部署Maven jar(MDB),java,maven-2,ejb-3.0,jboss6.x,message-driven-bean,Java,Maven 2,Ejb 3.0,Jboss6.x,Message Driven Bean,我在应用程序中使用jboss6、消息驱动bean、hibernate和maven2。当我尝试使用maven2编译mdb并在jboss6上部署时,出现以下错误: Failed to create Resource MessageBean.jar - cause: java.lang.Exception:Failed to start deployment [vfs:///opt/jboss6/server/default/deploy/MessageBean.jar] during deploym

我在应用程序中使用jboss6、消息驱动bean、hibernate和maven2。当我尝试使用maven2编译mdb并在jboss6上部署时,出现以下错误:

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>

4.0.0
com.mycompany
MessageBean
ejb
1.0-快照
MessageBeanJavaEE6EJB
http://maven.apache.org
log4j
log4j
1.2.12
org.jboss.ejb3
jboss-ejb3-timerservice-spi
1.0.4
org.hibernate
冬眠
3
罐子
编译
org.jboss.ejb3
jboss-ejb3-ext-api
1.0.0
org.slf4j
jcl-over-slf4j
1.5.6
测试
org.slf4j
slf4j api
1.5.6
测试
爪哇
JavaEEAPI
6
罐子
假如
爪哇
JavaEEAPI
6
假如
朱尼特
朱尼特
3.8.2
测试
java.net2
Net Maven2存储库,托管javaee api依赖项
http://download.java.net/maven/2
jboss公共存储库组
JBoss公共Maven存储库组
https://repository.jboss.org/nexus/content/groups/public-jboss/
违约
真的
从未
真的
从未
jboss
http://repository.jboss.com/maven2
真的
假的
jboss快照
http://snapshots.jboss.org/maven2
真的
真的
org.apache.maven.plugins
maven编译器插件
2.0.2
1.6
1.6
org.apache.maven.plugins
maven ejb插件
2.1
3.1
org.apache.maven.plugins
maven编译器插件
2.3.2
1.6
1.6
maven编译器插件
1.5
1.5
maven战争插件
2
MessageBean
认可
sun.boot.class.path
org.apache.maven.plugins
maven编译器插件
2.0.2
爪哇
javaee认可的api
6
我现在还没有在我的应用程序中使用ejb3定时器

有什么问题吗?
请提供帮助:(

在部署.jar时,某些东西已经实例化了
TimerServiceFactory

检查您的依赖关系,我曾经遇到过类似的问题,我作为maven依赖关系使用的一个JAR在其META-INF文件夹中实际上有一个jboss.xml,并且正在将我正在使用的bean绑定到我已经使用的JNDI名称

搜索依赖项是一件痛苦的事情,但这看起来与某些东西相冲突

您的一个依赖项可能依赖于较旧版本的
interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory
,并且它在您之前被实例化

检查.m2文件夹,查看是否下载了jboss-ejb3-timerservice-spi的两个版本。

密度“jboss-ejb3-timerservice-spi”很可能是您的问题。不确定您为什么需要依赖它,但您肯定不应该在部署中包含它。如果出于某种原因确实需要它作为依赖项,则应将其标记为作用域“提供”。所有这些jboss依赖项以及jboss lib目录中的任何其他JAR都应标记为作用域“提供”。通常,您的应用程序不应包含任何属于jboss服务器的JAR