Thanks, Alan. That's a very useful trick. Interestingly, adding
"(?ERROR getStackTrace)" to your code caused me another error :-D that I
won't bother to follow up for the moment. To get the full stacktrace in
7.0 using the shell or batch files, Dr Friedman-Hill suggests "jess
-stacktrace filename.clp" If you are developing in Eclipse, cd into the
top level directory for the project (in my case $WORKSPACE/markets for
the markets project) and call ~/Jess70b2/bin/jess -stacktrace
testing.clp (this is in Linux).
What I don't understand is why I would get the error in command-line
Jess when I don't get it calling the same methods in Java. Does Jess
use a different classpath -- even in Eclipse? Perhaps there is a
different static initialiser? The point for me is that developing
command-line and java in parallel helps both for development and in
debugging provided that they work in the same way. And doing both in
Eclipse is much more efficient that doing them in line or screen
editors. The Jess plugin for Eclipse is really cool and generally works
very well. Whilst I have a work-around here (using Java's Random
class), I thought that it would be good if either Java-embedded Jess and
command-line Jess would work the same way or if, where something extra
needs to be done to make them work the same way, the different
requirements were documented.
I'm a social simulation modeller. One thing I find really good about
Jess (I've only been using it for a few weeks) is the flexibility it
gives you to represent procedural knowledge procedurally and declarative
knowledge declaratively. But I would very much like them to work
consistently across development environments as well as platforms.
scott
Alan Moore wrote:
Also, in testing.clp, you can place the following code to help you
debug the exception:
;; untested...ymmv
(try
(bind ?user-agent (new User "harvey"))
catch
;; ?ERROR will be the caught throwable
(printout t "ERROR = " (?ERROR toString) crlf)
(printout t "cause = " ((?ERROR getCause) toString) crlf)
;; etc...
)
alan
Scott Moss wrote:
Hi.
In starting to sort out how to run Jess from Java as you suggested, I
first ran the test file from Jess command line in a bash shell. The
error message was now:
Jess> (batch testing.clp)
(deftemplate MAIN::agent
"$JAVA-OBJECT$ org.cfpm.markets.User"
(declare (from-class org.cfpm.markets.User))
(multislot attribute_demands)
(slot class)
(multislot location)
(slot name)
(slot OBJECT))
Jess reported an error in routine new
while executing (new User "harvey")
while executing (bind ?user-agent (new User "harvey"))
while executing (batch testing.clp).
Message: Constructor threw an exception.
Program text: ( batch testing.clp ) at line 1.
Nested exception is:
uchicago/src/sim/util/Random
So from Eclipse, the nexted exception is reported as null -- I guess
it isn't picking up the actual error -- while from the command line
call it reports the class giving rise to the exception -- though not
the exception itself. So I dropped the random number generator I was
using (from RePast) and substituted from the standard Java Random
class and this solved the problem.
I wonder if anyone else running Jess with RePast has encountered a
similar problem.
regards
scott
friedman_hill ernest j wrote:
I think Scott Moss wrote:
Jess reported an error in routine new
while executing (new User "harvey")
while executing (bind ?user-agent (new User "harvey")).
Message: Constructor threw an exception.
Program text: ( bind ?user-agent ( new User "harvey" ) ) at line 16.
Nested exception is:
null
Run Jess like this:
java jess.Main -stacktrace myfile.clp
and you'll get a more detailed traceback. You should see the actual
stack trace of the exception the constructor throws. That will surely
give us a clue.
---------------------------------------------------------
Ernest Friedman-Hill Advanced Software Research Phone:
(925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify
[EMAIL PROTECTED]
--------------------------------------------------------------------
--
Professor Scott Moss
Director
Centre for Policy Modelling
Manchester Metropolitan University
Aytoun Building
Manchester M1 3GH
UNITED KINGDOM
telephone: +44 (0)161 247 3886
mobile: +44 (0)7740 942564
fax: +44 (0)161 247 6802
http://cfpm.org/~scott
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------