Compilation errors in Drools examples

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Compilation errors in Drools examples

B Butler
Hi,

I installed Drools 6.0.1.Final and am trying out the drools-examples.

When I imported the drools-examples project into eclipse, 185 compilation errors appear. I am using Java 7.

There are lots of "ArrayList is a raw type.." which for some reason is being treated as an error, rather than a warning...

Other frequent errors are:
ConstraintParser cannot be resolved
Error importing: 'org.drools.games.wumpus.view.GameUI'
IOUtils cannot be resolved
MigLayout cannot be resolved to a type

There is even
Resource leak: 'fmt' is never closed

The runtime I use from eclipse is the binaries directory under drools-distribution-6.0.1.Final.

It looks like there are missing dependencies in the Drools Library. I'd prefer not to track them down individually (which is error prone because of incompatible versions, etc.). I would welcome any advice on how to resolve this issue.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

mkalose
I am facing the same set of errors for 6.0.1 Final.
Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

J Rose
Any solution to this item?  I am having the same errors.
rjh
Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

rjh
In reply to this post by B Butler
I have the same problem. It seems like the drool eclipse plugin can't recognize third party classes (any jar files besides those within JRE runtime and Drools runtime). Despite of the error messages, you can execute the java application correctly.

However, I have asked around in this forum, in jira, and writing personal email to Kris Verlaenen and Mario Fusco, but no response at all!!

Below are my posts regarding this problem:

http://drools.46999.n3.nabble.com/rules-users-Drools-eclipse-plugin-problem-td4029476.html

https://issues.jboss.org/browse/DROOLS-472

Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

Mario Fusco
Hi,

I didn't receive any personal email on this issue or at least I cannot find it at the moment. Anyway sending personal emails complaining for a certain defect or missing feature isn't of course a good idea.

I'll try to fix this issue asap.

Thanks for having reported it,
Mario
rjh
Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

rjh
Hi Mario,

Thank you so much for taking care of this problem. I was pretty frustrated by this problem and I got no  answer after asking around. I thought it could relate to another problem you solved earlier (http://drools.46999.n3.nabble.com/rules-users-Drool-6-0-0-Final-2-question-re-kie-maven-plugin-please-td4027117.html). So I sent an email to the email address you are using for this mailing list. I am sorry to bother you with this.

Thanks.

Jinghai
Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

Mario Fusco
Hi,

I fixed this issue on master with this commit: https://github.com/droolsjbpm/droolsjbpm-tools/commit/6bc54748e
This fix will be also backported to 6.0.x branch asap.

Mario
Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

J Rose
Thanks so much for responding!
rjh
Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

rjh
In reply to this post by Mario Fusco
Hi Mario,

Thanks for fixing the problem. I just installed the plugin, but this time, it stops doing validation. It doesn't report any error in the .drl file, even for obvious syntax errors.

Below is the steps I did:
1. git clone https://github.com/droolsjbpm/droolsjbpm-tools.git
2. cd droolsjbpm-tools/
3. mvn clean install -DskipTests (the build is successfully)
4. Add a local update site to eclipse. The path is droolsjbpm-tools/drools-eclipse/org.drools.updatesite/target/repository/
5. Install the plugins. The version number seen after installation is: 6.1.0.201406031754
6. Create a new example Drools project. I intentionally made some mistakes, but there is no error message in eclipse editor. However, if I switch to Rete Tree tab, I get the following message:

"Rete Tree Build Error!

Reason:
java.lang.Exception: Unable to parse rules to show RETE view! 2 build errors. "

My environment is same as reported in jira.

If you need further information, please let me know.

Thanks.

Jinghai
Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

Mario Fusco
Hi Jinghai,

I cannot reproduce the last issue you're reporting. Every time I introduce an error both in the java and in the drl code it is reported correctly.
Can you be a bit more explicit about this or even better attaching to the jira ticket a simple project reproducing this issue?

Thanks,
Mario
rjh
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Compilation errors in Drools examples

rjh
Hi Mario,

I am not familiar with Eclipse plugin development so I don't know how I can make it easier to reproduce on your side. I just tested with the default drools sample project and change a "when" to "when1" in Sample.drl. 

However, I am almost sure this is caused by the latest commit. I did a git revert to the previous commit (5b7101f13cf6eb6bb3cea37638b0d9d982a6b10b "disabled enforce-plugin-version rule"), and this error can be detected (see attached ScreenShot1.png). However, the plugin built with the latest commit can't detect it (ScreenShot2.png). I tried to clean/rebuild the project and re-import, but the result is all the same. 

Please let me know if I can provide more information by any means. 

Thank you very much.

Jinghai



On Wed, Jun 4, 2014 at 10:26 AM, Mario Fusco <[hidden email]> wrote:
Hi Jinghai,

I cannot reproduce the last issue you're reporting. Every time I introduce
an error both in the java and in the drl code it is reported correctly.
Can you be a bit more explicit about this or even better attaching to the
jira ticket a simple project reproducing this issue?

Thanks,
Mario



--
View this message in context: http://drools.46999.n3.nabble.com/Compilation-errors-in-Drools-examples-tp4027650p4029871.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users

ScreenShot1.png (819K) Download Attachment
ScreenShot2.png (795K) Download Attachment
rjh
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Compilation errors in Drools examples

rjh
In reply to this post by Mario Fusco
Hi Mario,

I am not familiar with Eclipse plugin development so I don't know how I can make it easier to reproduce on your side. I just tested with the default drools sample project and change a "when" to "when1" in Sample.drl. 

However, I am almost sure this is caused by the latest commit. I did a git revert to the previous commit (5b7101f13cf6eb6bb3cea37638b0d9d982a6b10b "disabled enforce-plugin-version rule"), and this error can be detected (see attached ScreenShot1.jpg). However, the plugin built with the latest commit can't detect it (ScreenShot2.jpg). I tried to clean/rebuild the project and re-import, but the result is all the same. 

Please let me know if I can provide more information by any means. 

Thank you very much.

Jinghai


On Wed, Jun 4, 2014 at 10:26 AM, Mario Fusco <[hidden email]> wrote:
Hi Jinghai,

I cannot reproduce the last issue you're reporting. Every time I introduce
an error both in the java and in the drl code it is reported correctly.
Can you be a bit more explicit about this or even better attaching to the
jira ticket a simple project reproducing this issue?

Thanks,
Mario



--
View this message in context: http://drools.46999.n3.nabble.com/Compilation-errors-in-Drools-examples-tp4027650p4029871.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users

ScreenShot1.jpg (315K) Download Attachment
ScreenShot2.jpg (305K) Download Attachment
rjh
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Compilation errors in Drools examples

rjh
In reply to this post by Mario Fusco
Hi Mario,

I am not familiar with Eclipse plugin development so I don't know how I can make it easier for you to reproduce on your side. My project is the simplest drools sample project and I just changed "when" to "when1" in Sample.drl. 

However, I am almost sure this is caused by the latest commit. I did a git revert to the previous commit (5b7101f13cf6eb6bb3cea37638b0d9d982a6b10b "disabled enforce-plugin-version rule"), and this error can be detected (see attached ScreenShot1.jpg). However, the plugin built with the latest commit can't detect it (ScreenShot2.jpg). I tried to clean/rebuild the project and re-import, but the results are all the same. 

Please let me know if I can provide more information by any means. 

Thank you very much.

Jinghai


On Wed, Jun 4, 2014 at 10:26 AM, Mario Fusco <[hidden email]> wrote:
Hi Jinghai,

I cannot reproduce the last issue you're reporting. Every time I introduce
an error both in the java and in the drl code it is reported correctly.
Can you be a bit more explicit about this or even better attaching to the
jira ticket a simple project reproducing this issue?

Thanks,
Mario



--
View this message in context: http://drools.46999.n3.nabble.com/Compilation-errors-in-Drools-examples-tp4027650p4029871.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users

ScreenShot1.jpg (218K) Download Attachment
ScreenShot2.jpg (210K) Download Attachment
rjh
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Compilation errors in Drools examples

rjh
Hi Mario,

I found my issue can be solved by deleting the drools runtime from eclipse and re-add it. Now everything is good.

Thank you very much.

Jinghai

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
rjh
Reply | Threaded
Open this post in threaded view
|

Re: Compilation errors in Drools examples

rjh
In reply to this post by Mario Fusco
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() ) ) {