Search code examples
deploymentglassfishjava-ee-6earconnector-j

Including the MySql's connector/j as part of an EAR file: Glassfish


We want to simplify the deployment process of an app by including the MySql connector/j jar as part of the EAR. (so we won't need to manually copy it in the /lib folder of our Glassfish servers)

Is it possible?

UPDATE: We have read this is possible using the SAR files in JBoss, but we don't think it's available in Glassfish.


Solution

  • Because of the classloader hierarchy in Glassfish I don't think this is possible. The mysql driver jar needs to be available outside of your application's classloader because the connection pool is globally available.

    http://download.oracle.com/docs/cd/E19226-01/820-7695/6niugesfp/index.html#indexterm-28

    From what I can find, Glassfish doesn't support anything like .sar files: http://old.nabble.com/Migrating-From-jboss-4.2.1-to-GlassFish-td18629992.html

    Maybe vote for this issue, or create your own for a .sar-like deployment option: http://java.net/jira/browse/GLASSFISH-16915