0 Replies Latest reply on Nov 7, 2012 4:13 PM by dpishchukhin

    Arquillian 1.0.3 and OSGi bundle: JBOSGI011234: Duplicate import of package 'org.osgi.framework'

    Newbie

      Hello All,

       

      I'm trying to run OSGi IT with Arquillian. I'd like to use a OSGi bundle from Maven as a deployment. I've added this method to my test class:

       

      {code}

          @Deployment

          public static JavaArchive createDeployment() {

              File[] files = DependencyResolvers.use(MavenDependencyResolver.class).artifact("com.foo:acme:1.0.1-SNAPSHOT").resolveAsFiles(new ScopeFilter());

              return ShrinkWrap.create(ZipImporter.class).importFrom(files[0]).as(JavaArchive.class);

          }

      {code}

       

      This artifacts is a OSGi bundle that imports package:

       

      {quote}Import-Package: org.osgi.framework;version="[1.5,2)"{quote}

       

      During the test run I got an exception:

       

      {quote}

      org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy: 79c0caaf-92e5-45cd-b01e-a6af1a3a

      bd3b.jar: 8 assets

              at org.jboss.arquillian.container.osgi.embedded.EmbeddedDeployableContainer.deploy(EmbeddedDeployableContainer.j

      ava:130)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployControll

      er.java:161)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployControll

      er.java:128)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDepl

      oyController.java:271)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployControll

      er.java:127)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

              at org.jboss.arquillian.container.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuring

      Deploy(DeploymentExceptionHandler.java:50)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

              at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(Containe

      rDeploymentContextHandler.java:78)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

              at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(Container

      DeploymentContextHandler.java:57)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

              at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

              at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

              at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployContr

      oller.java:95)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployContr

      oller.java:80)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDep

      loyController.java:263)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(Conta

      inerDeployController.java:239)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployC

      ontroller.java:79)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

              at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

              at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

              at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

              at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.jav

      a:101)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

              at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

              at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

              at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

              at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

              at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)

              at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)

              at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

              at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

              at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)

              at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

              at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)

              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)

              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)

              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)

              at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)

              at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)

              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)

              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

      Caused by: org.osgi.framework.BundleException: JBOSGI011234: Duplicate import of package 'org.osgi.framework' in: com.foo.acme:1.0.1.SNAPSHOT

              at org.jboss.osgi.framework.internal.BundleValidatorR4.validateBundle(BundleValidatorR4.java:73)

              at org.jboss.osgi.framework.internal.UserBundleInstalledService.validateBundle(UserBundleInstalledService.java:1

      34)

              at org.jboss.osgi.framework.internal.UserBundleInstalledService.start(UserBundleInstalledService.java:75)

              at org.jboss.osgi.framework.spi.ServiceTracker$SynchronousListenerServiceWrapper.start(ServiceTracker.java:330)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

              at java.lang.Thread.run(Unknown Source)

      {quote}

       

      I've analyzed a manifest of the test bundle.

      {quote}Import-Package: org.osgi.framework;version="[1.5,2)",org.jboss.arquill ian.container.test.api,org.jboss.arquillian.junit,org.jboss.arquillia n.osgi,org.jboss.arquillian.test.api,org.jboss.shrinkwrap.api,org.jbo ss.shrinkwrap.api.asset,org.jboss.shrinkwrap.api.spec,org.junit,org.j unit.runner,javax.inject,org.osgi.framework {quote}

       

      package "org.osgi.framework" is imported two times.

       

      How can I avoid this?

       

      Thanks,

      Dmytro