Announcement Announcement Module
No announcement yet.
Spring Roo - Drools - EntityManager problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Roo - Drools - EntityManager problem


    I'm currently working on a project integrating Drools (5.2.0) in Spring Roo (1.1.5).
    In my pom.xml file, I've added the dependencies for Drools Spring that I found here

    But now, when I run my application using mvn tomcat:run, I have an error for all my Roo entities like this one :

    The method createQuery(String) in the type EntityManager is not applicable for the arguments (String, Class<Driver>)

    So, correct me if I'm wrong but it seems that adding the drools-spring dependency made my project using JPA1 instead of JPA2. But Roo 1.1.5 generates .aj files for JPA2...
    Has anyone of you had already met this problem ?

    Thanks in advance for your help.
    Let me know if you need more information.

  • #2
    Roo uses JPA 2.0, however there is limited support for DataNucleus 1, so this may be worth a try.

    Select DATANUCLEUS for the --provider option in the persistence setup command.


    • #3
      Thank you Alan for your answer, but actually I'd like to use JPA 2.0 because I have already written JPA 2.0 code in custom classes. So I'm using ECLIPSELINK.

      Please look at the screenshot :


      The problem is that drools-grid-impl depends on ejb3-persistence and persistence-api using JPA 1.0. But when I exclude drools-grid-impl, I have drools errors.
      Why does my project uses JPA 1.0 whereas I have a javax.persistence-2.0.3 dependecy.

      Thank you for your help.
      Attached Files


      • #4
        I found this post while searching on Google :

        I tried to delete persistence.xml from drools-grid-impl-5.2.0.Final.jar but STS doesn't allow to do it.


        • #5
          Modifying third-party JAR files (e.g. removing persistence.xml) is a last resort, as you then have to maintain and publish your own modified versions of those artifacts. A more sustainable/orthodox approach is to exclude the troublesome dependencies from your project. You've already tried excluding drools-grid-impl and that caused problems, so try excluding that JAR file's transitive JPA 1 dependencies. You can identify these using the following Maven command:

          mvn dependency:tree
          Look for the lines below drools-grid-impl to see what it's pulling in, then add exclusions to your project's drools-spring dependency to exclude the troublesome ones.

          If that doesn't help, you're probably best off asking on a Drools (or Spring Drools) forum, as people there are more likely to have encountered this situation and have a solution.
          Last edited by Andrew Swan; Aug 10th, 2011, 12:35 AM. Reason: Fixed typo


          • #6
            Thank you Andrew it works ! Here is my pom.xml (drools-spring section only) for those who will have the same problem



            • #7
              Thanks for going before me.
              I was just considering how to do this if I decided to jump rails (no ruby atm) for Spring/Roo from Jboss/Forge.