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

后端 未结 8 933
不知归路
不知归路 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:46

    I had the same problem.

    The solution (for anybody that still have this issue):

    1. if you are using the NetBeans IDE 8.1 with Glassfish 4.1.1, I advise you to change it to Glassfish 4.1

    2. Go to the left panel in NetBeans.

    Click on services > server > glassfish then right-click (in Glassfish server) and choose view domain admin console, a web page should show up.

    Go to the left and choose resources > JDBC and JDBC connection pool.

    Add a new connection pool by clicking on new, type the name of your pool.

    Next, choose the javax.sql.ConnectionPoolDataSource and the datadriver (in my case is MySQL) and click next.

    After that, you should enter all the needed information for your database.

    1. Go back to Resources > JDBC. This time, JDBC Resources create a new JDBC resources (for me, I named it jdbc/test). Don't forget to link it with the connection pool you already created.

    2. In NetBeans go to your ejb project and modify the persistence.xml file. Change the datasource to the database resource (in my case jdbc/test) and save all.

    That should work.

提交回复
热议问题