I'm trying to develop an EJB application using Netbeans 8 on a Postgres 9.2 db and Glassfish 4 server.
Once I created connection pool and JDBC resources in the glassfish admin panel, I'm not able to add entities using the datasource. Netbeans still giving me an error:
The name of the driver class for the datasource is missing
I've already tried adding libraries to the project. I copied postgresql-9.2-1002.jdbc4.jar and postgresql-9.2-1002.jdbc3.jar files in
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 connection created before(in NB Services/Databases), it works, but result set after any query is empty. Any idea?
Here the connection pool I created: http://imageshack.com/a/img838/8286/bkw8.png
This is my persistence.xml:
<?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>
Apologies for being straightforward, but I believe that on this specific situation, you are all wrong. What should be done is:
Add the following properties by clicking every time on the button Add Property (After selecting the pool name and editing it):
Set up your JDBC Resources [jdbc/your_pool_name]
Save everything (The button usually is on the upper-right corner of your Internet browser) Don't forget that the JDBC Resources is always connected to a connection pool. So ensure that it is the case for you. They, JDBC Connection Pools and JDBC Resources, are usually located under JDBC in the left pane menu of your server administration panel. Go back to whatever you were doing, and try again. Please also note that this works for MySQL Database Management Systems. You might need to change the driver class as well as the URL if using another DBMS. You may find additional information on YouTube [http://www.youtube.com/].
I believe this is the answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With