Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Groovy classloader how put dependent classes on classpath

jsteenbeFeb 9 2012
I made a solution where groovy code is loaded from database dynamically
and executed embedded in our application. Each groovy class implements a java interface.
However the problem is that I want to provide a number of helper classes to be used
from the groovy code. Our applications consist of adf faces and java web services.

I do something like this to load source into class :

GroovyClassLoader gcl = new GroovyClassLoader();
Class clazz;
clazz = gcl.parseClass(sourceCode);
Object obj = clazz.newInstance();

I can put the jars that I want to be available from groovy on the classpath, into
the lib folder of my domain in weblogic and then they are available.

Unfortunately the jars also have dependencies and I find it difficult to control that the dependencies are resolved in the right order.
I can add the jars to my application that loads and invokes the classes, however that does not make the classses visisble to groovy.

How is this normally solved ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 8 2012
Added on Feb 9 2012
0 comments
392 views