JDBC driver class not found error in struts-hibernate integration project - java

I am working on struts-hibernate integration project. When I enter data in input JSP, the output JSP shows text result as data stored in database. But actually no data is getting stored & showing the following error:
org.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver
1 more thing I wanna ask is a new window has popped up titled as"JLoEndpoint.class" which had message as source not found with
- The JAR file C:\program files\apache-tomcat-7.0.47\lib\tomcat-coyote.jar has no source attachment. What can I do?

First of all, be sure to have the jar containing the driver in the classpath.
If you do not have the jar, you can download it from http://mvnrepository.com/artifact/mysql/mysql-connector-java

You need to download jar containing com.mysql.jdbc.Driver you can download jar from here and set your classpath

Seems like you have not included the com.mysql.jdbc.Driver into the class path of your project.
1.First download the mysqldriver
2.if you are using the eclipse than go to Project->BuildPath->Configure Buil path -> Libraries Tab - > Add external jar and than select the mysql driver jar which you have downloaded
3. Rebuild or clean the project
4.Deploy the project again.

Related

Linking MySQL Connector Jar To My Dependencies Java Play Framework 1.x

Using the following connection string credentials in my application.conf file:
db.default.url=mysql://localhost:3306/test
db.default.driver=com.mysql.jdbc.Driver
db.default.user=user
db.default.pass=password
I get the following error in the console:
A database error occured : Cannot connected to the database[default], No suitable driver found for mysql://localhost:3306/test
So then in my project/lib directory, I have placed the following jar:
mysql-connector-java-5.1.48
What is the proper syntax then, to include in my dependency file? This is how it looks now:
require:
- play
How do I tell this file it needs what's in project/lib?
When you add a JAR file to your project's lib folder, Play FW adds it to classpath by default. You don't need to tell the framework that the file is there.

In Jmeter Cannot create PoolableConnectionFactory

I am trying to run select query in jmeter. I am getting this response in listners "Cannot create PoolableConnectionFactory" I have attached my myphpadmin page which I use to create db. Thanks in advance.
.png
JDBC jar should be in lib folder:
Fully qualified name of driver class. (Must be in JMeter's classpath - easiest to copy .jar file into JMeter's /lib directory).
I assume you use your jar for MySQL DB:
The list of the validation queries can be configured with jdbc.config.jdbc.driver.class property and are by default:
MySQL
com.mysql.jdbc.Driver
You need to put the .jar into the "lib" folder of your JMeter installation (or other folder which is in JMeter Classpath
You need to restart JMeter to pick the .jar
Check out MySQL Database and JMeter - How to Test Your Connection for more information
On JMeter side check:
driver of MySQL (correct version) is in lib folder. The Jar not a zip.
The URL format is correct based on this document, there seems to be a space before database name in your URL
Login / password are also correct, check for strange characters or bad copy/paste
If all those are ok, then you're most probably facing same issues as the ones described here:
https://stackoverflow.com/a/2985169/460802

Uploading app to Web App Engine in IntelliJ

I'm trying to deploy my app to Web App Engine. I have WAE module in web part of my project; there is a path specified in Modules/web/Google App Engine:
/Users/Kamil/IdeaProjects/appengine-java-sdk-1.9.12/
Although when I click on we in general (Modules/web/"Paths" tab), I see following settings:
Output path:
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/classes
The problem is:
When I click "Upload Web App Engine Application" following error appears:
Bad configuration: Could not locate
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
I don't get it why it tries to search in wrong directory, not the one specified in Modules. Please advise.
Edit
I noticed that in Modules/web/"Sources" tab whole folder named "target" is excluded. Maybe that's the problem?
According to the error message
Bad configuration: Could not locate
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
, the deployment code is looking for appengine-web.xml, a crucial config file for your App Engine app. It's looking for that file here:
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
Is it possible that the file
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
could not be located ("Bad configuration: Could not locate ") because the file
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
does not exist?
The path /Users/Kamil/IdeaProjects/appengine-java-sdk-1.9.12/ is the path to your SDK, not the target folder, and is not related to this issue.
The target file is excluded from "sources" because "sources" is the location of files that are included as source code into the build. The target folder is the opposite of source files - it's the flattened-out WAR archive that is used to deploy your app. The deployment tool you use will pack it up into a .war file and send that to the App Engine data centers.
Finally, the output path folder .../classes is where the compiled .java files that turn into .class files for your app are put.
I think you should look into some tutorials on IntelliJ and App Engine to make sure that your project was created and configured properly.
Good luck!
One you can do that locate build folder in explorer and delete it. After that reopen android studio build it again and run it. Now every thing is fine.

Class Not Found: javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

I am not sure why I am getting a class not found. I have included the mysql jar file.
I am using JSP to call classes I have written, which BookStoreLogic.java connects to the database.
Error: HTTP Status 500 - javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Screenshot (Project Explorer):
Thank you for the help I appreciate it.
Create a lib folder inside WEB-INF folder, then add your database driver there. Every jar inside lib folder will be automatically deployed together with your web application.
Your folder tree should look like this:
+ WEB-INF
+ lib
- mysql-connector-jar-5.1.28-bin.jar
Assuming that you already added connector jar to your project build path you can add it to our WEB-INF/lib via
YourProject -> properties -> Deployment Assembly -> add -> Java Build Path Entries -> select mysql-connector ...jar -> finish.
Upon downloading the mysql jdbc connector, extract the mysql-connector-jar-x.x.x-bin.jar file.
If you are using intellij simply create a lib folder inside of the WEB-INF folder.
Once you have added the above you will need to add the jar file to your project. Go to File > Project Structure then select Libraries. Click on the + icon and add the jar file from your lib folder and save. Hope this helps!

Can't connect to Derby database if derby.jar is in Eclipse workspace

I've been trying to create a Derby DB via Eclipse Data Tools Platform and at the beginning I couldn't manage to get it to work.. no matter what I did, I always got the same error:
Could not connect to New Derby.
Error creating SQL Model Connection connection to New Derby. (Error: null)
java.lang.NullPointerException
Error creating JDBC Connection connection to New Derby. (Error: null)
java.lang.NullPointerException
While I was trying this the derby.jar file containing the driver was inside "workspace/myproject/lib" folder. Then I put the same exact file to my Desktop, set the driver to point to the new location of my derby.jar and all started to work automagically...
I did some experiments and it happens that it works everywhere EXCEPT when I put inside my Eclipse workspace folder. Why?
And most important: if I want to deploy my application on different machines do I need the derby.jar inside my project folder (and thus inside the .jar of my project)?
Thanks in advance to everyone
EDIT: I already added derby.jar to the project through Eclipse interface, here's how:
You have to add the jar file using eclipse's interface. This website shows how:
http://www.cs.duke.edu/courses/cps004g/fall05/assign/final/addlibrary.html

Categories