Missing driver class name for data source (Netbeans + PostgreSql + Glassfish)

I am trying to develop an EJB application using Netbeans 8 on a Postgres 9.2 db server and Glassfish 4.

After I created the connection pool and JDBC resources in the glassfish admin panel, I cannot add entities using the data source. NetBeans still gives me an error:

Missing driver class name for data source

I already tried to add libraries to the project. I copied the files postgresql-9.2-1002.jdbc4.jar and postgresql-9.2-1002.jdbc3.jar to the folder C:\Program Files\glassfish-4.0\glassfish\domains\domain1\lib folder.

Screenshot: http://imageshack.com/a/img843/6884/w3ko.png

If I create entities using a previously created connection (in NB Services / Databases), it works, but the result set after any query becomes empty. Any idea?

Here is the connection pool I created: http://imageshack.com/a/img838/8286/bkw8.png

This is my persistence.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="Esempio-ejbPU" transaction-type="JTA">
    <jta-data-source>try_</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="javax.persistence.schema-generation.database.action" value="create"/>
    </properties>
  </persistence-unit>
</persistence>
+8
source share
8 answers

Solved: this is a connection pool problem. Creating a driver in the Glassfish admin panel I have no more problems.

-1
source

I apologize for the simplicity, but I believe that in this particular situation you are all wrong. What needs to be done is:

  • Glassfish ( : http://localhost: 4848/common/index.jsf ( " ")
    • Netbeans
    • [ ]
    • View Domain Admin Console [: , . , . , , , .]
  • JDBC
  • JDBC
  • , ( ):

    • driverClass: com.mysql.jdbc.Driver
    • URL: jdbc: mysql://localhost/your_database_name
    • : _
    • _: localhost your_server_name
    • user: root your_username
    • Databasename: your_database_name
  • JDBC [jdbc/your_pool_name]

  • , , .

( -). , JDBC . , . , JDBC JDBC, JDBC . , , . , MySQL. , , URL- . YouTube [ http://www.youtube.com/].

, .

+9

, JAR JDBC- Glassfish, NetBeans.

JAR NetBean EXT. : "C:\Program Files\NetBeans 8.0.1\ide\modules\ext"

JDBC, :

  • NetBeans "" > "", "" .
  • node
  • "" node " ..."
  • " JDBC" "...", " ".
  • EXT, JAR JAR.
  • OK.
  • .

" Entity ", . , , :

  • node .
  • "" " Entity ".
  • , " ".
  • .
  • Entity .

!

+2

:

  • .
  • Netbeans ( → )
  • Entity
  • NetBeans
  • Glassfish → JDBC ( ).
+1

, :

  • , Jboss Glassfish. Netbeans Eclipse.

  • , :

    • ( "Netbeans: from Services" , "" ).
    • ( "Netbeans: from Services", " ", " " " " , URL- JDBC , "" )
0

jar "{$ installation_folder}\NetBeans 8.0.1\ide\modules\ext"

0

Glassfish Derby ( JDBC) "org.apache.derby.jdbc.ClientDataSource"

0

In the properties of the connection pool, in the URL property do not forget "localhost"

-1
source

Source: https://habr.com/ru/post/1537785/


All Articles