Skip to content

Instantly share code, notes, and snippets.

@billforward-alex
Created January 28, 2016 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billforward-alex/75e76bd64a75cab78810 to your computer and use it in GitHub Desktop.
Save billforward-alex/75e76bd64a75cab78810 to your computer and use it in GitHub Desktop.
Local Glassfish tricks

Run Glassfish locally

Module fixing

Unzip glassfish_setup.zip (this is a snapshot of the jars we use in Prod or something).

You will need to rename those jars first..

Renaming

Remove everything past _:

brew install rename

cd glassfish_setup/eclipselink_modules
rename 's/_.*\.jar/\.jar/g' *

Inserting

Now move all jars from the *_modules folders individually into glassfish3/glassfish/modules/, replacing existing jars.

Move mysql-connector-java-5.1.34-bin.jar into: glassfish3/glassfish/lib

Cleanup

Delete any existing domains you have; they are now defunct.

Glassfish deploy

Your IntelliJ Run Configurations will need to be informed of which deploy commands to use.

# Run
glassfish/glassfish3/glassfish/bin/startserv domain1
glassfish/glassfish3/glassfish/bin/stopserv domain1
# Debug
glassfish/glassfish3/glassfish/bin/startserv --debug domain1
glassfish/glassfish3/glassfish/bin/stopserv domain1

# I used to use these btw:
/Users/birch/Documents/glassfish/glassfish3/glassfish/bin/asadmin start-domain --verbose domain1
/Users/birch/Documents/glassfish/glassfish3/glassfish/bin/asadmin start-domain --debug --verbose domain1

In case it is helpful at all: Lukasz provides his own domain1_ copy.zip that you could try. But maybe certificates will be incompatible, so not worth bothering.

Redeploys

Upon Redeploy in IntelliJ, you will probably get a PermGen error. So maybe setup your Glassfish domain with a bit more memory..

http://stackoverflow.com/a/8060704/5257399

Increase permgen in GlassFish domain:

/glassfish/domain/domain1/config/domain.xml
<jvm-options>-XX:MaxPermSize=

Logging

See my logging-play directory (I have compiled a jar which implements a logger).

http://stackoverflow.com/questions/9609380/glassfish-3-how-do-you-change-the-default-logging-format

Compiling a jar of your own..

#!/usr/bin/env bash
javac -target 1.7 -source 1.7 JBossAS7LikeFormatter.java
jar -cf JBossAS7LikeFormatter.jar JBossAS7LikeFormatter.java

Install the jar to your domain, in: domain/lib/ext.

Now edit your domain to use the logger:

/glassfish/domain/domain1/config/logging.properties

#com.sun.enterprise.server.logging.GFFileHandler.formatter=com.sun.enterprise.server.logging.UniformLogFormatter
com.sun.enterprise.server.logging.GFFileHandler.formatter=com.stackoverflow.JBossAS7LikeFormatter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment