Arquillian没有找到课程

时间:2015-10-12 07:50:52

标签: java glassfish jboss-arquillian

我设置了一个arquillian测试来测试我的EJB和JPA层:

@RunWith(Arquillian.class)
public class ClientTest {

    @EJB
    private ClientService client;

    @Deployment
    public static Archive<?> createDeployment() {

        return ShrinkWrap.create(WebArchive.class, "test.war")
                .addPackage(Client.class.getPackage())
                .addPackage(ClientService.class.getPackage())
                .addPackage(Client_.class.getPackage())
                .addAsLibrary(new File("C:\\...\\ojdbc6.jar"))
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                .addAsManifestResource("test-persistence.xml", "persistence.xml");
    }

    @Test
    public void testCreate() {
        Assert.assertNotNull("Client not null", client);
        Client c = client.getClientById(1L);
        assertNotNull(c);
    }
}

现在,日志告诉我找不到类:

Okt 12, 2015 9:43:17 AM org.glassfish.weld.BeanDeploymentArchiveImpl handleEntry
WARNUNG: Error while trying to load Bean Class WEB-INF.classes.com.xyz.aip.common.AbstractEntity : java.lang.ClassNotFoundException: WEB-INF.classes.com.xyz.aip.common.AbstractEntity
Okt 12, 2015 9:43:17 AM org.glassfish.weld.BeanDeploymentArchiveImpl handleEntry
WARNUNG: Error while trying to load Bean Class WEB-INF.classes.com.xyz.aip.common.AbstractEntity_ : java.lang.ClassNotFoundException: WEB-INF.classes.com.xyz.aip.common.AbstractEntity_

我查看了生成的WAR文件,并且有一个

- META-INF
- WEB-INF
 - classes
  - com
   - xyz
    - aip
     - common
      - AbstractEntity.class

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我会尝试的是:

.addPackage(Client.class.getPackage().getName())