Comment on March 27th, 2010.
Forgot to mention: The sample app provided uses grails-app/conf/LogFilters to show off logging:
/**
*** TODO GLASSFISH - Just to show-off that logging is working with GlassFish ***
*
class LogFilters {
def filters = {
logit(controller:"*", action:"*") {
before = {
log.info "controllerName=$controllerName actionName=$actionName params=$params"
true
}
}
}
}
Comment on March 29th, 2010.
Great job, Reiner! Thx alot for this solution! Working 100%
Greetings
Hauke
Pingback on March 29th, 2010.
[…] Reiner Saddey’s Place » How to Deploy a Grails Application to GlassFish blog.saddey.net/2010/03/27/how-to-deploy-a-grails-application-to-glassfish – view page – cached Just another WordPress weblog for Reiner Saddey Filter tweets […]
Comment on March 29th, 2010.
Nice howto.
Also, how did you draw your diagram? It looks really neat.
Comment on March 29th, 2010.
Thanks Pascal (blush)!
The diagram has been prepared using http://yuml.me - see also the links at the very bottom of my post - the orange ones are the links
I really love this site - much more agile and time-saving for day-to-day docs than “real” full-featured and heavy weight UML tools (whose sophisticated symbols tend to remain ornaments for most audiences - and for me, the MDA coach has turned into an unaffordable pumpkin within days).
I think, it offers just the right balance of features and ease-of-use. See real-world http://bit.ly/cgJEap for some more complex examples.
Regards,
Reiner
Comment on March 29th, 2010.
Oh sorry! Actually I was quite sleepy when I first read your post so I did miss the link section at the button of your post. Thanks for pointing out.
yuml seems really nice indeed!
Comment on May 27th, 2010.
Reiner - thanks very much for this! Great post!
Comment on May 31st, 2010.
This is a lifesaver. Works 100%. I just added the Events.groovy script in my [app-dir]/scripts directory and it all worked just fine. I wish if there was a way to make logging work for other components as well (EJBs, glassfish’s error messages etc.)
Comment on August 11th, 2010.
first thanks for the diagram and code which helped with understanding why the logging wasn’t working in glassfish v2 for me.
Using your logic I tried an experiment and simply updated my Grails project (v. 1.1.2) pom file , since I’m using maven to build this project in idea. So I didn’t actually use the Events script or LogFilter but did add the line,
“grails.logging.jul.usebridge = false ” to Config
Then I added these lines to the pom.xml to include new libraries as well as commenting out sl4j-log4j:
<!–dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.5</version>
<scope>runtime</scope>
</dependency–>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.5.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.5.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
Glassfish v2 logging works like a charm with this set of changes, if one wants to use Maven. Just thought someone out there might like to know.
Thanks again for the tutorial.
WillK
Comment on January 19th, 2012.
Thanks a lot for sharing theses tips. I modified it a bit because it prevents app from working when launched with “grails run-app” command.
Actually it should only modify the web.xml when building a war.
Here is what i use :
eventCreateWarStart = { warName, stagingDir ->
def webXmlFile = new File(”${stagingDir}/WEB-INF/web.xml”)
def root = new XmlSlurper().parse(webXmlFile)
// When running with JBoss (or GlassFish a.s.o) remove log4j configuration stuff
def log4j = root.listener.findAll {node ->
node.’listener-class’.text() == ‘org.codehaus.groovy.grails.plugins.log4j.web.util.Log4jConfigListener’
}
log4j.replaceNode {}
def log4jFile = root.’context-param’.findAll {node ->
node.’param-name’.text() == ‘log4jConfigLocation’
}
log4jFile.replaceNode {}
def writer = new FileWriter(webXmlFile)
writer
Comment on January 20th, 2012.
Just noticed my comment has been cut… Here is the end of the closure :
// Delete space between
Comment on January 20th, 2012.
Sorry, the comment parser seems to think i am trying to inject HTML tag and i get censored. Last try…
// Replace < by the equivalent char in HTML
writer << new StreamingMarkupBuilder().bind {
mkp.declareNamespace(”": “http://java.sun.com/xml/ns/j2ee”)
mkp.yield(root)
}
writer.close()
}
Comment on March 8th, 2012.
Hi thanks for this great tutorial
I have a war that is uploaded and work’s fine in jboss EAP 5
The same waar don’t work in jboss SOA platform , the war if deployed fine but when I want to click sur save I have a error like :
I want to deploy a grails 1.3.7 application to Jboss 5.2 but I have a problem with the JTA transaction :
Stacktrace follows: org.hibernate.HibernateException: Unable to locate current JTA transaction
at xxxx.deploy.DonneeController$_closure4.doCall(DonneeController.groovy:24)
at xxxx.deploy.DonneeController$_closure4.doCall(DonneeController.groovy)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at java.lang.Thread.run(Thread.java:662)
The resources.xml groovy file is :
My jboss-web.xml is:
xxxx.DeployIHM:archive=xxxx-Deploy-1.0-SNAPSHOT.war
java2ParentDelegation=false
I guess there is a conflict with jbpm nead help
Thanks in advance
Comments can contain some xhtml. Names and emails are required (emails aren't displayed), url's are optional.