我正在尝试使用Arquiliian运行一个原始的EJB测试(如果它可以被称为基元)(我讨厌它花了6个小时就可以了)
@RunWith(Arquillian.class)
public class BookTest {
@Deployment
public static JavaArchive createDeployment() {
// explicit archive name required until ARQ-77 is resolved
return ShrinkWrap.create(JavaArchive.class, "test.jar")
.addPackage(Book.class.getPackage())
.addPackage(BookEJB.class.getPackage())
.addAsResource("META-INF/persistence.xml");
}
@EJB
BookEJB bookEJB;
@Test
public void createAndFindBookByEjbTest() throws Exception {
Book book = new Book("Cars", 10.0f, "The book of cars", "1-84023-742-2", 100, true);
Book b = bookEJB.createBook(book);
assertNotNull("ID should not be null", b.getId());
assertNotNull(bookEJB.findBookById(b.getId()));
assertEquals(1, bookEJB.findBooks().size());
}
}
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">
<defaultProtocol type="Servlet 3.0"/>
<container qualifier="wildfly-managed" default="true">
<configuration>
<property name="jbossHome">/home/abondar/wildfly-11.0.0.Final</property>
<property name="logThreshold">ERROR</property>
</configuration>
</container>
</arquillian>
我得到了这个愚蠢的例外:
抛出java.lang.ClassNotFoundException: 来自[Module]的org.abondar.experimetnal.javaeedemo.ejbdemo.test.BookTest “Service Module Loader”中的“deployment.test.war”
我该如何解决这个废话?