2 Replies Latest reply on May 31, 2011 11:01 AM by bcn

    IllegalArgumentException: Not an entity when run as test

    bcn

      Hi,

       

      I try to run a simple test in JBoss 6 with Hibernate 3.6 and EHCache 2.4.2 and added different jars to avoid classnotfound errors like

       

        WebArchive war = ShrinkWrap

          .create(WebArchive.class, "test.war")

          .addPackages(true, "com.myapp")

          .addAsManifestResource("persistence.xml",

            ArchivePaths.create("persistence.xml"))

          .addAsManifestResource("ehcache.xml",

            ArchivePaths.create("ehcache.xml"))

          .addAsLibraries(

            MavenArtifactResolver.resolveQualifiedIds(

              "net.sf.ehcache:ehcache-core:2.4.2",

              "org.richfaces.core:richfaces-core-api:4.0.0-SNAPSHOT",

              "org.richfaces.ui:richfaces-components-api:4.0.0-SNAPSHOT"))

          .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

       

      but I get:

       

      java.lang.IllegalArgumentException: Not an entity: class ....

      at org.hibernate.ejb.metamodel.MetamodelImpl.entity(MetamodelImpl.java:160)

      at org.hibernate.ejb.criteria.QueryStructure.from(QueryStructure.java:138)

      at org.hibernate.ejb.criteria.CriteriaQueryImpl.from(CriteriaQueryImpl.java:179)

       

      although the class is properly annotated and JPA works perfectly in the main application.

       

      Thanks