https://grails.org/ logo
Join Slack
Powered by
# questions
  • g

    giangio

    11/10/2025, 9:41 PM
    I’ve opened a feature request — happy to provide more details if needed! https://github.com/wondrify/asset-pipeline/issues/408
  • m

    matt.aguirre

    11/10/2025, 10:06 PM
    One last question? when serving static resources using the src/webapp directory, is it possible to change the target directory to NOT be 'static'. I had done that before (possibly why my above issue w/ the OOM?) Or am I stuck with 'static' in the URI?
    m
    • 2
    • 1
  • s

    SavyX

    11/12/2025, 1:15 PM
    Hi, We recently migrated our application to Grails 6.2.3 and switched from Tomcat to Spring Boot (using bootWar instead of war when building the release). Since the migration, we’ve encountered issues with the Hibernate session cache not expiring, which eventually leads to the application running out of memory. Under Tomcat, the session was automatically cleaned up after about 30 minutes, which prevented the issue, but it now seems that we may also be using Hibernate incorrectly in some parts of the application. Specifically, we often pass domain class instances (retrieved via MyDomainClass.findBy... or through service methods) directly to GSP views. Within the GSP, we then access nested fields that belong to other domain classes, which triggers additional lazy-loading and keeps the Hibernate session open. This behavior appears to contribute to the memory leak. Additionally, some of our command objects (Validatable) contain GORM domain objects as fields, which likely adds to the problem. We’re looking for the correct approach to handle retrieved data. Ideally without a full refactor to normalize everything into DTOs, since in many cases the specific nested data required is only known dynamically in the GSP. Perhaps will grails 7 handle it better? Thank you in advance for any hints!
    j
    s
    • 3
    • 9
  • u

    user

    11/12/2025, 5:55 PM
    I remember I read somewhere that new versions of Grails will be released following spring framework release cadence but I now cannot find any reference of that. Can anyone help me? I would like to introduce some automatic minor version upgrade in our CI but I would like to document why it is a good idea
    j
    u
    +7
    • 10
    • 19
  • u

    user

    11/12/2025, 8:16 PM
    I am upgrading my apps to 7 and have also upgraded some caches to Ehcache 3. We currently deploy our apps as WAR files to tomcat (10, java 21). Everything is working as expected so far, but when tomcat shuts down, I am seeing an exception from Ehcache
    Copy code
    java.lang.IllegalStateException: Close not supported from UNINITIALIZED
    I am creating the cache beans like this
    Copy code
    @Configuration
    class EhcacheConfig {
        
        @Autowired
        CacheManager cacheManager
    
        @Bean
        CacheManager cacheManager() {
            log.info('cacheManager() called')
            return CacheManagerBuilder.newCacheManagerBuilder().withCache('cache1', ...).withCache('cache2', ...).build(true)
        }
    
        @Bean
        Cache<String, Integer> cache1() {
            return cacheManager.getCache('cache1', String, Integer)
        }
    
        @Bean
        Cache<String, Integer> cache2() {
            return cacheManager.getCache('cache2', String, Integer)
        }
    I am not seeing the same error happen when running locally with bootRun. Any ideas here?
    j
    u
    +3
    • 6
    • 9
  • r

    rss

    11/14/2025, 1:54 AM
    In grails, how to domain collection sort on multiple attributes? In grails domain objects you can have a default sort order: class Airport { … static hasMany = [flights: Flight] static mapping = { flights sort: 'number', order: 'desc' } } Is there any way to sort on more than one attribute using this method?
  • u

    user

    11/14/2025, 2:24 PM
    How safe is two update java to 21?
  • j

    jdaugherty

    11/14/2025, 2:24 PM
    the only real impact are date formatting differences
  • u

    user

    11/17/2025, 4:12 AM
    Hello community, With all my projects, as I have them pretty much the similar major dependencies, • spring security • spring security rest • db migration • spring data • spring session • redis • json view After upgrading to Grails 7, my GSP views just can not being loaded correctly with standalone war file. However the GSP views does work under development mode. Spending quite some time tracing the code, I found the
    precompiledGspMap
    was not being populated for groovyPageLocator bean, as fall back it tried to use
    resourceLoader
    to load the
    gsp
    and then render it. That's why it works in development mode(because it use
    resourceLoader
    anyway for development mode) I have to do the following work around to put the code in resource.groovy to make the whole project working with grails 7.0.2.
    Copy code
    // Force precompiledGspMap to be used in production
        // Override the groovyPageLocator bean from GroovyPagesGrailsPlugin
        // to force loading of precompiled GSPs even when Metadata thinks dev is available
        if (Environment.current == Environment.PRODUCTION && !Environment.isDevelopmentMode()) {
            groovyPageLocator(org.grails.web.gsp.io.CachingGrailsConventionGroovyPageLocator) { bean ->
                bean.lazyInit = true
    
                // Force loading of precompiled GSP map from gsp/views.properties in WEB-INF/classes
                precompiledGspMap = { org.springframework.beans.factory.config.PropertiesFactoryBean pfb ->
                    ignoreResourceNotFound = true
                    location = 'classpath:gsp/views.properties'
                }
    
                reloadEnabled = false
                cacheTimeout = -1  // Never expire cache
            }
    
            // Force messageSource to load from classpath in production
            // Override to ensure i18n message bundles are loaded from WEB-INF/classes
            messageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) {
                basename = 'classpath:messages'
                defaultEncoding = 'UTF-8'
                fallbackToSystemLocale = false
                useCodeAsDefaultMessage = false
                cacheSeconds = -1  // Cache forever in production
            }
        }
    After putting this at the bottom of the resource.groovy. Everything works. I still doing the testing. Question is why do I have to do this? What is wrong? Obviously with simpler projects generated by the grails forge, it works perfectly too.
    j
    u
    • 3
    • 4
  • f

    Fernando henrique

    11/17/2025, 12:20 PM
    For anyone needing the updated CodeNarc plugin, here's the repository. https://github.com/dobromyslov/codenarc-idea
    👍 3
  • l

    lraynal

    11/17/2025, 4:32 PM
    Hi, does https://github.com/apache/grails-core/pull/15187 mean that Grails 7 doesn't supporto depending on a micronaut lib based on netty http client ?
    t
    j
    • 3
    • 3
  • y

    ysb33r

    11/18/2025, 12:02 PM
    Looks like repo.grails.org is not accessible?
    ✅ 1
    m
    g
    a
    • 4
    • 6
  • m

    Mike Saubier

    11/24/2025, 3:30 PM
    Is there a new approach to working with external config.yml files in Grails 7? See https://stackoverflow.com/questions/79828816/external-config-yml-file-not-working-in-grails-7
    m
    j
    • 3
    • 15
  • m

    matt.aguirre

    11/24/2025, 3:36 PM
    [MOVED to REPLY]
  • r

    rss

    11/24/2025, 3:44 PM
    External config.yml file not working in Grails 7 I have a Grails 6 application that uses an external config.yml file to configure things such as the credentials for the datasources. I'm working on upgrading to Grails 7 and I'm running into the same issue as previously reported in https://github.com/apache/grails-core/issues/12777. The setEnvironment() method is being used in the main class to load properties from an external config file whose...
  • u

    user

    11/26/2025, 12:11 PM
    Hi everyone. Are you guys all using intelij or is there someone using vs code for grails developemnt? I looked for this questions here in the channel, no one asked about this.. Is there any way to have a good grails experience with grails in vs code? In my last job I used intelij, but for now, I wouldn't like to pay for intelij. Thanks
    j
    u
    +2
    • 5
    • 9
  • u

    user

    11/26/2025, 1:50 PM
    @User I would love to keep using neovim for Grails as I do for all other languages but IntelliJ is the only editor/IDE almost working with Grails. Almost as they have their own issues
    p
    u
    • 3
    • 2
  • u

    user

    11/26/2025, 2:03 PM
    @User, thank you for your answer.... good to know, thanks..
  • u

    user

    11/26/2025, 2:05 PM
    I bet you'd prefer another one but apparently buying a license for IntelliJ is a tax have to pay
  • u

    user

    11/26/2025, 3:10 PM
    Yes, I even miss intelij, but I like vs code and sublime text (the one I used to like most)... but lately sublime text have shown way more overhead that I would like to have... and for grails both are not good. But, actually as jdaugherty said in the answer to my question, using AI helps.. I thought about it some time ago, using AI autocomplete will make a lot of things easier...
  • u

    user

    11/26/2025, 4:20 PM
    We are using the databasemigration plugin, our DB runs in AWS via Aurora MySQL. Our application should access the DB via a read only URL except when we do the migration. I'm setting "grails.plugin.databasemigration.url" to the read write endpoint and "dataSource.url" to the read only endpoint. Now I would like to log the migration connection information like I do for the dataSource
    Copy code
    private void printDataSourceConfiguration(String stage) {
            <http://log.info|log.info>("Stage: ${stage}")
    
            try {
                // Unwrap if it's a TransactionAwareDataSourceProxy
                DataSource actualDataSource = dataSource
                actualDataSource = ((TransactionAwareDataSourceProxy) dataSource).getTargetDataSource()
                def connection = actualDataSource.getConnection()
                def metaData = connection.getMetaData()
                <http://log.info|log.info>("     Database URL: ${metaData.getURL()}")
                <http://log.info|log.info>("     Database Product: ${metaData.getDatabaseProductName()} ${metaData.getDatabaseProductVersion()}")
                <http://log.info|log.info>("     Driver: ${metaData.getDriverName()} ${metaData.getDriverVersion()}")
                connection.close()
            } catch (Exception e) {
                log.warn("  -> Could not extract connection metadata: ${e.message}")
            }
        }
    what is the object I have to get data from?
  • j

    James Fredley

    11/26/2025, 9:57 PM
    https://github.com/apache/grails-core/discussions/13546#discussioncomment-10088884 - the state of direct Grails support in IDEs. IntelliJ Ultimate is by far the best integration. But, you can develop in any IDE with Gradle support and use grails-shell in terminal to achieve many of the things possible via the IntelliJ Grails plugin.
  • g

    giangio

    11/27/2025, 10:14 AM
    Hi folks 🙂 I'm trying to use the webjars provided by Grails 7 in my app, here is the
    includes.js
    file:
    Copy code
    // From Grails 7 included webjars
    //= require webjars/dist/jquery.js
    //= require webjars/dist/js/bootstrap.bundle.js
    In the view:
    Copy code
    <asset:javascript src="includes.js"/>
    This is my
    build.radle
    :
    Copy code
    assets {
        minifyCss = true
        minifyJs = true
        minifyOptions = [
                //SIMPLE (default) or ADVANCED or WHITESPACE_ONLY
                optimizationLevel: "SIMPLE",
        ]
        excludes = [
                'webjars/jquery/**',
                'webjars/bootstrap/**',
                'webjars/bootstrap-icons/**',
        ]
        includes = [
                'webjars/jquery/*/dist/jquery.js',
                'webjars/bootstrap/*/dist/js/bootstrap.bundle.js',
                'webjars/bootstrap/*/dist/css/bootstrap.css',
        ]
    }
    They are not included. Building a
    jar
    shows:
    Copy code
    11:06:33.369 [pool-1-thread-2] WARN asset.pipeline.DirectiveProcessor -- Unable to Locate Asset: /webjars/dist/jquery.js
    11:06:33.372 [pool-1-thread-2] WARN asset.pipeline.DirectiveProcessor -- Unable to Locate Asset: /webjars/dist/js/bootstrap.bundle.js
    11:06:36.139 [pool-1-thread-10] WARN asset.pipeline.DirectiveProcessor -- Unable to Locate Asset: /webjars/dist/jquery.js
    11:06:36.140 [pool-1-thread-10] WARN asset.pipeline.DirectiveProcessor -- Unable to Locate Asset: /webjars/dist/js/bootstrap.bundle.js
    11:06:36.567 [pool-1-thread-4] WARN asset.pipeline.DirectiveProcessor -- Unable to Locate Asset: /webjars/dist/css/bootstrap.css
    11:06:39.512 [pool-1-thread-8] WARN asset.pipeline.DirectiveProcessor -- Unable to Locate Asset: /webjars/dist/css/bootstrap.css
    What am I doing wrong?
  • g

    giangio

    11/27/2025, 10:23 AM
    They exist in the
    jar
    with the hash:
    g
    • 2
    • 3
  • r

    rss

    11/27/2025, 10:04 PM
    Call GORM's .list() in trait with generic type In my Grails 6 project, I'd like to add an additional feature to select domain classes, so I defined a custom trait. trait MyDomainClassTrait implements GormEntity {} // domain class class Page implements MyDomainClassTrait { String id } What I'm trying to achieve is to define some sort of "cache manager", internal to the trait, mimicking a few GORM-like methods, so to be able to use either: Page.list(), native GORM Page.cache.list(), returns all GORM entities previously stored in...
  • u

    user

    11/28/2025, 1:05 PM
    Hi Everyone, I'm not sure if I'm hitting a bug, a feature, or a limitation of DetachedCriteria.... (Grails 6, Gorm ) Occasionally, when i'm passing in a DetachedCriteria as a subquery to an inList("property", mySubQuery) I'm given an error:
    ConverterNotFoundException: No converter found capable of converting from type [org.hibernate.criterion.DetachedCriteria] to type [java.lang.Long]
    🗑️ 1
  • u

    user

    11/28/2025, 1:13 PM
    Hi Everyone, (sorry for the duplicate, can't delete it) I'm not sure if I'm hitting a bug, a feature, or a limitation of DetachedCriteria.... (Grails 6, Gorm ) Occasionally, when i'm passing in a DetachedCriteria as a subquery to an
    inList("property", mySubQuery)
    I'm given an error:
    ConverterNotFoundException: No converter found capable of converting from type [org.hibernate.criterion.DetachedCriteria] to type [java.lang.Long]
    This is usually when there is some nesting of associations, but I haven't been able to extract a simple reproducible case from our application. The issue arises in
    AbstractHibernateCriterionAdapter
    as follows
    Copy code
    protected void applySubCriteriaToJunction(PersistentEntity entity, AbstractHibernateQuery hibernateCriteria, List<Query.Criterion> existing,
                Junction conjunction, String alias) {
    
            for (Query.Criterion subCriterion : existing) {
                if (subCriterion instanceof Query.PropertyCriterion) {
                    Query.PropertyCriterion pc = (Query.PropertyCriterion) subCriterion;
                    if (pc.getValue() instanceof QueryableCriteria) {
                        pc.setValue(toHibernateDetachedCriteria(hibernateCriteria, (QueryableCriteria<?>) pc.getValue()));
                    }
                    else {
                        AbstractHibernateQuery.doTypeConversionIfNeccessary(entity, pc);
                    }
                }
    Here,
    pc.getValue()
    is an already converted Hibernate DetatchedCriteria, not the original Gorm DetachedCriteria - it looks like the gorm original has been converted, but I've yet been unable to trace where and when. the Hibernate converted DC is not
    instanceof QueryableCriterion
    and so the engine looks instead to convert to a list of scalars. Does anyone have any initial thoughts on bug/limitation or feature here?
    s
    • 2
    • 1
  • s

    Steve Osguthorpe

    11/28/2025, 1:51 PM
    ~Looks like a bug. My guess is that something is re-using the criterion. Perhaps another nested clause somewhere, or a count operation based on the original criterion. Given that
    pc.setValue(toHibernateDetachedCriteria(hibernateCriteria, (QueryableCriteria<?>) pc.getValue()));
    mutates the original, any subsequent usage would cause the error you are seeing. I don't think the "why" it was already converted is really important here though, if it CAN happen then this code should be changed to accommodate that and skip values already of the Hibernate Criteria types, I think you should file a bug.~
  • u

    user

    11/28/2025, 1:53 PM
    Thank you Steve, I will try and pin down a simple case to reproduce this. I'll take guidance on if there is enough to go on for a bug report here... Thanks again
    👍 1
  • i

    ilPittiz

    11/28/2025, 5:14 PM
    Hi all, dumb question: in a Grails multi-project is it possible to have more than one web-app? I only found examples with a single web-app (
    profile: web
    ) and multiple plugins (
    profile: plugin
    ). I’m trying to better understand if a multi-project build would fit my needs: I’m thinking of having 2 separate web-apps, sharing a bunch of code that I’d organize in one or more plugins. If this is doable, what would
    ./gradlew assemble
    include in the .war archive? Both web-apps + all my plugins? Would
    ./gradlew appName:assemble
    create a .war for a single web-app?
    g
    • 2
    • 1