File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Groovy and the fly likes Hotfix Code in tomcat container running groovy application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Hotfix Code in tomcat container running groovy application" Watch "Hotfix Code in tomcat container running groovy application" New topic
Author

Hotfix Code in tomcat container running groovy application

Amit Kulkarni
Greenhorn

Joined: May 25, 2011
Posts: 2

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

    Joined: Jul 11, 2001
    Posts: 15300
        
        6

    Grails reloads modified classes while running the application in development mode. In production, this is turned off because it is not performant.


    GenRocket - Experts at Building Test Data
    Amit Kulkarni
    Greenhorn

    Joined: May 25, 2011
    Posts: 2

    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

    Joined: Jul 11, 2001
    Posts: 15300
        
        6

    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Hotfix Code in tomcat container running groovy application