Java.lang.IllegalArgumentException: Unknown entity:

在做webservice项目时,将service工程生成jar包导入client项目后,如果两个项目的persistence.xml文件中,标签persistence-unit内 name的值相同,则会出现类似如下错误:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
十一月 04, 2014 1:18:26 下午 com.mana.Entity.EntityManagerHelper log
信息: saving Breedersscores instance
十一月 04, 2014 1:18:26 下午 com.mana.Entity.EntityManagerHelper log
严重: save failed
java.lang.IllegalArgumentException: Unknown entity: com.mana.Entity.Breedersscores
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:223)
at com.mana.Entity.BreedersscoresDAO.save(BreedersscoresDAO.java:60)
at com.mana.dao.impl.BreedersscoresDaoWsImpl.save_breedersscores(BreedersscoresDaoWsImpl.java:12)
at com.mana.operation.WSImpl.save(WSImpl.java:17)
at com.mana.test.Test.main(Test.java:14)

解决办法:修改name的值,使它们不一样!

你可能感兴趣的:(Webservice)