This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hotfix Code in tomcat container running groovy application

 
Amit Kulkarni
Greenhorn
Posts: 2
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Current I m running my application on Java/J2ee/JSP using tomcat server. I would like to move to groovy grails application as
I heard groovy is dynamic, and we can do code change during runtime on tomcat container similar to JSP/GSPs. I tried alot to find the dynamic groovy code changes using MetaClass programming and ExpandoMetaClass, following are the references.

Reference URLs

  • Hot-fixing Code running inside Web Container with Groovy

  • http://stackoverflow.com/questions/1390243/hotfixing-code-running-inside-web-container-with-groovy

  • Modifying groovy code at run-time in grails application

  • http://stackoverflow.com/questions/2760735/modifying-groovy-code-at-runtime-in-grails-application

  • Embedding a Groovy Console in a Java Server Application

  • http://groovy.codehaus.org/Embedding+a+Groovy+Console+in+a+Java+Server+Application

  • Run-time vs Compile time, Static vs Dynamic

  • http://groovy.codehaus.org/Runtime+vs+Compile+time,+Static+vs+Dynamic

  • Compile Time and Run-time Meta-programming With Groovy

  • http://www.slideshare.net/openblend/open-blend-2010-groovy-metaprogramming-jeff-brown


    Still no luck for me to get the hot-fix on tomcat container. Please help me in understanding how can I fix the code on tomcat without server restart.

    -AMIT
     
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand
    Posts: 15302
    6
    Chrome IntelliJ IDE Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Grails reloads modified classes while running the application in development mode. In production, this is turned off because it is not performant.
     
    Amit Kulkarni
    Greenhorn
    Posts: 2
    Java Spring Tomcat Server
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Gregg!!!

    Following is my concern, I have built a development war and deployed it on external tomcat server and tried to change the groovy files, but I m not finding it under war exploded. If I change the files in the source directory how it reloads it? But for GSPs exists under webapps.

    Your help will be appreciated. Thanks once again for quick response.

    -AMIT
     
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand
    Posts: 15302
    6
    Chrome IntelliJ IDE Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    From the grails docs:

    This target is not intended for deployment as the container in development mode is configured to auto-reload changes at runtime which has an overhead attached to it and will not scale well.


    It's not because it's a development WAR but because the embedded container that Grails uses (Tomcat by default) is configured to auto-reload changes. So it is kind of a combination. But when you deploy to an external container, regardless of the environment you build the WAR for, it won't auto-reload. Also, when you build the WAR, you won't find groovy files. They get compiled to bytecode.
     
    Don't get me started about those stupid light bulbs.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic