I have this error when I deploy my application in websphere portal
Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql://localhost:3306/My_dataBase'
java.lang.NoClassDefFoundError: com/mysql/jdbc/StringUtils
So can any one help me?
The errors is self-explanatory - you are missing MySQL JDBC Connector JAR in classpath (MySQL JDBC connector can be downloaded from https://dev.mysql.com/downloads/connector/j/5.0.html)
If you are using WebSphere portal, I guess you are using JDBC connections from JNDI. Then you should define MySQL JDBC provider with path pointing to MySQL JDBC driver JAR.
First copy MySQL JDBC Connector JAR on a machine where WAS is installed (e.g. /path/to/mysql-connector-java-5.0.8-bin.jar).
Implementation class name is com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
Then you define JDBC DataSource for that JDBC Provider and that's
If you are not using JDBC provided by WebSphere and use Spring to provide you with database connection, you should bundle MySQL JDBC Connector JAR with your WAR (e.g. by copying it into WEB-INF/lib or wherever your WAR lib directory is).
Another option would be to package the MySQL jdbc driver jar with your code for deployment, or to create a shared library with that driver jar path included. You would then need to create a classloader on the application server in order to load the shared library upon startup.
Related
I want to connect MySQL with Grails in Netbeans. I am using,
Grails version:3.2
Netbeans: 8.2
JDK: 1.8
OS: Windows 10
How to connect my grails project with MySQL Database in NetBeans? I have search through the internet, But could not find any way to add mysql-connector.jar or any other process.
How can I solve this problem?
you shouldn't add it manually. it is usually resolved (by convention) by adding proper dependency:
dependencies {
runtime 'mysql:mysql-connector-java:5.1.29'
}
The configuration can be maintained in either grails-app/conf/application.groovy or grails-app/conf/application.yml
More info: https://docs.grails.org/latest/guide/conf.html#dataSource
I'm trying to install OpenGTS on Red Hat's Openshift cloud platform.
OpenGTS is a Java/Tomcat7/Mysql/Ant application, so I created a JbossEWS app on Openshift, installed the standard Mysql cartridge, and an Ant cartridge I found online.
Our application does not have to be scalable, so that's what I chose.
I add a call to Ant in Openshift's build hook.
So far it has been impossible to install the jdbc driver however:
As I'm using Ant, I deleted the pom.xml for Openshift's standard Maven.
Neither is there a standalone.xml in JbossEWS. (There is one for JbossEAP).
Java's ext/lib directories are not accessible on Openshift.
So I copied the jdbc driver jar in $OPENSHIFT_DATA_DIR,
but nevertheless, when started, JbossEWS complains it cannot find a suitable jdbc driver for Mysql.
Is it even possible to run OpenGTS on Openshift?
It is comment about above question so we are following this link.
Here is the link https://blog.openshift.com/jndi-tomcat-configuration-howto/
And also catalina.properties file
common.loader=${catalina.base}/lib,${catalina.base}/lib/.jar,${catalina.home}/lib,${catalina.home}/lib/.jar,${catalina.home}/../app-root/data/*.jar
I have deployed my war file on openshift tomcat.
As suggested to deploy war file directly we need to remove the src and pom.xml before coping the war file in webapps folder. pre compiled java applications (WAR and EAR files) onto your OpenShift
Now since my application uses mysql driver - when tomcat starts on open shift it throws error of mysql driver classes not found.
How else can I add the mysql driver to openshift tomcat. Putting them in the web-inf/lib directory does not work since the datasources are configured on tomcat context.xml
The data source configuration should not matter for the mysql driver. Before tomcat8 however there are scenarios where you have to deploy the mysql driver in the tomcat/lib (sad but it works). Upgrading to Tomcat8 will get you away from that scenario.
I'm trying to deploy a war file to websphere through worklight using suse linux and a remote database.
When I tried to deploy the war file using a remote database(I'm using oracle to test), I'm getting the following error:
GetSQLQueryResult failed with error code java.sql.SQLRecoverableException: IO Error: Connection reset
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:711)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:558)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at com.ibm.worklight.install.helper.GetSQLQueryResult.main(GetSQLQueryResult.java:68)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118)
at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
I can access the remote machine database from the machine where worklight is installed.
Also, if I use the same WAR file on a local database on SUSE Linux, or use a remote database on another OS(Windows for example), the app is deployed correctly.
Something is not right with the question description...
You do not deploy .war files to Worklight
Worklight, in a remote server, is comprised of a Java EE .jar file, deployed to the application server (WAS/Liberty profile, Tomcat)
A .war file, in Worklight, is a Java web app containing server-related artifacts required for running your application (generated by the Studio/CLI tool); you deploy this .war file to the application server where Worklight Server is deployed to
That said,
A connection reset means there is a general network issue and is not related to Worklight itself.
It sounds like a network issue with the specific machine running Suse Linux.
- Check firewall settings, timeout values, blocked ports...
I am trying to create a sample Spring application with JPA (MySQL DB) and Tomcat 7.0.28 under Mac OSX platform. I placed mysql-connector-java-5.1.22 jar under WEB-INF/lib folder of the application. But when I start the app, I get error mentioned in the Title. I tried to put the same jar under Tomcat lib folder as well but getting the same error.
Same application when I deployed in Glassfish server with driver jar under domain/lib/ext folder, application works fine.
Note: Glassfish was also throwing the same error without putting the driver jar under domain/lib/ext folder.
Does this How to fix: "No suitable driver found for jdbc:mysql://localhost/dbname" error when using pools? help ? Please check the second answer if you are connecting through program.