0 Replies Latest reply on Nov 20, 2006 3:28 PM by paramsevak

    Error loading/compiling rules in weblogic


      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();
      PackageBuilder builder = new PackageBuilder(pkgBuilderCfg);
      builder.addPackageFromDrl((new InputStreamReader(new FileInputStream("c:\\Sample.drl"))) );
      RuleBase ruleBase = RuleBaseFactory.newRuleBase();
      ruleBase.addPackage( builder.getPackage() );
      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"
      m : Message( status == Message.HELLO, message : message )
      System.out.println( message );
      m.setMessage( "Goodbye cruel world" );
      m.setStatus( Message.GOODBYE );
      PAYMENT_RESULT = "Goodbye cruel world";
      modify( m );

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


      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.