[rules-users] How to create binary package

Barfield Steve Steve.Barfield at uk.fujitsu.com
Tue Jul 10 12:30:03 EDT 2007


Is Package.writeExternal(ObjectOutput) the best way to create a binary file of your package that can be read by BinaryRuleBaseLoader.addPackage(InputStream) ?

 

Having generated a package using standard code, I've tried to create a binary file of the package for deployment as below. 

 

But when BinaryRuleBaseLoader reads the binary file it raises :

Can only add instances of org.drools.rule.Package to a rulebase instance.

 

Looking inside the binary file I can see it doesn't have the first line :

 

’__sr__org.drools.rule.Package_______@

 

which is found in packages downloaded from JBRMS. So this code isn't quite working. Please can you help.

 

builder.addPackageFromDrl(source);

Package pkg = builder.getPackage();

try{

        FileOutputStream tempFile = new

        FileOutputStream("my.pkg");

        ObjectOutput oos = new ObjectOutputStream(tempFile);

         pkg.writeExternal(oos);

         oos.flush();

         oos.close();

                   

          tempFile.flush();

          tempFile.close();

}           

catch(Exception e){

            System.out.println(e.toString());

}

 

 

Regards, Steve Barfield, Developer 

Application Services

FUJITSU SERVICES

Cavendish Road, Stevenage, Herts, SG1 2DY

* +44 (0) 870 234 8197 (Int: 7444 8197)

* +44 (0) 7867 828474 

* <mailto:steve.barfield at uk.fujitsu.com <mailto:steve.barfield at uk.fujitsu.com> >

Web: http://uk.fujitsu.com <http://uk.fujitsu.com/> 

Fujitsu Services Limited, Registered in England no 96056, Registered Office 22 Baker Street, London, W1U 3BW

This e-mail is only for the use of its intended recipient. Its contents are subject to a duty of confidence and may be privileged. Fujitsu Services does not guarantee that this e-mail has not been intercepted and amended or that it is virus-free.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070710/7ac910fa/attachment.html 


More information about the rules-users mailing list