Krishnan,

   As your files have different package names:

com.company.a;
com.company.b;
 
   You need to use different package builders for them. I.e., you can use the same PackageBuilder to build multiple files only if the files share the same package name.

    []s
    Edson

 
2007/8/22, Krishnan <krishiyer@gmail.com>:

Hi All,

When I migrated to use the latest 4.0 GA release jars, loading of my rule files fails.

I have basically split my rule files into hierarchies as below :-

Directory structure

rules\a\A.drl
rules\b\B.drl

A.drl

com.company.a;

some rules ... 

B.drl

com.company.b;

some rules ...

Java code to load the rules

//read in the source
final Reader source = new InputStreamReader(new FileInputStream(ruleFile));

//this will parse and compile in one step
//NOTE: There are 2 methods here, the one argument one is for normal DRL.
builder.addPackageFromDrl (source);

builder is created as follows :-

private PackageBuilder getPackageBuilder() {
//Use package builder to build up a rule package.
//An alternative lower level class called "DrlParser" can also be used...

PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
JavaDialectConfiguration javaConf = (JavaDialectConfiguration) conf.getDialectConfiguration( "java" );
javaConf.setJavaLanguageLevel ("1.5");
PackageBuilder builder = new PackageBuilder(conf);

return builder;
}

Exception I get is as follows :-

EXCEPTION [org.drools.compiler.PackageBuilder$PackageMergeException: Can't merge packages with different names. This package: com.makesys.fs.is.dnpiac.vendorBehaviour.snmp - New package: com.makesys.fs.is.dnpiac.vendorBehaviour.cli]
STACK [org.drools.compiler.PackageBuilder$PackageMergeException: Can't merge packages with different names. This package: com.makesys.fs.is.dnpiac.vendorBehaviour.snmp - New package: com.makesys.fs.is.dnpiac.vendorBehaviour.cli
at org.drools.compiler.PackageBuilder.validatePackageName (PackageBuilder.java:299)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:226)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:160)
at com.makesys.fs.is.dnpiac.DNPIACConfigReaderHelper.loadRuleFile (DNPIACConfigReaderHelper.java:359)
at com.makesys.fs.is.dnpiac.DNPIACConfigReaderHelper.loadRuleFiles(DNPIACConfigReaderHelper.java:426)
at com.makesys.fs.is.dnpiac.DNPIACConfigReaderHelper.loadRuleFiles(DNPIACConfigReaderHelper.java :380)
at com.makesys.fs.is.dnpiac.DNPIACConfigReaderHelper.initializeParams(DNPIACConfigReaderHelper.java:531)
at com.makesys.fs.is.dnpiac.DNPIAutoConfigurationAdapter.collect(DNPIAutoConfigurationAdapter.java:61)
at com.makesys.fs.app.adapter.BaseAdapter.activate(BaseAdapter.java:177)
at com.makesys.fs.app.adapter.UnicastAdapterImpl.activate(UnicastAdapterImpl.java:109)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall (Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java :595)
]


Not sure what the issue is. Any ideas ?

TIA,
Krishnan

--
Sivaramakrishna Iyer Krishnan (Anand)

Never assume the obvious is true.
- William Safire

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com