0

I've updated my application to Grails 2.3 and I’m now having an extremely frustrating issue getting the app up and running. I was hoping someone could offer some assistance. We have a dependency on doc4j and every time I go to run the app I get a "java.lang.ClassNotFoundException:org.docx4j.openpackaging.packages.WordprocessingMLPackage".

After doing some research I found that this issue could be related to not having all of the dependencies for docx4j in my classpath, yet I've gone through and verified that all of the dependencies listed here-- http://dev.plutext.org/docx4j/docx4j-2.5.0/ --are in "Grails Dependencies" under:

Properties->JavaBuildPath->Libraries.

The package that is causing the trouble is also there under:

Grails Dependencies->Docx4j-2.5.0.jar->org.docx4j.openpackaging.packages-> WordprocessingMLPackage.class

Here is my stack trace:

| Loading Grails 2.3.0
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Error log4j:ERROR Property missing when configuring log4j: appName
| Running Grails application
| Error log4j:ERROR Property missing when configuring log4j: appName
2013-09-19 21:34:23,746 ERROR [context.ContextLoader] Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:             Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to     locate constructor with Class parameter for class       org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
... 5 more
Caused by: java.lang.reflect.InvocationTargetException
    ... 5 more
Caused by: java.lang.NoClassDefFoundError:    org/docx4j/openpackaging/packages/WordprocessingMLPackage
at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
    at java.lang.Class.getDeclaredMethods(Class.java:1810)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: org.docx4j.openpackaging.packages.WordprocessingMLPackage
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 7 more
2013-09-19 21:34:23,762 ERROR [context.GrailsContextLoader] Error initializing the   application: Error creating bean with name 'pluginManager' defined in ServletContext   resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested   exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter   for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name     'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:     Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to    locate constructor with Class parameter for class   org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
    ... 5 more
Caused by: java.lang.reflect.InvocationTargetException
    ... 5 more
Caused by: java.lang.NoClassDefFoundError: org/docx4j/openpackaging/packages/WordprocessingMLPackage
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
    at java.lang.Class.getDeclaredMethods(Class.java:1810)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: org.docx4j.openpackaging.packages.WordprocessingMLPackage
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 7 more

If you could please offer me any assistance, I would greatly appreciate it. Thanks.

-----EDIT-----

I'm adding my BuildConfig.groovy in case that will provide any extra information:

/moving plugins dir to plugins directory under main project folder
grails.project.plugins.dir = 'plugins'

grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
//grails.project.war.file = "target/${appName}-${appVersion}.war"

grails.project.dependency.resolver = "maven"
grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // uncomment to disable ehcache
        // excludes 'ehcache'
    }
    log "warn"
    repositories {
        grailsPlugins()
        grailsHome()
        grailsCentral()

        // uncomment these to enable remote dependency resolution
        // from public Maven repositories
        mavenCentral()
        mavenLocal()
        //mavenRepo "http://snapshots.repository.codehaus.org"
        //mavenRepo "http://repository.codehaus.org"
        //mavenRepo "http://download.java.net/maven/2/"
      //mavenRepo "http://repository.jboss.com/maven2/"
    }

    dependencies {
        // specify dependencies here under either 'build', 'compile',
        // 'runtime', 'test' or 'provided' scopes eg.

        // runtime 'mysql:mysql-connector-java:5.1.16'
    }

    plugins {

    //----- for versions before 2.3 -----//
    //compile ":hibernate:$grailsVersion"

        //build ":tomcat:$grailsVersion"


    // for versions after 2.3
    //compile':hibernate:3.6.10.M3'

    // moved from application.properties
    compile ":cookie:0.4"
    compile ":dojo:1.7.2.0"
    compile ":help-balloons:1.4"

    compile ":jsecurity:0.4.1"
    compile ":p6spy:0.5"
    compile ":searchable:0.6.4"

    runtime ":hibernate:3.6.10.1"
    build ':tomcat:7.0.41'



   }
}
contemplate
  • 1
  • 1
  • 2
  • Are you using BuildConfig.groovy to include this dependency, the lib directory, or something else? If BuildConfig, what does the file look like? Where are you attempting to execute the 'run-app' command from? The console or from within the IDE? If an IDE, what IDE? – dspies Sep 20 '13 at 15:36
  • Hi, dspies. Thanks for your reply. The dependency itself is in my lib folder and it automatically gets added to the project under "Grails Dependencies" in the build path. I'm using the most recent Spring Tools Suite IDE and that's where I'm executing 'run-app'. I'm also adding my BuildConfig.groovy in case that will help. – contemplate Sep 20 '13 at 15:47
  • 1
    Have you tried running `grails dependency-report` (http://grails.org/doc/2.2.x/ref/Command%20Line/dependency-report.html). Also, the searchable plugin does not support Grails 2.3 – dspies Sep 20 '13 at 18:06
  • Do you have the ability/freedom to upgrade to docx4j 2.7.1 or higher? – dspies Sep 20 '13 at 18:08
  • After running the dependency report it seems that I get: – contemplate Sep 20 '13 at 18:27
  • 1 'not found' error (caused by tomcat plugin) under and 1 conflict (caused by ant) under 'build', 1 'not found' error (caused by hibernate) under 'compile', 1 'not found' error (caused by hibernate) under 'runtime', and another 'not found' (also by hibernate) under 'test'. It seems worrisome that searchable doesn't support grails 2.3. Are there any alternatives? Also I should be able to upgrade to the latest docx4j version. – contemplate Sep 20 '13 at 18:37
  • I just found another thread from StackTrace that sounds very similar (http://stackoverflow.com/questions/13646407/cant-run-grails-app) where Burt Beckwith suggests `grails compile --refresh-dependencies` – dspies Sep 20 '13 at 19:35

0 Answers0