I have developed a small JSP application that uses a mySQL database, a single JSP page (which simply displays the contents of a table in my db), and a servlet, which contains the entity manager and sql statements. I link to the database using the xml file (rather than in the code), which contains this:
When I access the servlet from a web browser, I get the following error (which is actually quite detailed; last line is the error):
<openjpa-1.2.1-r752877:753278 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: <openjpa-1.2.1-r752877:753278 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "com.mysql.jdbc.Driver" and URL "jdbc:mysql://localhost:3306/baseball8". You may have specified an invalid URL.
It says my URL is invalid. I KNOW this is the right URL as I have seen it countless places on the net. If I browse to that url in my web browser, I get an octet stream. If I use the command line interface for mysql, it works. If I connect to the sql database using Eclipse, it works. I can connect just fine. I do have the mysql connector in my class path, as well as the opengpl Apache libraries.
I am completely stumped as to the cause of the bug! Any help (or even guesses!) would be greatly appreciated.
- Do you have the driver set for the server?
- Try the url without the port: //localhost/baseball8
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
I had a nightmare last night. I was dreaming that Iím 64-bit and my blanket is 32-bit and I couldnít cover myself with it, so Iíve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S(from: bash.org.ru)
//always looking for job opportunities in AU/NZ/US/CA/Europe :P
willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"); USE [code] TAGS!Read this FAQ if you are new here. If this post was helpful, please rate it!
Wow after several days of debugging, I finally figured it out. The associated *.jar files for the mySQL connector and taglibs have to be copied to the Apache server's "lib" directory, despite them being in the class path for the Eclipse project and also exported from there.