Estou implementando um Web Services REST com o NetBeans.
Montei o BD e criei o Web Services (endereço do tutorial para criar o WS: http://www.netbeans.org/kb/60/websvc/rest-tomcat_pt_BR.html), no entanto quando vou testar está dando erro no toplink com o mapeamento das classes. Não sei o que é este erro, já que antes não estava dando tal erro. (Penso que o problema possa ser com o NetBeans)....
/* * PersistenceService.java * * Created on 4 de Agosto de 2008, 10:27 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */packageservice;importjavax.persistence.EntityManagerFactory;importjavax.persistence.EntityManager;importjavax.persistence.EntityTransaction;importjavax.persistence.Persistence;importjavax.persistence.Query;/** * Utility class for dealing with persistence. * * @author Rafael */publicclassPersistenceService{privatestaticStringDEFAULT_PU="AgendaWebServicePU";privatestaticThreadLocal<PersistenceService>instance=newThreadLocal<PersistenceService>(){protectedPersistenceServiceinitialValue(){returnnewPersistenceService(DEFAULT_PU);}};privateEntityManagerFactoryemf;privateEntityManagerem;privatePersistenceService(StringpuName){try{this.emf=Persistence.createEntityManagerFactory(puName);this.em=emf.createEntityManager();}catch(RuntimeExceptionex){if(emf!=null){emf.close();}throwex;}}/** * Returns an instance of PersistenceService. * * @return an instance of PersistenceService */publicstaticPersistenceServicegetInstance(){returninstance.get();}privatestaticvoidremoveInstance(){instance.remove();}/** * Refreshes the state of the given entity from the database. * * @param entity the entity to refresh */publicvoidrefreshEntity(Objectentity){em.refresh(entity);}/** * Merges the state of the given entity into the current persistence context. * * @param entity the entity to merge * @return the merged entity */public<T>TmergeEntity(Tentity){return(T)em.merge(entity);}/** * Makes the given entity managed and persistent. * * @param entity the entity to persist */publicvoidpersistEntity(Objectentity){em.persist(entity);}/** * Removes the entity instance. * * @param entity the entity to remove */publicvoidremoveEntity(Objectentity){em.remove(entity);}/** * Resolves the given entity to the actual entity instance in the current persistence context. * * @param entity the entity to resolve * @return the resolved entity */public<T>TresolveEntity(Tentity){entity=mergeEntity(entity);em.refresh(entity);returnentity;}/** * Returns an instance of Query for executing a named query. * * @param query the named query * @return an instance of Query */publicQuerycreateNamedQuery(Stringquery){returnem.createNamedQuery(query);}/** * Returns an instance of Query for executing a query. * * @param query the query string * @return an instance of Query */publicQuerycreateQuery(Stringquery){returnem.createQuery(query);}/** * Begins a resource transaction. */publicvoidbeginTx(){EntityTransactiontx=em.getTransaction();if(!tx.isActive()){tx.begin();}}/** * Commits a resource transaction. */publicvoidcommitTx(){EntityTransactiontx=em.getTransaction();if(tx.isActive()){tx.commit();}}/** * Rolls back a resource transaction. */publicvoidrollbackTx(){EntityTransactiontx=em.getTransaction();if(tx.isActive()){tx.rollback();}}/** * Closes this instance. */publicvoidclose(){if(em!=null&&em.isOpen()){rollbackTx();em.close();}if(emf!=null&&emf.isOpen()){emf.close();}removeInstance();}}