karaf 2.2.10 상단에 datanducleus-mongodb 3.2.3 및 3.0.7 스프링과 함께 JDO를 사용하고 있습니다.jdo/OSGi : 번들 업데이트 후 JDO PersistenceManagerFactory를 빌드하는 중 오류가 발생했습니다.
ERROR: Bundle [my_bundle] [242] Unable to get module class path.
(java.lang.IllegalStateException: zip file closed)
아이디 (:
신선한 OSGi 번들에것은 내가 문제없이 MongoDB를에 지속 할 수 있어요,하지만 새로운 JDO 된 PersistenceManagerFactory를 구축하는 동안 번들 다시 설치 한 후, 나는 다음과 같은 오류가 설치 242)은 번들에 할당 된 첫 번째 ID (즉, 이전 번들의 ID)를 나타냅니다.
"이전"JDO PersistenceManagerFactory뿐만 아니라 이전 번들의 컨텍스트가 올바르게 닫혀있는 것처럼 보입니다. 합니다 (example provided in the dn site 기준)
내 지역 지속성 관리자 팩토리 빈 클래스 : 문맥에서
public class OSGiLocalPersistenceManagerFactoryBean
extends LocalPersistenceManagerFactoryBean implements BundleContextAware {
public static final String JDO_BUNDLE_NAME = "org.datanucleus.api.jdo";
public static final String JDO_PMF_CLASS_NAME = "org.datanucleus.api.jdo.JDOPersistenceManagerFactory";
private BundleContext bundleContext;
@Override
protected PersistenceManagerFactory newPersistenceManagerFactory(String name) {
return JDOHelper.getPersistenceManagerFactory(name, getClassLoader());
}
@Override
protected PersistenceManagerFactory newPersistenceManagerFactory(Map props) {
ClassLoader classLoader = getClassLoader();
props.put("datanucleus.primaryClassLoader", classLoader);
if (FrameworkUtil.getBundle(this.getClass()) != null) { // running in OSGi
props.put("datanucleus.plugin.pluginRegistryClassName", "org.datanucleus.plugin.OSGiPluginRegistry");
}
PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(props, classLoader);
return pmf;
}
private ClassLoader getClassLoader() {
ClassLoader classLoader = null;
Bundle thisBundle = FrameworkUtil.getBundle(this.getClass());
if (thisBundle != null) { // on OSGi runtime
Bundle[] bundles = bundleContext.getBundles();
for (Bundle bundle : bundles) {
if (JDO_BUNDLE_NAME.equals(bundle.getSymbolicName())) {
try {
classLoader = bundle.loadClass(JDO_PMF_CLASS_NAME).getClassLoader();
} catch (ClassNotFoundException e) {
// do something fancy here ...
}
break;
}
}
} else { // somewhere else
classLoader = this.getClass().getClassLoader();
}
return classLoader;
}
@Override
public void setBundleContext(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
}
일부 지속성 관련 발췌 :
<!-- persistence manager factory -->
<bean id="pmf" class="[my_package].OSGiLocalPersistenceManagerFactoryBean">
<property name="configLocation" value="classpath:datanucleus.properties" />
</bean>
<!-- persistence manager factory proxy -->
<bean id="persistenceManagerFactoryProxy"
class="org.springframework.orm.jdo.TransactionAwarePersistenceManagerFactoryProxy">
<property name="targetPersistenceManagerFactory" ref="pmf" />
</bean>
<!-- transactions -->
<bean id="transactionManager" class="org.springframework.orm.jdo.JdoTransactionManager">
<property name="persistenceManagerFactory" ref="persistenceManagerFactoryProxy" />
</bean>
<tx:annotation-driven />
오류 메시지가 클래스 로딩 문제를 가리 키도록 보인다 그런데 재배포하는 동안에 만 실패하는 이유는 무엇입니까?
힌트를 보내 주시면 감사하겠습니다.
감사합니다. Achim. 실제로'javax.jdo' 번들을 새로 고침하면 문제가 해결됩니다! –