Notes on GlassFish

Enable access to admin panel outside of localhost

asadmin change-admin-password
asadmin enable-secure-admin

Instances / clusters

Autostart

Troubleshooting

Resolve Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource while adding first MySQL Connection Pool

Copy mysql-connector-java-<VERSION>-bin.jar to <GF_BASE_PATH>/glassfish4/glassfish/domains/domain1/lib/, then:

asadmin restart-domain

Resolve com.sun.enterprise.naming.impl.SerialContext cannot be cast to javax.sql.DataSource

I saw this exception using GlassFish 4.1, trying to open a DataSource this way:

DataSource dataSource = (DataSource) initContext.lookup(sourceName);

One time this exception happened because sourceName was an empty string.

Another time the exception simply disappeared removing some useless “Additional Properties” of the connection pool (from the graphical GlassFish admin panel) and redeploying the web application.

Bypass asadmin password

Use this: glassfish4/glassfish/domains/domain1/config/local_password