Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正在刷新OSGI捆绑包上下文,无法找到Spring NamespaceHandler_Spring_Mongodb_Osgi_Applicationcontext - Fatal编程技术网

正在刷新OSGI捆绑包上下文,无法找到Spring NamespaceHandler

正在刷新OSGI捆绑包上下文,无法找到Spring NamespaceHandler,spring,mongodb,osgi,applicationcontext,Spring,Mongodb,Osgi,Applicationcontext,我需要在运行时刷新我的应用程序上下文。为此,我将执行以下步骤: 1.在我的OSGI捆绑包之外创建新的appliction-context.xml 2.使用 InputStream InputStream=new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(“/META-INF/spring/application context.xml”) 3.刷新应用程序ctx,这意味着,切换到新的应用程序,

我需要在运行时刷新我的应用程序上下文。为此,我将执行以下步骤:
1.在我的OSGI捆绑包之外创建新的appliction-context.xml
2.使用
InputStream InputStream=new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(“/META-INF/spring/application context.xml”)
3.刷新应用程序ctx,这意味着,切换到新的应用程序,在捆绑包之外创建
ApplicationContext ctx=newfilesystemxmlapplicationcontext(newCtxPath);
((ConfigurableApplicationContext)ctx).refresh()

但是我越来越

找不到XML架构命名空间的Spring NamespaceHandler [

在我的application-context.xml中,我不认为这是一个问题,因为在编译过程中,一切正常,当我在运行时尝试刷新ctx时,问题就出现了

编辑#
当然,将旧ctx文件复制到新文件是成功的,两个文件看起来完全相同。

我找到了更简单的解决方案

public class CtxRefresher implements ApplicationContextAware {

    private ApplicationContext context;

    public void refreshApplicationCtx(){
        ((ConfigurableApplicationContext)context).refresh();        
    }

    @Override
    public void setApplicationContext(ApplicationContext ctx) throws BeansException {
        context = ctx;      
    }
}
public class CtxRefresher implements ApplicationContextAware {

    private ApplicationContext context;

    public void refreshApplicationCtx(){
        ((ConfigurableApplicationContext)context).refresh();        
    }

    @Override
    public void setApplicationContext(ApplicationContext ctx) throws BeansException {
        context = ctx;      
    }
}