gpt4 book ai didi

java - Arquillian 找不到类

转载 作者:太空宇宙 更新时间:2023-11-04 13:20:48 28 4
gpt4 key购买 nike

我设置了 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

有什么想法吗?

最佳答案

我会尝试的是:

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

关于java - Arquillian 找不到类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33075865/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com