tags:

views:

672

answers:

2

Hi there!

How can I access or better pass on a bunch of domain classes from a controller in Grails to a quite simple java program residing in src/java within the grails tree? I always get a ClassNotFoundException for the domain classes, regardless in which package I put them in. There's no auto-completion pointing to the domain classes when trying to import them using Eclipse.

I want to use grails only as a prototype frontend for easy input and output for my java app. So any quick and not so dirty idea is welcome.

A: 

You will probably need to specify some more about how you are running your application to give some ideas about classloaders and why the classloadfer from your java application is not finding the classes.

The architectural view of this is that you are best to use Grails services to access your back end application. If you declare properties named xxxService in your controllers you will get a service instance injected into your controller which you can then use to invoke the required functionality.

Peter Kelley
+1  A: 

Hi!

I solved it on my own simply by adding the path %userprofile%\.grails\<grails-ver>\projects\<my-project>\classes to the system classpath. Everything works now as expected.

Weird problem, probably I missed something when setting up grails, Eclipse etc...

Thanks everyone :)