[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1946) Deserializing a KnowledgeBase object throws a java.io.EOFException

Nestor Tarin Burriel (JIRA) jira-events at lists.jboss.org
Wed Sep 2 06:22:23 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBRULES-1946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12484112#action_12484112 ] 

Nestor Tarin Burriel commented on JBRULES-1946:
-----------------------------------------------

Hi,

I'm using this 3 methods for serializing my KnowledgeSession:

	public void saveKSession(FileOutputStream out) throws IOException {

		DroolsObjectOutputStream droolsOut = new DroolsObjectOutputStream(out);
		droolsOut.writeObject(ksession.getKnowledgeBase());
		Marshaller mas = createMarshaller(ksession.getKnowledgeBase());
		mas.marshall(droolsOut, ksession);
	}

	public void loadKsession(FileInputStream input) throws IOException,
			ClassNotFoundException {

		DroolsObjectInputStream droolsIn = new DroolsObjectInputStream(input);
		KnowledgeBase kbase = (KnowledgeBase) droolsIn.readObject();
		Marshaller mas = createMarshaller(kbase);
		ksession = mas.unmarshall(droolsIn);
	}

	private Marshaller createMarshaller(KnowledgeBase kbase) {
		ObjectMarshallingStrategyAcceptor acceptor = MarshallerFactory
				.newClassFilterAcceptor(new String[] { "*.*" });
		ObjectMarshallingStrategy strategy = MarshallerFactory
				.newSerializeMarshallingStrategy(acceptor);
		return MarshallerFactory.newMarshaller(kbase,
				new ObjectMarshallingStrategy[] { strategy });
	}

When the ksession has the WorkingMemory empty everything works fine, but if the WM has facts when loading I get the EOF error listed above.

Hope to help,

Nestor

> Deserializing a KnowledgeBase object throws a java.io.EOFException
> ------------------------------------------------------------------
>
>                 Key: JBRULES-1946
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-1946
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core
>    Affects Versions:  5.0.0.M4, 5.0.0.M5
>         Environment: Ubuntu 8.10
>            Reporter: Simon Kelly
>            Assignee: Edson Tirelli
>             Fix For: 5.0.1.FINAL
>
>         Attachments: drools.test.zip, DroolsTest.java, Sample.drl, Sample1.drl, Sandbox2.java
>
>
> A java.io.EOFException is thrown when reading a serialized KnowledgeBase object from a file.
> java.io.EOFException
> 	at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2281)
> 	at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
> 	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
> 	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
> 	at org.drools.common.DroolsObjectInputStream.<init>(DroolsObjectInputStream.java:55)
> 	at org.drools.common.DroolsObjectInputStream.<init>(DroolsObjectInputStream.java:49)
> 	at org.drools.common.AbstractRuleBase.readExternal(AbstractRuleBase.java:227)
> 	at org.drools.reteoo.ReteooRuleBase.readExternal(ReteooRuleBase.java:173)
> 	at org.drools.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:83)
> 	at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
> 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> 	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
> 	at com.sample.DroolsTest.read(DroolsTest.java:75)
> 	at com.sample.DroolsTest.testIO(DroolsTest.java:50)
> 	at com.sample.DroolsTest.main(DroolsTest.java:40)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list