Derek
Derek

Reputation: 11915

How to debug grails runtime exception?

I have a grails project and a java project. The java project was a standalone set of POJO classes, and I just dumped them into src/java under my grails project.

In the controller, I added an import statement for this package.

Now when I do a grails run-app and try to run the program, I get a grails runtime exception. It is saying NoClassDefFound for a class that is in a package that one of my POJOs imports.

The error message is showing on a line of my Controller, but the class that is missing is from an external jar that my POJO needed. I moved the .jar that it is complaining about to the grails project's lib folder. What else do I need to do?

How do I track down what is really causing this problem?

Thanks!

Upvotes: 1

Views: 4490

Answers (2)

Krystian
Krystian

Reputation: 3423

Have you tried adding this jar file as a dependency to BuildConfig.groovy? Let Grails handle all dependencies.

Upvotes: 0

wishihadabettername
wishihadabettername

Reputation: 14751

a low-level approach: run ProcessMonitor (which now integrates the formerly separate File Monitor). With it you can see what class file the JVM is searching for.

Also, you can add -verbose:class to the JAVA_OPTS defined in startGrails/startGrails.bat in the bin directory of grails. This will show the output (verbose!) from the class loader.

Possibly there are other JARs that are needed.

Upvotes: 1

Related Questions