gpt4 book ai didi

java - ClassPathXmlApplicationContext 的问题

转载 作者:行者123 更新时间:2023-12-02 08:02:11 27 4
gpt4 key购买 nike

我的主类的静态方法中有以下代码 -

    appContext = new ClassPathXmlApplicationContext(new String[] {
"classpath*:/META-INF/spring.xml",
"classpath*:contractbatchupdate-application-context.xml"
});

所有依赖项均由 Maven 指定。我试图在 Eclipse 中将此类作为 java 应用程序运行,但它抛出以下错误。我可以在错误中列出的路径中指定的存储库中看到 jar 文件。

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [jar:file:/C:/Users/892893/.m2/repository/com/test/contract/Contract-Client/1.0-SNAPSHOT/Contract-Client-1.0-SNAPSHOT.jar!/META-INF/spring.xml]; nested exception is javax.xml.parsers.FactoryConfigurationError: Provider weblogic.xml.jaxp.RegistryDocumentBuilderFactory not found

最佳答案

您可能会在 Maven 中看到它,但类加载器在 CLASSPATH 中看不到它。相信异常(exception)——检查你的假设。该 JAR 不在 CLASSPATH 中。

关于java - ClassPathXmlApplicationContext 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8741002/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com