2012-09-18 133 views
1

我正在嘗試通過Arquillian Getting Started指南工作。只要我使用arquillian-weld-ee嵌入式容器,一切正常。然而,當我嘗試切換到Glassfish的管理,我得到這個錯誤:Arquillian玻璃魚管理測試缺席代碼屬性錯誤

Tests in error: org.arquillian.example.GreeterTest: Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException 

我以前在Reference Guide所示的配置。

這裏是我的pom.xml:

<?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/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 

<groupId>org.arquillian.example</groupId> 
<artifactId>arquillian-tutorial</artifactId> 
<version>1.0-SNAPSHOT</version> 
<packaging>jar</packaging> 

<name>arquillian-tutorial</name> 
<url>http://maven.apache.org</url> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
</properties> 

<dependencyManagement> 
    <dependencies> 
     <dependency> 
      <groupId>org.jboss.arquillian</groupId> 
      <artifactId>arquillian-bom</artifactId> 
      <version>1.0.2.Final</version> 
      <scope>import</scope> 
      <type>pom</type> 
     </dependency> 
    </dependencies> 
</dependencyManagement> 

<build> 
    <plugins> 
     <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-surefire-plugin</artifactId> 
      <version>2.12</version> 
     </plugin> 
    </plugins> 
</build> 

<dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.8.1</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.jboss.arquillian.junit</groupId> 
     <artifactId>arquillian-junit-container</artifactId> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 

<profiles> 
    <profile> 
     <id>arquillian-weld-ee-embedded</id> 
     <dependencies> 
      <dependency> 
       <groupId>org.jboss.spec</groupId> 
       <artifactId>jboss-javaee-6.0</artifactId> 
       <version>1.0.0.Final</version> 
       <type>pom</type> 
       <scope>provided</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.jboss.arquillian.container</groupId> 
       <artifactId>arquillian-weld-ee-embedded-1.1</artifactId> 
       <version>1.0.0.CR3</version> 
       <scope>test</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.jboss.weld</groupId> 
       <artifactId>weld-core</artifactId> 
       <version>1.1.5.Final</version> 
       <scope>test</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.slf4j</groupId> 
       <artifactId>slf4j-simple</artifactId> 
       <version>1.6.4</version> 
       <scope>test</scope> 
      </dependency> 
     </dependencies> 
    </profile> 
    <profile> 
     <id>arquillian-glassfish-embedded</id> 
     <dependencies> 
      <dependency> 
       <groupId>org.jboss.arquillian.container</groupId> 
       <artifactId>arquillian-glassfish-embedded-3.1</artifactId> 
       <version>1.0.0.CR3</version> 
       <scope>test</scope> 
      </dependency> 
      <dependency> 
       <groupId>org.glassfish.main.extras</groupId> 
       <artifactId>glassfish-embedded-all</artifactId> 
       <version>3.1.2</version> 
       <scope>provided</scope> 
      </dependency> 
     </dependencies> 
    </profile> 
    <profile> 
     <id>glassfish-managed-3.1</id> 
     <dependencies> 
      <dependency> 
       <groupId>org.jboss.arquillian.container</groupId> 
       <artifactId>arquillian-glassfish-managed-3.1</artifactId> 
       <version>1.0.0.CR3</version> 
       <scope>test</scope> 
      </dependency> 
      <dependency> 
       <groupId>javax</groupId> 
       <artifactId>javaee-api</artifactId> 
       <version>6.0</version> 
       <scope>provided</scope> 
      </dependency> 
     </dependencies> 
     <build> 
      <testResources> 
       <testResource> 
        <directory>src/test/resources</directory> 
       </testResource> 
       <testResource> 
        <directory>src/test/resources-glassfish-managed</directory> 
       </testResource> 
      </testResources> 
     </build> 
    </profile> 
</profiles> 

而且我的src /測試/資源/ arquillian.xml:

<arquillian xmlns="http://jboss.org/schema/arquillian" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation=" 
    http://jboss.org/schema/arquillian 
    http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> 
<container qualifier="glassfish" default="true"> 
    <configuration> 
     <property name="glassFishHome">/opt/app/glassfish-3.1.2.2</property> 
    </configuration> 
</container> 

類招待員,PhraseBuilder和GreeterTest與上述指南相同。

編輯: 這裏是神火的報告:

 
    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.255 sec (EventTestRunnerAdaptor.java:56) 
    ... 21 more 
Caused by: java.lang.IllegalArgumentException: DeployableContainer must be specified 
    at org.jboss.arquillian.core.spi.Validate.notNull(Validate.java:44) 
    at org.jboss.arquillian.container.impl.ContainerImpl.(ContainerImpl.java:71) 
    at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:76) 
    ... 45 more 
Caused by: java.lang.reflect.InvocationTargetException 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525) 
    at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:156) 
    ... 16 more 
Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container glassfish 
    at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:85) 
    at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:76) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:601) 
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) 
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) 
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) 
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) 
    at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:236) 
    at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74) 
    at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:68) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:601) 
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) 
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) 
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) 
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) 
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) 
    at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:261) 
    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.(EventTestRunnerAdaptor.java:56) 
    ... 21 more 
Caused by: java.lang.IllegalArgumentException: DeployableContainer must be specified 
    at org.jboss.arquillian.core.spi.Validate.notNull(Validate.java:44) 
    at org.jboss.arquillian.container.impl.ContainerImpl.(ContainerImpl.java:71) 
    at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:76) 
    ... 45 more 

回答