Glassfish error log
Caused by: java.lang.IllegalArgumentException: NamedQuery of name: InstantMessage.findAll not found. at org.eclipse.persistence.internal.jpa.QueryImpl.getDatabaseQueryInternal(QueryImpl.java:350) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1107) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1127) at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createNamedQuery(EntityManagerWrapper.java:545) at com.netricite.dao.InstantMessageDao.findAll2(InstantMessageDao.java:62)
Reason
the NamedQuery is not found by the entitymanager.
Mispelling check
- check persistence.xml (declare the class injecting the entity manager)
- check link between @PersistenceContext and persitence.xml (persistence_unit value)
- check the name given in the createNamedQuery statement and the name given in the @entity/@NamedQuery
Conflict check
- Check conflict between various persistence.xml used in the project, including embedded jars. (ie persistence unit value cannot be the same in different persistence.xml)