• Post Reply Bookmark Topic Watch Topic
  • New Topic

Deploy MySQL Database to Glasfish using Intellij

 
Brett Wiggins
Greenhorn
Posts: 20
IntelliJ IDE Mac OS X MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I've written a Servlet that queries a database and displays the results. I'm developing in IntelliJ Ultimate but it doesn't deploy the MySQL jar file to the GlassFish domain lib directory. I was getting a ClassNotFound exception until I manually copied it to the domain lib directory, which fixed the problem. Below are some screenshots of my environment. I really am stuck on this.



In the image above on the right is the database window, I am able to connect to the database in Intellij.

The Below image shows the dependencies window. MySQL is listed.



I have no idea why the MySQL library is not getting deployed with the application.

Brett.
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Data sources should be done in the app server (Glassfish in your case) then use JNDI to get it back, not direct JDBC.

Like you did, using direct JDBC, the app server checks its own library for the JDBC jar file, rather than the lib folder in your war file.

To deploy the JDNI directly, you need a persistence.xml along with your web app and when you deploy, a persistence unit will set up the JNDI for you.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!