1

I set up a arquillian test to test my EJB and JPA layer:

@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);
    }
}

Now, the log is telling me that the classes could not be found:

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_

I looked into the generated WAR-File and there is a

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

Any ideas?

Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
matthias
  • 1,938
  • 23
  • 51
  • In which packages are `Client`, `ClientService` and `Client_` classes? – cassiomolin Oct 12 '15 at 07:53
  • since I use Client.class.getPackage()) it should be the rigt one ?! Or do I misunderstand? – matthias Oct 12 '15 at 07:56
  • maybe a duplicate of http://stackoverflow.com/questions/16437146/cannot-perform-cdi-in-glassfish-4-0 or some other bug of glassfish? at least it is quite strange that `WEB-INF.classes` seems to be part of the package – user140547 Oct 12 '15 at 08:26
  • You can always print the content of war. System.out.println(war.toString(true)); I'am also having the same problem :( – Igor Vuković Apr 07 '17 at 10:24

1 Answers1

0

what I would try is:

.addPackage(Client.class.getPackage().getName())
alex
  • 705
  • 9
  • 21