1 Reply Latest reply on Mar 12, 2012 9:36 PM by ffang

    Package exposed via two dependency

    moacsjr_moacsjr

      How to solve this?

       

      Error executing command: Unable to resolve module br.teste.dao because it is exposed to package 'javax.persistence.spi' from org.apache.geronimo.specs.geronimo-jpa_2.0_spec and org.apache.servicemix.specs.java-persistence-api-1.1.1 via two dependency chains.                                                                               

      Chain 1:                                                                               

      br.teste.dao                                                                                

      import: (&(package=javax.persistence.spi)(jpa=2.0)(version>=1.1.0))                                                                               

      |                                                                               

      export: package=javax.persistence.spi                                                                               

      org.apache.geronimo.specs.geronimo-jpa_2.0_spec                                                                                

      Chain 2:                                                                               

      br.teste.dao                                                                                

      import: (package=org.springframework.orm.jpa)                                                                               

      |                                                                               

      export: package=org.springframework.orm.jpa; uses:=javax.persistence                                                                               

      org.springframework.orm                                                                                

      import: (&(package=javax.persistence)(version>=1.0.0)(!(version>=3.0.0)))                                                                               

      |                                                                               

      export: package=javax.persistence; uses:=javax.persistence.spi                                                                               

      export: package=javax.persistence.spi                                                                               

      org.apache.servicemix.specs.java-persistence-api-1.1.1   

       

      I am using servicemix-4.4.1-fuse-02-05.

        • 1. Re: Package exposed via two dependency
          ffang

          Hi,

           

          The root cause is that you install some bundles which need different javax.persistence.spi versions, also those bundles has dependency with each other.

           

          Let's say

          bundle A import-package javax.persistence.spi 2.0, bundle A also import-package x.y.z

          bunde B export-package  x.y.z with "use" directive like uses:="javax.persistence.spi" and also import-package javax.persistence.spi with version 1.1.1.

          Let's say bundle B already get resolved and started.

          When resolve bundle A, it will use export-package x.y.z from bundle B, but  as bundle B export-package  x.y.z uses:="javax.persistence.spi" and bundle B get resolved to import javax.persistence.spi 1.1.1, so it's not meet bundle A's restriction which need javax.persistence.spi 2.0, then you see such exception.

           

          Here bundle A is your customer bundle br.teste.dao and bundle B is org.springframework.orm, I think you have two options here to resolve it.

           

          1. for your customer bundle br.teste.dao don't import javax.persistence.spi 2.0

           

          or if your customer bundle br.teste.dao really need JPA 2.0, you can try

          2. don't install org.apache.servicemix.specs.java-persistence-api-1.1.1 from your OSGi container and let org.springframework.orm wire in JPA 2.0

           

          Freeman