17

I am trying to use JPL for the interaction of Java programs and YAP Prolog.

In my java file, this line is throwing an exception:

Query query = new Query("consult", new Term[] { new Atom("test.pl") });

The exception is shown below:

Exception in thread "main" jpl.JPLException: this Query's engine is not that which is attached to this thread
at jpl.Query.close(Query.java:511)
at jpl.Util.textToTerm(Util.java:165)
at jpl.Query.Query1(Query.java:183)
at jpl.Query.<init>(Query.java:176)
at Test.main(Test.java:12)

Although I did not find someone reporting the same problem in YAP, some people were having this problem with SWI, and they were advised to verify that SWI was compiled with multi-threading support. Just in case I compiled YAP with support for multithreading, but it did not help.

This problem is happening only in OS X, I tried in Ubuntu and everything works fine there.

Does someone know a workaround for this problem in OS X?

Sergio
  • 8,532
  • 11
  • 52
  • 94

2 Answers2

2

After updating Yap to 6.2.2 JPL is working correctly. Unfortunately I cannot be completely sure that the problem was indeed linked to the previous Yap version I was using (6.2.0) or it was related to something else.

Sergio
  • 8,532
  • 11
  • 52
  • 94
0

Looks like you have to set a special use-flag to support threading in swi-prolog.

Look here for more details:

http://comments.gmane.org/gmane.comp.ai.prolog.swi/5335

Roman Goyenko
  • 6,965
  • 5
  • 48
  • 81
  • Hi. Yes, I saw that some people related this problem with the logic engine not supporting multi threading. However adding multi threading support did not help (as I wrote in the question). Anyway, I am happy the problem is solved, if I get a clue of why it occured I will update it here. Right now I think that maybe it was just related to a bug in the version of Yap I was using, but I am not really sure. – Sergio Nov 03 '11 at 21:11