2014-07-14 5 views
1

나는했습니다 다음과 같은 두 가지 관리 서비스 공장 청사진 : 클래스 로딩 문제

<cm:managed-service-factory factory-pid="com.foo" interface="com.foo.FooService"> 
     <cm:managed-component class="com.foo.impl.FooServiceImpl" init-method="init"> 
      <cm:managed-properties persistent-id="" update-method="update" update-strategy="component-managed"/> 
     </cm:managed-component> 
    </cm:managed-service-factory> 

    <cm:managed-service-factory factory-pid="com.foo" interface="com.foo.BarService"> 
     <cm:managed-component class="com.foo.impl.BarServiceImpl" init-method="init"> 
      <cm:managed-properties persistent-id="" update-method="update" update-strategy="component-managed"/> 
     </cm:managed-component> 
    </cm:managed-service-factory> 

통합 테스트에 (OPS4j 팍스 시험) 위의 서비스를 사용하여, 때때로, 나는

이야 다음의 예외를 갖는

org.osgi.service.blueprint.container.ComponentDefinitionException: Cound not create component instance for .component-1 
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:751)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.compendium.cm.CmManagedServiceFactory.doCreate(CmManagedServiceFactory.java:204)[10:org.apache.aries.blueprint.cm:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.compendium.cm.BaseManagedServiceFactory.internalUpdate(BaseManagedServiceFactory.java:138)[10:org.apache.aries.blueprint.cm:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.compendium.cm.BaseManagedServiceFactory.access$000(BaseManagedServiceFactory.java:37)[10:org.apache.aries.blueprint.cm:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.compendium.cm.BaseManagedServiceFactory$1.run(BaseManagedServiceFactory.java:87)[10:org.apache.aries.blueprint.cm:1.0.1.redhat-60024] 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_45] 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_45] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_45] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_45] 
    at java.lang.Thread.run(Thread.java:744)[:1.7.0_45] 
Caused by: java.lang.IllegalArgumentException: com.foo.impl 
    at java.lang.ClassLoader.definePackage(ClassLoader.java:1627)[:1.7.0_45] 
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2249)[org.apache.felix.framework-4.0.3.redhat-60024.jar:] 
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1501)[org.apache.felix.framework-4.0.3.redhat-60024.jar:] 
    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)[org.apache.felix.framework-4.0.3.redhat-60024.jar:] 
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)[org.apache.felix.framework-4.0.3.redhat-60024.jar:] 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_45] 
    at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1862)[org.apache.felix.framework-4.0.3.redhat-60024.jar:] 
    at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)[org.apache.felix.framework-4.0.3.redhat-60024.jar:] 
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:419)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:410)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:113)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:168)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.di.AbstractRecipe.loadType(AbstractRecipe.java:161)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BeanRecipe.loadClass(BeanRecipe.java:249)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BeanRecipe.getType(BeanRecipe.java:895)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:323)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:745)[13:org.apache.aries.blueprint.core:1.0.1.redhat-60024] 
    ... 9 more 

그것은 청사진 개의 상이한 스레드 서비스 인스턴스를 초기화하는 것 같다 및 제 실이 오류를 대면 OSGi 컨테이너 (펠릭스)에 도달 할 때. 패키지가 이미 첫 번째 스레드에 의해로드 되었기 때문입니다.

앞서 언급했듯이 이것은 영구적 인 동작이 아니며 10-20 %의 시간이 걸립니다.

누구나 원인과 잠재적 인 해결책에 대해 알고 있습니까?

답변