Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
jsr94 spring module exception Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • jsr94 spring module exception

    I trying to run the jsr94 example that comes in the 0.8 release. I'm using Spring 2 jdk 1.5 and eclipse 3.3.

    I'm using the resource-drools.xml
    I get the following exception:
    2008-02-04 11:08:46,852 INFO [ istableBeanFactory] - <Destroying singletons in [email protected]: defining beans [datasource,ruleServiceProvider,ruleRuntime,ruleAdm inistrator,ruleSource,jsr94Template,carsDAO,carsSe rvice]; root of factory hierarchy>
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'ruleSource' defined in class path resource [rulesource-drools.xml]: Invocation of init method failed; nested exception is org.drools.compiler.PackageBuilder$MissingPackageN ameException: Missing package name for rule package.
    Caused by: org.drools.compiler.PackageBuilder$MissingPackageN ameException: Missing package name for rule package.

    Anyone else getting this?

  • #2
    drools 4.0.4

    I forgot to mention I am using drools 4.0.4 rlease from Jboss.


    • #3
      Hmm, I will have a look at this tomorrow, and let you know.


      • #4
        If you look here:

        You'll see:
        if ( packageDescr.getName() == null || "".equals( packageDescr.getName() ) ) {
        throw new MissingPackageNameException( "Missing package name for rule package." );

        So I'm guessing you didn't declare the package namespace at the top of your .dlr rile

        Btw I've just announced a new drools-spring module initiative here:



        • #5
          I didn't change the jsr94 example at all. Is it possiblr that the car_riles.drl that comes with the example is missing he package name? I've attached the drl file. I think I may have a problem in the configuration of my eclipse project.
          Is there a way to load the jsr94 example into eclipse and build and run without creating an ant build script?


          • #6
            I created a modified car_rules.drl that works:
            package price_rules

            import org.springmodules.samples.jsr94.model.Car

            rule car_volkswagen1
            car : Car( mark == "Volkswagen" )

            System.out.println( "rule test" );

            I almost have the example working now but am struggling with loading the hsqldb and getting the following error:
            2008-02-07 10:59:28,541 [main] INFO ory - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
            org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select * from car]; nested exception is java.sql.SQLException: Table not found in statement [select * from car]
            Caused by: java.sql.SQLException: Table not found in statement [select * from car]


            • #7
              issue resolved, but one more question at least

              I was able to get the JSR94 Spring example to work and think this is going to be a very instructional piece of code for me to explore the capabilities of JSR94, spring, and drools development in general.

              I have one question since I'm afraid that I may be missing something. Earlier in the thread I attached the car_rules.drl file that comes with the example. Drools 4.0.4 could not parse this file and produced a parsing exception. This files seemed to be pre-4.0.4 vintage Drools Rules language syntax wrapped in CDATA tags. I'm wondering if I was missing a capability of the demo that would have automatically transformed this XML file disguised as a rules .drl file into something Drools could parse?

              I was able to read the file and manually translate it to Drools 4.0.4 syntax and everything is working, but want to know if there was some reason to encode the contents of the file in that fashion.



              • #8
                Sorry, an irrelevant question.
                But how to run the hsql script in jsr94 example ? I have the same db problem with you.


                • #9
                  hsql script in jsr94 example

                  Once you specify the location of the hsqldb, I think all you need to do is put the scripts that load the cars data into that directory and the database will execute those scripts upon startup.

                  I abandoned the hsqldb since I could not see how to use it in a multi-user mode. I wanted to be able to query the db as the app was running to see if certain actions had occurred properly. Although I was able to get this demo up and running initially in hsqldb and confirmed that it was working properly. It was necessary for me to translate the drl file from the xml-wrapped version to a more native drl Drools syntax. I never received an answer from anyone in the forum as to why the file contained all the xml.

                  I switched to SQL Server shortly afterwards.


                  • #10
                    More Info???


                    I was hoping that you might be able to aid me in finding examples of the jsr94 spring module being put to use.

                    Do you have any sites that are good reference?

                    I am very new to Drools, but I have previously done some work with Spring.

                    Just looking for help... Thanks ahead of time.