Hi Mario, Although I fixed the no-validation problem by uninstall/reinstall the drools runtime as my last message said, it is not a stable solution. Sometimes it stops to do validation again so I have to repeat the steps.
So I look into the code, and find out "oldLoader" is an instance of ContextFinder, but "newLoader" is an instance of URLClassLoader, both are subclass of ClassLoader. So I construct a ContextFinder from newLoader and use it in setContextClassLoader(). This fixes the problem on my side. Now I have both validation and recognition of third party classes. As I said earlier, I know nothing of eclipse plugin development. Please let me know if it makes sense. But anyway, it works with my environment. Below please find diff of my updates. Thank you very much. Jinghai --- a/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/builder/DroolsBuilder.java +++ b/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/builder/DroolsBuilder.java @@ -64,6 +64,7 @@ import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.internal.adaptor.ContextFinder; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; @@ -124,8 +125,9 @@ public class DroolsBuilder extends IncrementalProjectBuilder { ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); ClassLoader newLoader = ProjectClassLoader.getProjectClassLoader( project ); + ContextFinder newContextFinder = new ContextFinder(newLoader); try { - Thread.currentThread().setContextClassLoader( newLoader ); + Thread.currentThread().setContextClassLoader( newContextFinder ); IClasspathEntry[] classpathEntries = project.getRawClasspath(); for ( int i = 0; i < classpathEntries.length; i++ ) { if ( NewDroolsProjectWizard.DROOLS_CLASSPATH_CONTAINER_PATH.equals( classpathEntries[i].getPath().toString() ) ) { -- View this message in context: http://drools.46999.n3.nabble.com/Compilation-errors-in-Drools-examples-tp4027650p4029892.html Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users