Maven java.lang.ClassFormatError:类文件javax/ejb/TimerConfig中非本机或抽象的方法中缺少代码属性

Maven java.lang.ClassFormatError:类文件javax/ejb/TimerConfig中非本机或抽象的方法中缺少代码属性,maven,junit4,ejb-3.1,Maven,Junit4,Ejb 3.1,我有一个EJB类,它使用EJB的TimerService和TimerConfig创建计时器 当我运行junit测试类时,会看到以下错误: java.lang.ClassFormatError:类文件javax/ejb/TimerConfig中非本机或抽象的方法中缺少代码属性 我正在为ejb使用以下maven依赖项: <dependency> <groupId>javax</groupId> <artifactId>javaee-api

我有一个EJB类,它使用EJB的TimerService和TimerConfig创建计时器

当我运行junit测试类时,会看到以下错误:

java.lang.ClassFormatError:类文件javax/ejb/TimerConfig中非本机或抽象的方法中缺少代码属性

我正在为ejb使用以下maven依赖项:

<dependency>
   <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <scope>provided</scope>
</dependency>
<dependency>
   <groupId>org.glassfish</groupId>
   <artifactId>javax.ejb</artifactId>
   <version>3.1.1</version>
   <scope>test</scope>
</dependency>

爪哇
JavaEEAPI
假如
玻璃鱼
javax.ejb
3.1.1
测试

关于如何解决这个问题的任何建议???

来自javax的类中的方法:javaeeapi依赖项是空壳-它们没有真正的实现。这些类只用于编译,不用于运行时

为了执行,需要真正的实现。由于GlassFish仍在使用,因此使用以下依赖项是合适的解决方案:

<dependency>
    <groupId>org.glassfish.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>3.1.1</version>
    <scope>test</scope>
</dependency>

org.glassfish.extras
玻璃鱼嵌入所有
3.1.1
测试