Home Grails 3.3.2 - gradlew bootRun works but grails run-app and grails-compile do not
Reply: 0

Grails 3.3.2 - gradlew bootRun works but grails run-app and grails-compile do not

Chris Malan
1#
Chris Malan Published in 2017-12-05 05:55:53Z

Everything worked before in this project. I updated Grails from 3.3.1 to 3.3.2 and it still worked. I also updated Gradle and now it does not work.

Both gradlew bootRun and gradlew war work and the war file deploys to Tomcat and works fine.

To generate pdf documents I have these dependencies:

compile "org.xhtmlrenderer:flying-saucer-core:9.1.9"
compile "org.xhtmlrenderer:flying-saucer-pdf:9.1.9"
compile "com.lowagie:itext:4.2.1"

After cleaning I run 'grails compile'and get this:

General error during class generation: java.lang.NoClassDefFoundError: Unable to load class org.xhtmlrenderer.pdf.ITextRenderer due to missing dependency Lcom/lowagie/text/Document;

java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class org.xhtmlrenderer.pdf.ITextRenderer due to missing dependency Lcom/lowagie/text/Document;
        at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1101)
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1079)
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:537)
        at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:175)
        at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:56)
        at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerRunnable.run(AbstractDaemonCompiler.java:87)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:36)
        at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:46)
        at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)

With stacktrace:
java.util.concurrent.ExecutionException: org.gradle.tooling.BuildException: Could not execute build using Gradle installation '/home/chris/.sdkman/candidates/gradle/current'.
    at java_util_concurrent_Future$get.call(Unknown Source)
    at run-app.run(run-app.groovy:89)

When I did this pdf thing the grails rendering plugin would not work. So I created a small proof of concept application using the Flying Saucer libraries directly. It uses the same dependencies as given above and the code is the same. This small Grails application still works with 'grails compile' and 'grails run-app'

In Idea I get exactly the same problems even though Idea is set to use the application's Gradle wrapper.

Nowhere do I import or use com.lowagie.text.Document - the class about which the errors complain. And the thing works perfectly when using gradlew and it worked before whichever way I ran or compiled the application. And that class is in the itext:4.2.1 dependency. I downloaded the jar and looked.

org.xhtmlrenderer.pdf.ITextRenderer is imported and used. Idea has no problems with it. Idea usually warns one if one tries to import or use a class not on the classpath.

I tried reverting back to previous versions of Gradle, but no luck.

This is not a show stopper as gradlew still works. But what the heck is going on? Any ideas?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297785 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO