Java, JPA, Glassfish, Invalid resource : jdbc/__default__pm

后端 未结 8 937
不知归路
不知归路 2020-12-02 17:32

I use Glassfish 3.1.2.2 (build 5), JPA, EclipseLink, MySQL

I created MySQL pool via Glassfish admin panel. Ping to MySQL from GF admin panel is ok.

I created

8条回答
  •  一生所求
    2020-12-02 17:54

    I had the same problem and I firmly believe it is caused by some remainig-cache.

    Just after I've done

    asadmin remove-domain domain1
    asadmin create-domain domain1 
    firefox http://localhost:4848 
    

    Now __pm is not appended anymore to JDBC resources.

    if this does not help, then I assume that you are using

    @PersistenceContext
    EntityManager em;
    

    this should be replaced with e.g.

    em=Persistence.createEntityManagerFactory("DefaultPU(PUT_PERSISTANCE_UNIT_NAME_HERE").createEntityManager();
    String ret="Hello " + txt + ", "+ em.createNamedQuery("Usertable.findAll").getResultList().get(0).toString() +" !" ;
    em.close();
    

提交回复
热议问题