Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-2077

Exported package names cannot be zero length. when karaf 2.3 starts within unit test using openengsb

    Details

    • Type: Task
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      MacOS

      Description

      Dependency pom

              <dependency>
                  <groupId>org.apache.karaf</groupId>
                  <artifactId>apache-karaf</artifactId>
                  <version>2.3.0</version>
                  <type>tar.gz</type>
                  <scope>test</scope>
              </dependency>
      
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <scope>test</scope>
              </dependency>
      
              <dependency>
                  <groupId>org.ops4j.pax.url</groupId>
                  <artifactId>pax-url-aether</artifactId>
                  <scope>test</scope>
              </dependency>
      
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam-link-mvn</artifactId>
                  <scope>test</scope>
              </dependency>
      
              <dependency>
                  <groupId>org.openengsb.labs.paxexam.karaf</groupId>
                  <artifactId>paxexam-karaf-container</artifactId>
                  <version>1.0.0</version>
                  <exclusions>
                      <exclusion>
                          <groupId>org.ops4j.pax.exam</groupId>
                          <artifactId>pax-exam</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>org.ops4j.pax.exam</groupId>
                          <artifactId>pax-exam-spi</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>org.ops4j.pax.exam</groupId>
                          <artifactId>pax-exam-container-rbc</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>org.ops4j.pax.exam</groupId>
                          <artifactId>pax-exam-container-rbc-client</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>org.ops4j.pax.exam</groupId>
                          <artifactId>pax-exam-container-remote</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>org.ops4j.pax.exam</groupId>
                          <artifactId>pax-exam-invoker-junit</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>org.ops4j.pax.exam</groupId>
                          <artifactId>pax-exam</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>org.ops4j.pax.exam</groupId>
                          <artifactId>pax-exam</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>
      
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam</artifactId>
                  <version>${pax.exam.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam-spi</artifactId>
                  <version>${pax.exam.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam-container-rbc</artifactId>
                  <version>${pax.exam.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam-container-rbc-client</artifactId>
                  <version>${pax.exam.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam-container-remote</artifactId>
                  <version>${pax.exam.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam-extender-service</artifactId>
                  <version>${pax.exam.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam-inject</artifactId>
                  <version>${pax.exam.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam-invoker-junit</artifactId>
                  <version>${pax.exam.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.exam</groupId>
                  <artifactId>pax-exam-junit4</artifactId>
                  <version>${pax.exam.version}</version>
              </dependency>
      

      Java Code

          public static Option[] getDefaultKarafOptions() {
              Option[] options =
                      // Set the karaf environment with some customer configuration
                      new Option[]{
                              karafDistributionConfiguration()
                                      .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").version("2.3.0"))
                                      .karafVersion("2.3.0")
                                      .name("Apache Karaf")
                                      .useDeployFolder(false).unpackDirectory(new File("target/paxexam/unpack/")),
      
                              KarafDistributionOption.keepRuntimeFolder(),
                              logLevel(LogLevelOption.LogLevel.INFO)
      
                              // override the config.properties (to fix pax-exam bug)
                              //replaceConfigurationFile("etc/config.properties", new File("src/test/resources/org/jboss/weld/environment/osgi/tests/karaf/config.properties")),
                              //replaceConfigurationFile("etc/custom.properties", new File("src/test/resources/org/jboss/weld/environment/osgi/tests/karaf/custom.properties"))
                      };
      
              return options;
      
          }
      
      @RunWith(JUnit4TestRunner.class)
      @ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
      public class ContainerTest {
      
          @Configuration
          public static Option[] configure() {
              Option[] options = combine(
      
                      getDefaultKarafOptions(),
      
                      Environment.toCDIKarafEnvironment(
                              toMavenBundle("org.jboss.weld.osgi.tests", "weld-osgi-bundle1"),
                              toMavenBundle("org.jboss.weld.osgi.tests", "weld-osgi-bundle2"),
                              toMavenBundle("org.jboss.weld.osgi.tests", "weld-osgi-bundle3")
                      )
      
              );
      
              return options;
          }
      
      

      Error

      [org.ops4j.pax.url.mvn.internal.Connection] : Resolving exact version
      org.osgi.framework.BundleException: Exported package names cannot be zero length.
      at org.apache.felix.framework.util.manifestparser.ManifestParser.normalizeExportClauses(ManifestParser.java:729)
      at org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:191)
      at org.apache.felix.framework.ExtensionManager.<init>(ExtensionManager.java:220)
      at org.apache.felix.framework.Felix.<init>(Felix.java:374)
      at org.apache.felix.framework.FrameworkFactory.newFramework(FrameworkFactory.java:28)
      at org.apache.karaf.main.Main.launch(Main.java:288)
      at org.apache.karaf.main.Main.main(Main.java:497)
      ERROR: Error parsing system bundle export statement: org.osgi.framework.startlevel;uses:="org.osgi.framework";version="1.0", org.osgi.framework.wiring;uses:="org.osgi.resource,org.osgi.framework";version="1.1"

        Activity

        Hide
        svs svs added a comment -

        The configuration files are the same.

        Did pax-exam (karaf) skip the default config.properties?

        Show
        svs svs added a comment - The configuration files are the same. Did pax-exam (karaf) skip the default config.properties?
        Hide
        pieber Andreas Pieber added a comment -

        I assume this is a "not a problem" then?

        Show
        pieber Andreas Pieber added a comment - I assume this is a "not a problem" then?
        Hide
        cmoulliard Charles Moulliard added a comment -

        Issue can be resolved by replacing Karaf config files :

        replaceConfigurationFile("etc/config.properties", new File("src/test/resources/org/jboss/weld/environment/osgi/tests/karaf/config.properties")),

        ################################################################################
        #
        #    Licensed to the Apache Software Foundation (ASF) under one or more
        #    contributor license agreements.  See the NOTICE file distributed with
        #    this work for additional information regarding copyright ownership.
        #    The ASF licenses this file to You under the Apache License, Version 2.0
        #    (the "License"); you may not use this file except in compliance with
        #    the License.  You may obtain a copy of the License at
        #
        #       http://www.apache.org/licenses/LICENSE-2.0
        #
        #    Unless required by applicable law or agreed to in writing, software
        #    distributed under the License is distributed on an "AS IS" BASIS,
        #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        #    See the License for the specific language governing permissions and
        #    limitations under the License.
        #
        ################################################################################
        
        # FIXING PAX-EXAM BUG
        
        #
        # This file lists Karaf default settings for this particular version of Karaf.
        # For easier maintenance when upgrading Karaf and to better document which
        # default values have changed, it is recommended to place any changes to
        # these values in a custom.properties file in the same folder as this file.
        # Each value specified in custom.properties will override the default value
        # here.
        #
        
        #
        # Properties file inclusions (as a space separated list of relative paths)
        # Included files will override the values specified in this file
        # NB: ${includes} properties files are mandatory, it means that Karaf will not start
        # if the include file is not found
        #
        ${includes} = jre.properties custom.properties
        
        #
        # Properties file inclusions (as a space separated list of relative paths)
        # Included files will override the values specified in this file
        # NB: ${optionals} properties files are optionals, it means that Karaf will just
        # display a warning message but the bootstrap will be performed
        #
        # ${optionals} = my.properties
        
        
        #
        # Framework selection properties
        #
        karaf.framework=felix
        
        #
        # Location of the OSGi frameworks
        #
        karaf.framework.equinox=${karaf.default.repository}/org/eclipse/osgi/3.8.0.v20120529-1548/osgi-3.8.0.v20120529-1548.jar
        karaf.framework.felix=${karaf.default.repository}/org/apache/felix/org.apache.felix.framework/4.0.3/org.apache.felix.framework-4.0.3.jar
        
        #
        # Framework config properties.
        #
        org.osgi.framework.system.packages= \
         org.osgi.framework.startlevel;uses:="org.osgi.framework";version="1.0", \
         org.osgi.framework.wiring;uses:="org.osgi.resource,org.osgi.framework";version="1.1", \
         org.osgi.framework.hooks.bundle;uses:="org.osgi.framework";version="1.1", \
         org.osgi.framework.hooks.service;uses:="org.osgi.framework";version="1.1", \
         org.osgi.framework.hooks.resolver;uses:="org.osgi.framework.wiring";version="1.0", \
         org.osgi.framework.launch;uses:="org.osgi.framework";version="1.1", \
         org.osgi.framework.namespace;uses:="org.osgi.resource";version="1.0", \
         org.osgi.framework;version="1.7",\
         org.osgi.framework.hooks.weaving;uses:="org.osgi.framework.wiring";version="1.0",\
         org.osgi.resource;version="1.0",org.osgi.service.url;version="1.0",\
         org.osgi.service.startlevel;uses:="org.osgi.framework";version="1.1",\
         org.osgi.service.packageadmin;uses:="org.osgi.framework";version="1.2",\
         org.osgi.service.url;version="1.0", \
         org.osgi.util.tracker;uses:="org.osgi.framework";version="1.5.1", \
         org.apache.karaf.jaas.boot;version="2.3.0", \
         org.apache.karaf.jaas.boot.principal;version="2.3.0", \
         org.apache.karaf.version;version="2.3.0", \
         ${jre-${java.specification.version}}
        
        # Extra packages appended after standard packages
        # org.osgi.framework.system.packages.extra=
        
        # javax.transaction is needed to avoid class loader constraint violation when using javax.sql
        org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,sun.*,com.sun.*,javax.transaction,javax.transaction.*
        
        # OSGi Execution Environment
        org.osgi.framework.executionenvironment=J2SE-1.7,JavaSE-1.7,J2SE-1.6,JavaSE-1.6,J2SE-1.5,JavaSE-1.5,J2SE-1.4,JavaSE-1.4,J2SE-1.3,JavaSE-1.3,J2SE-1.2,,JavaSE-1.2,CDC-1.1/Foundation-1.1,CDC-1.0/Foundation-1.0,J2ME,OSGi/Minimum-1.1,OSGi/Minimum-1.0
        
        # Set the parent classloader for the bundle to the classloader that loads the Framework (i.e. everything in lib/*.jar)
        org.osgi.framework.bundle.parent=framework
        
        # To enable the use of the startup.properties file to control the start level:
        karaf.auto.start=startup.properties
        
        org.osgi.framework.startlevel.beginning=100
        karaf.startlevel.bundle=80
        
        karaf.shutdown.port.file=${karaf.data}/port
        
        #
        # FileMonitor properties
        #
        felix.fileinstall.dir    = ${karaf.base}/etc
        felix.fileinstall.filter = .*\\.cfg
        felix.fileinstall.poll   = 1000
        felix.fileinstall.noInitialDelay = true
        felix.fileinstall.log.level = 3
        
        #
        # Delay for writing the framework state to disk in equinox
        # must be  >= 1000 and <= 1800000
        #
        eclipse.stateSaveDelayInterval = 1000
        
        #
        # OBR Repository list
        # This property will be modified by the obr:addUrl and obr:removeUrl commands.
        #
        obr.repository.url =
        
        karaf.delay.console=false
        
        Show
        cmoulliard Charles Moulliard added a comment - Issue can be resolved by replacing Karaf config files : replaceConfigurationFile("etc/config.properties", new File("src/test/resources/org/jboss/weld/environment/osgi/tests/karaf/config.properties")), ################################################################################ # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License" ); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http: //www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ # FIXING PAX-EXAM BUG # # This file lists Karaf default settings for this particular version of Karaf. # For easier maintenance when upgrading Karaf and to better document which # default values have changed, it is recommended to place any changes to # these values in a custom.properties file in the same folder as this file. # Each value specified in custom.properties will override the default value # here. # # # Properties file inclusions (as a space separated list of relative paths) # Included files will override the values specified in this file # NB: ${includes} properties files are mandatory, it means that Karaf will not start # if the include file is not found # ${includes} = jre.properties custom.properties # # Properties file inclusions (as a space separated list of relative paths) # Included files will override the values specified in this file # NB: ${optionals} properties files are optionals, it means that Karaf will just # display a warning message but the bootstrap will be performed # # ${optionals} = my.properties # # Framework selection properties # karaf.framework=felix # # Location of the OSGi frameworks # karaf.framework.equinox=${karaf. default .repository}/org/eclipse/osgi/3.8.0.v20120529-1548/osgi-3.8.0.v20120529-1548.jar karaf.framework.felix=${karaf. default .repository}/org/apache/felix/org.apache.felix.framework/4.0.3/org.apache.felix.framework-4.0.3.jar # # Framework config properties. # org.osgi.framework.system.packages= \ org.osgi.framework.startlevel;uses:= "org.osgi.framework" ;version= "1.0" , \ org.osgi.framework.wiring;uses:= "org.osgi.resource,org.osgi.framework" ;version= "1.1" , \ org.osgi.framework.hooks.bundle;uses:= "org.osgi.framework" ;version= "1.1" , \ org.osgi.framework.hooks.service;uses:= "org.osgi.framework" ;version= "1.1" , \ org.osgi.framework.hooks.resolver;uses:= "org.osgi.framework.wiring" ;version= "1.0" , \ org.osgi.framework.launch;uses:= "org.osgi.framework" ;version= "1.1" , \ org.osgi.framework.namespace;uses:= "org.osgi.resource" ;version= "1.0" , \ org.osgi.framework;version= "1.7" ,\ org.osgi.framework.hooks.weaving;uses:= "org.osgi.framework.wiring" ;version= "1.0" ,\ org.osgi.resource;version= "1.0" ,org.osgi.service.url;version= "1.0" ,\ org.osgi.service.startlevel;uses:= "org.osgi.framework" ;version= "1.1" ,\ org.osgi.service.packageadmin;uses:= "org.osgi.framework" ;version= "1.2" ,\ org.osgi.service.url;version= "1.0" , \ org.osgi.util.tracker;uses:= "org.osgi.framework" ;version= "1.5.1" , \ org.apache.karaf.jaas.boot;version= "2.3.0" , \ org.apache.karaf.jaas.boot.principal;version= "2.3.0" , \ org.apache.karaf.version;version= "2.3.0" , \ ${jre-${java.specification.version}} # Extra packages appended after standard packages # org.osgi.framework.system.packages.extra= # javax.transaction is needed to avoid class loader constraint violation when using javax.sql org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,sun.*,com.sun.*,javax.transaction,javax.transaction.* # OSGi Execution Environment org.osgi.framework.executionenvironment=J2SE-1.7,JavaSE-1.7,J2SE-1.6,JavaSE-1.6,J2SE-1.5,JavaSE-1.5,J2SE-1.4,JavaSE-1.4,J2SE-1.3,JavaSE-1.3,J2SE-1.2,,JavaSE-1.2,CDC-1.1/Foundation-1.1,CDC-1.0/Foundation-1.0,J2ME,OSGi/Minimum-1.1,OSGi/Minimum-1.0 # Set the parent classloader for the bundle to the classloader that loads the Framework (i.e. everything in lib/*.jar) org.osgi.framework.bundle.parent=framework # To enable the use of the startup.properties file to control the start level: karaf.auto.start=startup.properties org.osgi.framework.startlevel.beginning=100 karaf.startlevel.bundle=80 karaf.shutdown.port.file=${karaf.data}/port # # FileMonitor properties # felix.fileinstall.dir = ${karaf.base}/etc felix.fileinstall.filter = .*\\.cfg felix.fileinstall.poll = 1000 felix.fileinstall.noInitialDelay = true felix.fileinstall.log.level = 3 # # Delay for writing the framework state to disk in equinox # must be >= 1000 and <= 1800000 # eclipse.stateSaveDelayInterval = 1000 # # OBR Repository list # This property will be modified by the obr:addUrl and obr:removeUrl commands. # obr.repository.url = karaf.delay.console= false
        Hide
        jbonofre Jean-Baptiste Onofré added a comment -

        About slf4j binding, you should exclude Karaf client from the dependencies (exclusion), to avoid to have different slf4j binding.

        Show
        jbonofre Jean-Baptiste Onofré added a comment - About slf4j binding, you should exclude Karaf client from the dependencies (exclusion), to avoid to have different slf4j binding.
        Hide
        cmoulliard Charles Moulliard added a comment -

        BTW, If I use this dependency

                <dependency>
                    <groupId>org.apache.karaf.tooling.exam</groupId>
                    <artifactId>org.apache.karaf.tooling.exam.options</artifactId>
                    <version>2.3.0</version>
                </dependency>
        

        I get this error now :

        SLF4J: Found binding in [jar:file:/Users/chmoulli/.m2/repository/org/slf4j/slf4j-simple/1.6.1/slf4j-simple-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
        SLF4J: Found binding in [jar:file:/Users/chmoulli/.m2/repository/org/slf4j/slf4j-jdk14/1.6.1/slf4j-jdk14-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
        SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
        SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
        Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.175 sec <<< FAILURE!
        
        Results :
        
        Tests in error: 
          initializationError(org.jboss.weld.environment.osgi.tests.karaf.ContainerTest): No TestContainer implementation in Classpath
        
        Show
        cmoulliard Charles Moulliard added a comment - BTW, If I use this dependency <dependency> <groupId>org.apache.karaf.tooling.exam</groupId> <artifactId>org.apache.karaf.tooling.exam.options</artifactId> <version>2.3.0</version> </dependency> I get this error now : SLF4J: Found binding in [jar:file:/Users/chmoulli/.m2/repository/org/slf4j/slf4j-simple/1.6.1/slf4j-simple-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/chmoulli/.m2/repository/org/slf4j/slf4j-jdk14/1.6.1/slf4j-jdk14-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http: //www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.175 sec <<< FAILURE! Results : Tests in error: initializationError(org.jboss.weld.environment.osgi.tests.karaf.ContainerTest): No TestContainer implementation in Classpath
        Hide
        pieber Andreas Pieber added a comment - - edited

        thank you very much for the report Charles; I'll give it a shot

        Show
        pieber Andreas Pieber added a comment - - edited thank you very much for the report Charles; I'll give it a shot

          People

          • Assignee:
            pieber Andreas Pieber
            Reporter:
            cmoulliard Charles Moulliard
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:

              Development