1
votes

I have grails application and when doing run-app - all ok! But after: grails run-war, i get following a errors:

 
Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'd1LdapServer': Invocation of init method failed; nested exception is groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.io.File#.

Cannot resolve which method to invoke for [null, class java.lang.String] due to overlapping prototypes between:

    [class java.io.File, class java.lang.String]

    [class java.lang.String, class java.lang.String]

    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

    at java.util.concurrent.FutureTask.run(FutureTask.java:138)

    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

    at java.lang.Thread.run(Thread.java:662)

Caused by: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.io.File#.

Cannot resolve which method to invoke for [null, class java.lang.String] due to overlapping prototypes between:

    [class java.io.File, class java.lang.String]

    [class java.lang.String, class java.lang.String]

    at grails.ldap.server.TransientGrailsLdapServer.getWorkDir(TransientGrailsLdapServer.groovy:265)

    at grails.ldap.server.TransientGrailsLdapServer.startDirectoryService(TransientGrailsLdapServer.groovy:208)

    at grails.ldap.server.TransientGrailsLdapServer.start(TransientGrailsLdapServer.groovy:79)

    at grails.ldap.server.TransientGrailsLdapServer.afterPropertiesSet(TransientGrailsLdapServer.groovy:67)

Any help is appreciated. Thanks!

2

2 Answers

1
votes

Had the same problem with the "ldap-server" plugin when deploying on a tomcat. For me the fix was to provide the servletContext via the ApplicationHolder

instead:

ServletContextHolder.servletContext

use:

ApplicationHolder.application.parentContext.servletContext

full source for the TransientGrailsLdapServer.getWorkDir():

import org.codehaus.groovy.grails.commons.ApplicationHolder

private getWorkDir() {      
    def base = ApplicationHolder.application.parentContext.servletContext ? WebUtils.getTempDir(ApplicationHolder.application.parentContext.servletContext) : new File(BuildSettingsHolder.settings?.projectWorkDir, beanName)
    new File(base, "ldap-servers/$beanName")
}
0
votes

The problem is caused by the base argument being null in the line

new File(base, "ldap-servers/$beanName")

in grails.ldap.server.TransientGrailsLdapServer.getWorkDir()

This points to a configuration issue, perhaps there is some difference between your environments that is causing the base argument to be null?