2014-02-05 2 views
0

스프링 dm과 연결된 수백 개의 번들로 구성된 RCP 응용 프로그램이 있습니다. Spring 3.2.1로 업그레이드 한 후, 다음 번에 몇 가지 묶음으로 예외가 생겼다. 처음에는 dm에서 약간의 마법으로 인해 발생할 수 있다고 생각했지만 dm (단순히 ApplicationContext를 프로그램 적으로 시작 함)없이 번들을 초기화하여 이론을 테스트 한 후에도 동일한 예외가 발생했습니다.RCP 응용 프로그램에서 Spring 3.0.5에서 3.2.1로 업그레이드 한 후 ClassNotFoundException이 발생했습니다.

스택 트레이스는 :

Exception in thread "SpringOsgiExtenderThread-130" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FileSystemsStackViewControlFactory' defined in OSGi resource[classpath:spring/filesystem-ui.xml|bnd.id=176|bnd.sym=filesystem.ui]: Instantiation of bean failed; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1011) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:957) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) 
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69) 
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355) 
    at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85) 
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320) 
    at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132) 
    at java.lang.Thread.run(Unknown Source) 
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null 
    at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237) 
    at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) 
    at org.springframework.cglib.proxy.Enhancer.create(Enhancer.java:285) 
    at org.springframework.beans.factory.support.CglibSubclassingInstantiationStrategy$CglibSubclassCreator.instantiate(CglibSubclassingInstantiationStrategy.java:117) 
    at org.springframework.beans.factory.support.CglibSubclassingInstantiationStrategy.instantiateWithMethodInjection(CglibSubclassingInstantiationStrategy.java:69) 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:91) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1004) 
    ... 15 more 
Caused by: java.lang.reflect.InvocationTargetException 
    at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384) 
    at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219) 
    ... 21 more 
Caused by: java.lang.NoClassDefFoundError: org/springframework/cglib/proxy/Factory 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClassCond(Unknown Source) 
    at java.lang.ClassLoader.defineClass(Unknown Source) 
    ... 26 more 
Caused by: java.lang.ClassNotFoundException: org.springframework.cglib.proxy.Factory 
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501) 
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421) 
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412) 
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    ... 29 more 

원래 매니페스트 필요-번들 및 패키지 가져 오기의 혼합물이었다, 그래서 나는 아예 필요-번들을 제거했습니다. 이 모든 것이 바뀔 것이라고는 기대하지 않았지만 절망적 인시기에는 필사적 인 조치가 필요합니다. 나는 옳았습니다.

마지막 수단으로이 속성을 추가하려고 시도했지만 여전히 변경하지 않았습니다.

DynamicImport-Package: * 

나는 봄이 핵심 단지 내 CGLIB 및 ASM을 포함하는 버전 3.1의 주위에 CGLIB의 사용법을 변경할 것을 알고,하지만 난 아무 소용이 모든 CGLIB 및 ASM 패키지에 대한 수입을 포함했다.

매니페스트 :

Manifest-Version: 1.0 
Bundle-ManifestVersion: 2 
Bundle-Name: File System UI 
Bundle-SymbolicName: com.mycorp.filesystem.ui;singleton:=true 
Bundle-Version: 15.7.0.qualifier 
Bundle-Activator: com.mycorp.filesystem.ui.internal.Activator 
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 
Bundle-ActivationPolicy: lazy 
Import-Package: com.mycorpcse.utils.eclipse, 
com.mycorp.common.ui, 
     : 
    Many other in house dependencies 
     : 
com.mycorp.core, 
org.eclipse.core.commands, 
     : 
    Many other eclipse dependencies 
     : 
org.eclipse.ui.views.properties, 
org.osgi.framework;version="1.7.0", 
org.springframework.asm;version="3.2.1.RELEASE", 
org.springframework.asm.commons;version="3.2.1.RELEASE", 
org.springframework.asm.signature;version="3.2.1.RELEASE", 
org.springframework.asm.util;version="3.2.1.RELEASE", 
org.springframework.beans;version="3.0.5.RELEASE", 
org.springframework.beans.factory.annotation, 
org.springframework.cglib;version="3.2.1.RELEASE", 
org.springframework.cglib.beans;version="3.2.1.RELEASE", 
org.springframework.cglib.core;version="3.2.1.RELEASE", 
org.springframework.cglib.proxy;version="3.2.1.RELEASE", 
org.springframework.cglib.reflect;version="3.2.1.RELEASE", 
org.springframework.cglib.transform;version="3.2.1.RELEASE", 
org.springframework.cglib.transform.impl;version="3.2.1.RELEASE", 
org.springframework.cglib.util;version="3.2.1.RELEASE" 
Export-Package: com.mycorp.filesystem.ui, 
com.mycorp.filesystem.ui.columns, 
com.mycorp.filesystem.ui.model 

업데이트 : 나는 지금 lookup method injection를 사용할 때 특별한 경우에만 발생 실현. 여전히 문제를 해결하는 방법을 모르므로이 기능을 사용하지 않도록 구성을 변경해야합니다.

+0

당신이 나타납니다 (당신이 OSGI 플러그인이 이미 활성화되어 가정) 3.2.1이 아닌 3.0.5를 가리키는 의존성있는 스프링 - 콩을 놓치고 스프링 코어 병을 적절하게 만들어야합니다. 빈 오류 및 스택 추적으로 판단 할 때 사용중인 실제 번들/항아리는 현재 사용하고 있다고 생각하는 번들/항아리가 아닙니다. –

+0

3.2.1 만 대상 플랫폼에 배포됩니다. 3.0.5는 업데이트되지 않은 최소 버전 일 뿐이지 만 3.2.1 배포가 여전히 종속성을 만족하므로 중요하지 않습니다. – Robin

+0

나는 스프링 코어 항아리가 재 포장 된 cglib/asm 물체를 포함하고 있지는 않다. –

답변

0

우리는 org.springframework.cglib 등의 import-package를 org.springframework.transaction 번들에 추가함으로써 유사한 문제를 해결했다.

0

스프링 3.2에서 내부 클래스 구조가 변경된 것 같습니다. 기본 OSGI 패키지를 사용하면 clib 클래스를 찾을 수 없습니다. 따라서 MANIFEST.MF에서 명시 적으로 지정해야하는 것은 컨텍스트에서로드 된 패키지가 필요하다는 것입니다.

jar 파일에서 MANIFEST.MF 파일을 편집 할 수 있습니다. 가져 오기 - 패키지 섹션에서 다음과 같은 3 개 패키지를 추가 :

'org.springframework.cglib.core','org.springframework.cglib.proxy','org.springframework.beans.factory'

을 아니면 Gradle을 사용하는 경우 다음과 같은 작업을 수행 할 수 있습니다

jar { manifest { instruction 'Import-Package', 'org.springframework.cglib.core', 'org.springframework.cglib.proxy', 'org.springframework.beans.factory', '*' } }

관련 문제