[rules-users] Can't merge packages with different names. -- PackageException

Krishnan krishiyer at gmail.com
Wed Aug 22 16:45:29 EDT 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070822/612b329f/attachment.html 


More information about the rules-users mailing list