GlassFish not loading connector - mysql

I'm using GlassFish 3 and I can't seem to get it to recognize the MySql connector. The admin console always says:
Ping Connection Pool for --- is
Failed. Ping failed Exception - Class
name is wrong or classpath is not set
for :
com.mysql.jdbc.jdbc2.optional.MysqlDataSource
Please check the server.log for more
details.
However, JPA can connect even with the error. The only downside is that I get resize pool exceptions (null). I've even placed the connector in the following folders:
%GLASSFISH%/lib
%GLASSFISH%/domains/domain1/lib
%GLASSFISH%/domains/domain1/lib/ext
I also tried the solution at http://old.nabble.com/MySql-connector-problems,-Class-name-is-wrong-or-classpath-td21833176.html however setting class path is (unsupported in V3).
Any ideas? :(
EDIT:
Nvm... I fixed it by dropping the connector in
eclipse/plugins/oracle.eclipse.runtime.glassfish_3.1.0.0/glassfish3/glassfish/lib

Related

Run Keycloak with database contains data

i configured keycloak with mysql database and it worked,
i created a realm, user, role for test and everything was fine,
I stopped keycloak and restarted it with >standalone.bat
and i got this error:
FATAL [org.keycloak.services] (ServerService Thread Pool – 65) Error during startup: java.lang.RuntimeException: Exception invoking method [listUnrunChangeSets] on object [liquibase.Liquibase#f0132b4], using arguments [null,(),false]
ps: if i delete the database and recreate it and run keycloak it will work but run it with database contains data the error above will appear
Please help me to solve this error. Thank you.
Finally, I found the solution
at the beginning i had the newest version of mysql-connector-java it’s 8.0.23
i replaced it with an old version 8.0.21 and boom it worked for me
ps: of course I modified the file module.xml

How can I update my MySQL connection through spring to handle TLSv1.2?

I have a previously working Spring MVC project using Spring Boot, Spring JPA, Spring Data. My DBA updated the security on the MySQL server to accept only TLSv1.1 and TLSv1.2 and now my website Spring MVC won't connect to it. The website literally died the minute they put the TLS 1.2 on it, so it's my problem, with their security.
Please note that my dev box is entirely isolated. I cannot copy and paste many lines of code and have to hand type it.
First, Tried to add the SSL via the JDBC string:
jdbc:mysql://host:3306/bdd_name?useUnicode=true&characterEncoding=utf8&useSSL=true&requireSSL=true
Second, Tried to add More information (per this example):
jdbc:mysql://example.com:3306/MYDB?verifyServerCertificate=true&useSSL=true&requireSSL=true&clientCertificateKeyStoreUrl=file:cert/keystore.jks&clientCertificateKeyStorePassword=123456&trustCertificateKeyStoreUrl=file:cert/truststore.jks&trustCertificateKeyStorePassword=123456
Third, tried to add java security:
-Djavax.net.ssl.keyStore=/path/to/keystore/keystore.jks
-Djavax.net.ssl.keyStorePassword=password
-Djavax.net.ssl.trustStore=/path/to/keystore/truststore.jks
-Djavax.net.ssl.trustStorePassword=password
Fourth, tried to add via Spring properties:
server.ssl.enabled=true
server.ssl.enabled-protocols=TLSv1.2
After many attempts to get this resolved, I have a setup with 2 and 4 in place. The jdbc connection property resolves and finds my key files and unlocks them, so the URL changes (2) does work.
So, after all this, I still get:
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Caused by: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)

Unable to connect to the binlog client in NiFi

I'm building a NiFi dadaflow, and I need to get the data changes from a MySql database, so I want to use the CaptureChangeMySQL processor to do that.
I get the following error when I run the CaptureChangeMySQL processor and I don't see what's causing this :
Failed to process session due to Could not connect binlog client to any of the specified hosts due to: BinaryLogClient was unable to connect in 10000ms: org.apache.nifi.processor.exception.ProcessException: Could not connect binlog client to any of the specified hosts due to: BinaryLogClient was unable to connect in 10000ms
I have the following controller services enabled :
DistributedMapCacheClientService
DistributedMapCacheServer
But I'm not sure if they are properly configured :
DistributedMapCacheServer properties
DistributedMapCacheClientService properties
In MySql, I have enabled the log_bin variable, by default it wasn't. I checked and I have indeed some binlog files created when data change.
So I think the issue is with the controller services and how they connect, it's not clear to me.
I searched for tutorials about how to use this NiFi processor but I couldt not find how to fix this error. I looked mainly at this one : https://community.hortonworks.com/articles/113941/change-data-capture-cdc-with-apache-nifi-version-1-1.html but it did not helped me.
Does anyone have already use this processor to do CDC?
Thank you in advance.
I found what was wrong : I was trying to connect to the wrong port for the MySQL Host of the CaptureChangeMySQL processor :x
For others who are still facing similar issues, check if the firewall of the server is stopping the connection. Allow mysql 3306 in your firewall rules.

Cannot connect to MySql database from Eclipse : java/sql/SQLException

I have set up a database with MySql.
I want to connect to it from Eclipse.
I followed the same steps as mentioned in this link:
https://www.zkoss.org/wiki/Setup_MySQL_DB_in_Eclipse
So I am using this library for the driver:
mysql-connector-java-5.1.45
whhich I think is correct
The name of my database is "test" and the port used by MySql is 3306.
This is my configuration:
But when I test the connection it's giving me an error message :
"An internal error occurred during: "Ping server job". java/sql/SQLException"
I have looked more in details in the error log and I see error like this:
java.lang.NoClassDefFoundError: java/sql/Connection
I have turned off my firewall just to check, but it does not solve the issue.
Can someone tell me what I should check?
Thanks
I use Java version 1.7.0_80 and Eclipse Mars.2 Release (4.5.2).
I gave up and used MysQL Workbench which meets my needs.

GlassFish connection pool

i put mysql driver into glassfish/admin1/lib and i get this error on trying make a connection with GlassFish 3.1.2
Ping Connection Pool failed for SimpleCRUD_ConnectionPool. Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource Please check the server.log for more details.
Hare the configuration:
Pool Name: SimpleCRUD_ConnectionPool
Resource Type: javax.sql.DataSource javax.sql.XADataSource
Datasource Classname: com.mysql.jdbc.Driver
has someone any idea?
A Driver and a DataSource are not the same. It looks from your configuration that you're setting a Driver class as the DataSource classname?
Do you really need XA? Are you doing any distributed transaction?
If so, set the data source to com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
If not, select a regular DataSource type and then set the classname to com.mysql.jdbc.jdbc2.optional.MysqlDataSource
For starters, the path where you have placed your driver does not look correct. For details on administering database connectivity in Glassfish 3.1.2 please see
12 Administering Database Connectivity
Also in that guide you will find a section installing the MySQL Server Database Type 4 Driver
If you need additional help, please post a screen capture of your JDBC resource and JDBC connection pool configuration or if you used it the asadmin command you used to create it.
-Noah
No, you just lack mysql lib, just find and download mysql-connector-java-5.x.x-bin.jar copy to E:\Projects\glassfish3.1.1\glassfish\lib then restart server and enjoy !!!