Hello,
 
I am trying to deserialize rule package from disk. However, I am getting the following exception. I have also included the code that I use to deserialize rule packages. I found only one link on the web that describes this issue after looking around: http://www.mail-archive.com/user@drools.codehaus.org/msg01731.html. But there was no solution or help there. Any idea?
 
I am using drools 3.0.5 and Java 1.5.
 
Caused by: java.lang.ClassNotFoundException: [Lorg.drools.rule.Declaration;
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.drools.rule.PackageCompilationData$PackageClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.drools.common.ObjectInputStreamWithLoader.resolveClass(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readArray(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.HashMap.readObject(Unknown Source)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.drools.rule.PackageCompilationData.readExternal(Unknown Source)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.drools.rule.Package.readExternal(Unknown Source)
at com.cisco.cp.engine.util.CPRuleUtil$CPRuleFileHelper.getRulePackage(CPRuleUtil.java:654)
... 26 more
 
 
 
private Package getRulePackage(File file) throws Exception {
    // Make sure file is a valid rule file with the proper rule file
    // ... type.
    if(file == null) {
        throw new Exception("File argument is null");
    }
    if(!file.exists()) {
        throw new Exception("File does not exist");
    }
 
    FileInputStream ruleFileInputStream = null;
    ObjectInputStream ruleObjectInputStream = null;
    Reader ruleFileReader = null;
    Package rulePackage = null;
 
    try {
        rulePackage = new Package();
        // If the rule file is already compiled, then we just have
        // ... read it through object input stream.
        ruleFileInputStream = new FileInputStream(file);
        ruleObjectInputStream =
            new ObjectInputStream(ruleFileInputStream);
        rulePackage.readExternal(ruleObjectInputStream);
        // Validate the package - this will throw exception if there
        // ... were any error in the package.
        rulePackage.checkValidity();
    }
    finally {
        if (rulePackage != null &&
                rulePackage.getErrorSummary() != null &&
                !rulePackage.getErrorSummary().equals("")) {
            System.out.println("RULE FILE ERRORS: " +
            rulePackage.getErrorSummary());
        }
        if (ruleObjectInputStream != null) {
            ruleObjectInputStream.close();
        }
        if (ruleFileInputStream != null) {
            ruleFileInputStream.close();
        }
        if (ruleFileReader != null) {
            ruleFileReader.close();
        }
    }
    return rulePackage;
}



Looking for last minute shopping deals? Find them fast with Yahoo! Search.