[jboss-user] [Installation, Configuration & Deployment] - Error loading/compiling rules in weblogic

paramsevak do-not-reply at jboss.com
Mon Nov 20 15:28:18 EST 2006


I am trying to  load/compile and run rules within a weblogic J2ee Container and am unfortunately running into a problem where no exceptions are being thrown and the server is forcefully shutdown. I am able to get it working, even with the JANINO compiler, outside of the j2ee container. 

The following is a code snippet I am trying to run from within a action in the J2ee container

PaymentRulesService paymentService = new PaymentRulesService();// LookupService.getPaymentRulesService( data.getServletContext() );
	        
			PackageBuilderConfiguration pkgBuilderCfg = new PackageBuilderConfiguration();
			pkgBuilderCfg.setJavaLanguageLevel("1.4");
			pkgBuilderCfg.setCompiler(1);
            PackageBuilder builder = new PackageBuilder(pkgBuilderCfg);
       builder.addPackageFromDrl((new InputStreamReader(new FileInputStream("c:\\Sample.drl"))) );
            RuleBase ruleBase = RuleBaseFactory.newRuleBase();
            ruleBase.addPackage( builder.getPackage() );
            paymentService.setRuleBase(ruleBase);
            ArrayList objectArray = new ArrayList();
            //go !
            Message message = new Message();

            message.setMessage( "Hello World" );
            message.setStatus( Message.HELLO );
            objectArray.add( message );

            String ruleResult = paymentService.firePaymentRules( objectArray );


I have colored the line where the error occurs in red. Also the following is the drl file. It is a slight modification of the Hello World example.

package com.sample.rules.resource
 
import com.sample.DroolsTest.Message;
global java.lang.String PAYMENT_RESULT;
 
rule "Hello World"
	when
		m : Message( status == Message.HELLO, message : message )
	then
		System.out.println( message ); 
		m.setMessage( "Goodbye cruel world" );
		m.setStatus( Message.GOODBYE );
		PAYMENT_RESULT = "Goodbye cruel world";
		modify( m );
end

rule "GoodBye"
	no-loop true
	when
		m : Message( status == Message.GOODBYE, message : message )
	then
		System.out.println( message ); 
		m.setMessage( message+" tests" );
		PAYMENT_RESULT = message+" tests";
		
end

 I have tried to keep everything simple. It is extremely strange how this works perfectly fine when I run this outside of weblgic.


Any Help is greatly appreciated.

Thanks

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987402#3987402

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987402



More information about the jboss-user mailing list