[RESOLU] [TP12] IllegalArgumentException: Unknown entity
Publié : 16 janv. 2017 21:29
I finished all the building of the Entity beans and DAOs.
and when I ran the testcase, all the errors and exceptions point to one place:
java.lang.IllegalArgumentException:
Unknown entity bean class: class com.yaps.petstore.server.util.uidgen.Counter, please verify that this class has been marked with the @Entity annotation.
Even I was running the testCase<UniquelIdGeneratorTest.java>,it showed:
java.lang.IllegalArgumentException: Unknown entity bean class: class com.yaps.petstore.server.util.uidgen.Counter, please verify that this class has been marked with the @Entity annotation.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:576)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:460)
at com.yaps.petstore.server.util.persistence.AbstractDataAccessObject.findById(AbstractDataAccessObject.java:130)
at com.yaps.petstore.server.util.persistence.AbstractDataAccessObject.select(AbstractDataAccessObject.java:171)
at com.yaps.petstore.server.util.uidgen.UniqueIdGeneratorTest.findName(UniqueIdGeneratorTest.java:77)
at com.yaps.petstore.server.util.uidgen.UniqueIdGeneratorTest.testUtilUniqueId(UniqueIdGeneratorTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
and the Counter class is given, I do not change anything of it.
and I checked the persistence.xml, I also saw the definition of it.(I do not change it either)
Why the Counter class can not be recoginzed ?
Thanks for your advice.
and when I ran the testcase, all the errors and exceptions point to one place:
java.lang.IllegalArgumentException:
Unknown entity bean class: class com.yaps.petstore.server.util.uidgen.Counter, please verify that this class has been marked with the @Entity annotation.
Even I was running the testCase<UniquelIdGeneratorTest.java>,it showed:
java.lang.IllegalArgumentException: Unknown entity bean class: class com.yaps.petstore.server.util.uidgen.Counter, please verify that this class has been marked with the @Entity annotation.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:576)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:460)
at com.yaps.petstore.server.util.persistence.AbstractDataAccessObject.findById(AbstractDataAccessObject.java:130)
at com.yaps.petstore.server.util.persistence.AbstractDataAccessObject.select(AbstractDataAccessObject.java:171)
at com.yaps.petstore.server.util.uidgen.UniqueIdGeneratorTest.findName(UniqueIdGeneratorTest.java:77)
at com.yaps.petstore.server.util.uidgen.UniqueIdGeneratorTest.testUtilUniqueId(UniqueIdGeneratorTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
and the Counter class is given, I do not change anything of it.
and I checked the persistence.xml, I also saw the definition of it.(I do not change it either)
Why the Counter class can not be recoginzed ?
Thanks for your advice.