11 Replies Latest reply on Dec 7, 2009 11:30 AM by Lars Rödiger

    NullPointerException while deploying  drools serviceunit into servicemx

    Amit Amit Newbie

      I have created service unit with maven archetype (mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-drools-service-unit -DgroupId=drools.first.example -DartifactId=drools-first-example)

       

      modified the drl file

      .......................

       

      package org.apache.servicemix.drools

       

      import org.apache.servicemix.drools.model.Exchange;

       

      global org.apache.servicemix.drools.model.JbiHelper jbi;

       

      rule "Unspecified id"

           when

                me : Exchange( status == Exchange.ACTIVE, $in : in != null )

           then     

       

                System.out.println("printing................");

      end

       

      and added it to service assembly.

       

      while deploying the SA into service mix(mvn jbi:projectDeploy) getting the following error.

       

       

      Caused by: javax.jbi.management.DeploymentException: <component-task-result xmlns="http://java.sun.com/xml/ns/jbi/management-

      message">

              <component-name>servicemix-drools</component-name>

              <component-task-result-details>

                      <task-result-details>

                              <task-id>start</task-id>

                              <task-result>FAILED</task-result>

                              <message-type>ERROR</message-type>

                              <task-status-msg><msg-loc-info><loc-token/><loc-message>Unable to start service unit</loc-message></m

      sg-loc-info></task-status-msg>

                              <exception-info>

                                      <nesting-level>1</nesting-level>

                                      <msg-loc-info>

                                              <loc-token />

                                              <loc-message>java.lang.NullPointerException</loc-message>

                                              <stack-trace><![CDATA[javax.jbi.JBIException: java.lang.NullPointerException

              at org.apache.servicemix.drools.DroolsEndpoint.start(DroolsEndpoint.java:207)

              at org.apache.servicemix.common.DefaultServiceUnit.start(DefaultServiceUnit.java:78)

              at org.apache.servicemix.common.BaseServiceUnitManager.start(BaseServiceUnitManager.java:155)

              at org.apache.servicemix.jbi.deployer.artifacts.ServiceUnitImpl.start(ServiceUnitImpl.java:123)

              at org.apache.servicemix.jbi.deployer.artifacts.ServiceAssemblyImpl.changeState(ServiceAssemblyImpl.java:298)

              at org.apache.servicemix.jbi.deployer.artifacts.ServiceAssemblyImpl.transition(ServiceAssemblyImpl.java:274)

              at org.apache.servicemix.jbi.deployer.artifacts.ServiceAssemblyImpl.init(ServiceAssemblyImpl.java:136)

              at org.apache.servicemix.jbi.deployer.impl.Deployer.registerServiceAssembly(Deployer.java:454)

              at org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:97)

              at org.apache.servicemix.jbi.deployer.impl.DeploymentService.deploy(DeploymentService.java:95)

              at org.apache.servicemix.jbi.deployer.impl.AdminCommandsImpl.deployServiceAssembly(AdminCommandsImpl.java:179)

              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 com.sun.jmx.mbeanserver.StandardMetaDataImpl.invoke(StandardMetaDataImpl.java:414)

              at javax.management.StandardMBean.invoke(StandardMBean.java:323)

              at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)

              at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)

              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)

              at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)

              at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1410)

              at javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81)

              at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1247)

              at java.security.AccessController.doPrivileged(Native Method)

              at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1350)

              at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:784)

              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)

      Caused by: java.lang.NullPointerException

              at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:47)

              at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)

              at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)

              at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)

              at org.drools.compiler.RuleBaseLoader.loadFromReader(RuleBaseLoader.java:38)

              at org.apache.servicemix.drools.DroolsEndpoint.start(DroolsEndpoint.java:205)

              ... 37 more

      ]]]]><![CDATA[></stack-trace>

                                      </msg-loc-info>

                              </exception-info>

                      </task-result-details>

              </component-task-result-details>

      </component-task-result>

              at org.apache.servicemix.common.BaseServiceUnitManager.failure(BaseServiceUnitManager.java:292)

              at org.apache.servicemix.common.BaseServiceUnitManager.start(BaseServiceUnitManager.java:162)

              at org.apache.servicemix.jbi.deployer.artifacts.ServiceUnitImpl.start(ServiceUnitImpl.java:123)

              at org.apache.servicemix.jbi.deployer.artifacts.ServiceAssemblyImpl.changeState(ServiceAssemblyImpl.java:298)

              at org.apache.servicemix.jbi.deployer.artifacts.ServiceAssemblyImpl.transition(ServiceAssemblyImpl.java:274)

              at org.apache.servicemix.jbi.deployer.artifacts.ServiceAssemblyImpl.init(ServiceAssemblyImpl.java:136)

              at org.apache.servicemix.jbi.deployer.impl.Deployer.registerServiceAssembly(Deployer.java:454)

              at org.apache.servicemix.jbi.deployer.impl.ServiceAssemblyInstaller.install(ServiceAssemblyInstaller.java:97)

              ... 29 more

      ]]></stack-trace>

      </exception-info>

      </task-result-details>

      </frmwk-task-result-details>

      </frmwk-task-result>

      </jbi-task-result>

      </jbi-task>

       

      Edited by: amit.b.pal@gmail.com on Jun 12, 2009 1:04 PM

       

      Edited by: amit.b.pal@gmail.com on Jun 12, 2009 1:05 PM

        • 1. Re: NullPointerException while deploying  drools serviceunit into servicemx
          Pedro Neveu Newbie

          Hi,

           

          I tried the scenario that you describe but didn't see the nullpointerexception.

           

          couple of questions:

          - If you don't make any change to the rule do you still get the exception?

          - Which version of servicemix are you using? (i'm using 3.3.1.14)

          - If you hotdeploy do you get the exception?

           

          Thanks,

           

          Pedro

          • 2. Re: NullPointerException while deploying  drools serviceunit into servicemx
            Amit Amit Newbie

            Hi Pedro,

             

            We are using fuse-esb-4.1.0.0 version. We are facing NullPointerException with hotdeployment as well.

             

            I have atached service unit pom file.

             

            This drl file i  have copied it from "http://servicemix.apache.org/servicemix-drools.html" . I have faced errors in rule compilation . I have modified

             

            me : Exchange( status == Exchange.ACTIVE, in : in != null )

            to

             

            me : Exchange( status == Exchange.ACTIVE, $in : in != null ) compilation problems got resolved but ended in NullPointerException.

             

            Thanks,

            Amith.

             

            Edited by: amit.b.pal@gmail.com on Jun 13, 2009 8:42 AM

            • 3. Re: NullPointerException while deploying  drools serviceunit into servicemx
              Pedro Neveu Newbie

              Hi Amith,

               

              I have tried FUSE-ESB-4.1.0.0 and did not get any problem.

               

              Ok here's what I think the problem could be.  You say that you're using the fuse-esb-4.1.0.0 version but in your pom file I see that your repositories are set up to get your architypes from

              &lt;url&gt;http://people.apache.org/repo/m2-ibiblio-rsync-repository</url>

              or

              &lt;url&gt;http://people.apache.org/repo/m2-snapshot-repository</url>

              Does that mean you're using fuse-esb-4.1.0.0 to deploy but the Apache repo to build?  If so I'd advise using the fuse repo for building as well.

               

              I have attached a sample of my testcase.  Let me know if that works for you.

               

              Regards,

               

              Pedro

              • 4. Re: NullPointerException while deploying  drools serviceunit into servicemx
                Pedro Neveu Newbie

                Hi again Amith,

                 

                Just wondering how you're doing with this.  Did the testcase I sent you help?  Do you need further assistance? 

                 

                Let me know if you have more questions.

                 

                Regards,

                 

                Pedro

                • 5. Re: NullPointerException while deploying  drools serviceunit into servicemx
                  Amit Amit Newbie

                  Hi padre,

                   

                  sorry for the late response from me. i am using OSgi componets now. and regarding drools Null point exception, i am facing the same problem now also.i tried with your testcase but in that service assembly jar not including the service-unit jar because of no dependancy in sa pom. i added the dependecy in sa pom, then its giving the same Null pointer exception.

                   

                  I am waiting for ur valuble solution.

                   

                  Thanks

                  • 6. Re: NullPointerException while deploying  drools serviceunit into servicemx
                    Pedro Neveu Newbie

                    Hi Amith,

                     

                    I have modified my testcase a little.  Please take a look at my rule and let me know if it's identical to yours.  Also take a look at the pom and compare with your.  If it's not the same can you please send me your whole testcase and tell me exactly what steps you took to deploy.

                     

                    I have tried to deploy this on ESB 3.4.x and 4.1.0.3 and I still cannot see the NullPointerException.

                     

                    Regards,

                     

                    Pedro

                    • 7. Re: NullPointerException while deploying  drools serviceunit into servicemx
                      Amit Amit Newbie

                      Hi Pedro,

                       

                      Thanks for your Help.

                       

                      We have deployed your component i am still facing the same problem.

                       

                      1.We have build the serive unit. ft951-drools-first-example-1.0-SNAPSHOT.jar generated.

                       

                      2.we have build SA for ft951-sa-1.0-SNAPSHOT.zip 

                       

                      3.we have copied this SA zip file into deploy folder and started the service mix.(4.1.0.1).

                       

                      Nullpointer exception replicated. We have even tried with mvn jbi:projectDeploy.

                      • 8. Re: NullPointerException while deploying  drools serviceunit into servicemx
                        Pedro Neveu Newbie

                        Hi Amith,

                         

                        Sorry for the long silence.  I find this quite strange.  If there were some problems with the drools component we would both see the NullPointerException when deploying the exact same code.  I still cannot reproduce this behavior.  This is symptomatic of a possible environment difference.  Would it be possible for you to try this demo on a different machine?

                         

                        Pedro

                        • 9. Re: NullPointerException while deploying  drools serviceunit into servicemx
                          Marcel Casado Novice

                          Hi,

                           

                          I'm facing the same problem :

                           

                          Caused by: java.lang.NullPointerException

                               at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:47)

                               at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)

                               at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)

                               at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)

                               at edu.ucar.rap.flighthazard.decisionservice.service.impl.SessionManagerImpl.instantiateRuleBase(SessionManagerImpl.java:173)

                               at edu.ucar.rap.flighthazard.decisionservice.service.impl.SessionManagerImpl.initialize(SessionManagerImpl.java:96)

                               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:597)

                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)

                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)

                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)

                           

                          The code runs fine on the IDE but when deployed on Fuse 4.1.0.2  I'm having this exception. My scenario is I have an OSGI bundle with the rules so I don't use the Drools Service engine only import the dependencies from the Drools OSGI bundle (Apache ServiceMix Bundles: drools-4.0.7 (4.0.7.1)) and others. As I said the tests run on my machine but I can not get over this exception when deploying. I also installed a Drools bundle 5.0.1 and tried using some of the new API but still I have the same problem.

                           

                          I'm running this on Mac OS 10.5.8   java 6. i tried it also in a Linux box (Debian) and the same thing.

                           

                          Did you figure out a solution for this problem ? My experience with Drools an OSGI has been really painful for now.I can not get Drools working on FUSE OSGI

                           

                          Thanks,

                           

                          -Marcel

                          • 11. Re: NullPointerException while deploying  drools serviceunit into servicemx
                            Lars Rödiger Newbie

                            Hallo,

                            https://issues.apache.org/activemq/browse/SMXCOMP-662 says that the problem is fixed in version servicemix-drools-2009.02, but I still get the NullpointerException. I run Fuse ESB 4.1.0.2 and made the update to servicemix-drools-2009.02. My bundle just contains a few lines of code:

                             

                            #37: FileInputStream inStream = new FileInputStream(file);

                            #38: InputStreamReader streamReader = new InputStreamReader(inStream);

                            #39: ruleBase = loader.loadFromReader(streamReader);     

                             

                            And here the extract from the error log:

                             

                            java.lang.NullPointerException

                            at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:47)

                            at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)

                            at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)

                            at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)

                            at org.drools.compiler.RuleBaseLoader.loadFromReader(RuleBaseLoader.java:38)

                            at de.droolstest.DroolsRouter$DroolsProcessor.process(DroolsRouter.java:39)

                             

                            Can anyone help with this issue?

                             

                            Thanks

                             

                            Lars Rödiger