I continue to be confused about how to add a Bean as a shadow fact.  In the code below, there are four commented out lines that define a new fact and set the slot values and the subsequent code runs (not shown).   But the patient object already exists and can be accessed by getPatient(), so I thought it would be more concise to use r.add(getPatient());  This failed with a class not found error, so I added the r.importClass statement.  Nevertheless, I continue to receive a class not found error.  The trace is shown below the code.  This all gets back to my questions about how to educate the Rete object about available Java objects, etc.  Thanks.

public void fireRulesEngine() {
Rete r = GlucosePlugin.getDefault().getRete();

r.watchAll();
try {
r.reset();
r.importClass("edu.utah.cdmcc.entities.Patient");
// Fact patientFact = new Fact("patient",r);
// patientFact.setSlotValue("age", new Value(getPatient().getAgeYears(), RU.INTEGER));
// patientFact.setSlotValue("weight", new Value(getPatient().getWeight(), RU.FLOAT));
// r.assertFact(patientFact);
r.add(getPatient());  
etc. more code


FAILURE TRACE FOLLOWS:

Calculate selection event inside composite
Event received by editor
 ==> Focus MAIN
 ==> f-0 (MAIN::initial-fact)

An error occurred at line -1 which looks like null

Message: Class not found
Jess reported an error in routine import.
  Message: Class not found.
at jess.ClassSource.importClass(ClassSource.java:201)
at jess.Rete.importClass(Rete.java:2817)
at edu.utah.cdmcc.entities.PatientEditor.fireRulesEngine(PatientEditor.java:126)
at edu.utah.cdmcc.entities.PatientEditor.widgetSelected(PatientEditor.java:114)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1496)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1505)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3312)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2941)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at edu.utah.cdmcc.decisionsupport.glucose.Application.run(Application.java:18)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.ClassNotFoundException: edu.utah.cdmcc.entities.Patient
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:407)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at jess.ClassSource.classForName(ClassSource.java:131)
at jess.ClassSource.findClass(ClassSource.java:159)
at jess.ClassSource.importClass(ClassSource.java:196)
... 29 more

Reply via email to