• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class Not Found Exception for com.mysql.jdbc.Driver Wildfly 10

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using Wildfly 10 and my datasource in the standalone.xml is:



I'm running this code in my Java bean:


and I get this error message:



I read documentation that said I needed to have the driver in my lib folder for Tomcat so I tried it but that didn't work. I'm sure the solution is simple but I don't see it. Can someone point me in the right direction. Some documentation that I can use as a resource would be great.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For starters you don't need that Class.forName() call in your code.
The Data Source deals with all that and, in any case, a class 4 driver (which is what you;re using) self-registers, so it's not necessary anyway.

Is that exception thrown from that line?
 
Sean Jensen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes that exception is thrown from that line. I thought the line seemed odd myself but I found multiple examples of people using it. The original problem was that I was getting an error on the Connection definition:

which gave me this error:



The thing is I've tested that connection because it is used in my code already. My data adapters work just fine. I know the code works because I've used it locally. I need to run this process to generate reports on the fly. I've looked around and tried a number of things but I just can't seem to find the instructions for making this connection work on the server.
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've got a data source, so you should be getting your connection from there, not via the DriverManager.
 
Sean Jensen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I totally agree. I posted on two other forums and one of them suggested an possible solution which I will try in a few minutes but if you can point me towards that code I will have another source. If not I'll post the solution if that turns out to be it.
 
Sean Jensen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what worked for me:


Thank you for replying.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic