Hi,
I'm sure this is a trivial error and I'm going to kick myself when someone
tells me what I've done wrong, but here goes anyway:

I'm trying to create shadow facts that subclass a deftemplate that's
already been added to the Rete. When I try and add the java bean using
definstance I get a ClassCastException as follows:

java.lang.ClassCastException
      at jess.DefinstanceList.createNewShadowFact(DefinstanceList.java:206)
      at jess.DefinstanceList.definstance(DefinstanceList.java:275)
      at jess.Rete.definstance(Rete.java:1317)
      at jess.Rete.definstance(Rete.java:1309)
      at
jess.extensions.test.framework.JessTestCase.assertOrder(JessTestCase.java:83)
      at
jess.extensions.test.framework.MyTest.testSetTagValue(MyTest.java:175)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ...

I've traced it through and it looks as though (through a beginner's eyes at
least :-) a Value object with an m_object value of "nil" has appeared in
the template so when the DefinstanceList tries to cast it to a
(SerializablePD) it goes bang.

The problem is I don't know where the nil Value is coming from. It always
seems to be the second property that it tries though. The first (a property
of type long) seems to succeed without exception.

Does anyone know why I might be getting this?

Before I try and define the instance, I'm running the following setup code:

executeCommand("(deftemplate orders (slot orderId) (slot Tag8))"); //stub
method that just creates the superclass template I'm trying to extend in
the Rete
rete.defclass("test-orders", "jess.extensions.test.templates.Order",
"orders"); //define the test-orders class as a subclass of "orders" as
defined above
rete.definstance("test-orders", order, true); //create the shadow fact
based on an object of type jess.extensions.test.templates.Order

The first two commands succeed. The third fails with the ClassCastException
shown above.

The Order class itself has about 35 fields, two of which override the slots
created in the deftemplate command shown above. Interestingly, the one
property-to-slot conversion that succeeds before the ClassCastException is
thrown is for the first of these two slots (orderId). It is not an explicit
subclass of any other object - if that makes a difference, which I wouldn't
expect.

Can anyone shed any light on why this is happening and the definstance
fails?

Any help would be very gratefully received.

Thanks in advance
David


----------------------------------------------------------------------------------------------------------------------------------------------------------------

                              <<Disclaimer>>
This message contains confidential information and is intended only for the
named individual.  If you are not the named addressee, you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this message in error and delete
this e-message from your system.

E-mail transmission cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed, delayed in
transmission, incomplete, or may contain viruses. The sender therefore does
not accept liability for any errors or omissions in the contents of
this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version. This message
is provided for informational purposes and should not be construed as a
solicitation or offer to buy or sell any securities or related financial
instruments.

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to