Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:48:11+00:00 2026-06-05T11:48:11+00:00

Glassfish is not loading the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource package. The following error is thrown javax.persistence.PersistenceException: Exception

  • 0

Glassfish is not loading the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource package.

The following error is thrown

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence
Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: 
Error in allocating a connection. Cause: Class name is wrong or classpath is not set    
for:com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
Error Code: 0 at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy
(EntityManagerSetupImpl.java:517)...

I have copied the mysql-connector jar file to the lib directory of Glassfish but I still get the above error.

How do I ensure that Glassfish can find my JDBC driver for my deployed application?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:48:13+00:00Added an answer on June 5, 2026 at 11:48 am

    You will need to make the MySQL JDBC jar file available to Glassfish.

    http://ushainformatique.com/blog/2010/03/19/jdbcwithglassfish/

    EDIT:

    How do I use different JDBC drivers? Where should I copy the jar(s)?

    It is recommended to place JDBC drivers, that are used by all the
    applications in the domain, in domain-dir/lib or
    domain-dir/lib/classes. A restart of the application server instance
    is required today so that the JDBC drivers are visible to applications
    deployed in the domain.

    From https://blogs.oracle.com/sivakumart/entry/classloaders_in_glassfish_an_attempt

    So move the jar file into the lib dir below the domain into which you are deploying your app. The default Glassfish domain is domain1.

    Restart Glassfish and this should work.

    There is a Maven Glassfish plugin which may be worth evaluating http://maven-glassfish-plugin.java.net/ Using Maven and this plugin would help automate the deployment step. This would be more robust than doing manual deployments. Your call though of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With glassfish, my persistence.xml is not loaded. my.ear META-INF/persistence.xml lib/entities.jar <!-- no persistence.xml here
The following error shows up in my Glassfish log when attempting to access my
The glassfish error INFO: Initializing Mojarra 2.1.6 (SNAPSHOT 20111206) for context '/NNTPjsf' INFO: WEB0671:
Not able to solve this problem Error : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: javax.xml.parsers.FactoryConfigurationError: Provider
We are using Glassfish v2 (9.1_02) at work. Our servers are not set up
Has anyone tried running glassfish with JRockit? I see some references saying it's not
My problem is this exception: Caused by: <openjpa-2.1.1-r422266:1148538 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration
I decided to implement dynamic class loading in my glassfish web application, as a
i have ubuntu 8.10, running glassfish v3 (not prelude). first deployment of any jruby
Not a glassfish specialist here but in a project where GlassFish is to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.