gpt4 book ai didi

java - ikvm java spring 问题 : Cannot find the declaration of element 'beans' .

转载 作者:行者123 更新时间:2023-12-01 05:40:18 27 4
gpt4 key购买 nike

我正在使用 ikvm .46 将 java 转换为 dll。

我正在尝试调用一个用java编写的函数(转换为DLL)来加载spring bean。我已将所有依赖项转换为dll。但事件最简单的应用程序上下文没有被加载。

应用程序上下文:/**************/

    <?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
>
</beans>

/************ */

加载 Bean 的代码片段:/*****************/

String[] configFiles = new String[] { "D:/config/spring/*.xml", "D:/config/spring/" + type + "/*.xml" }; 
FileSystemXmlApplicationContext ctx = null;
try{
ctx = new FileSystemXmlApplicationContext(configFiles);
}catch(Exception e){
log.info("context NOT created successfully");
}

“type”正在传递给函数,并且所有 xml 都存在于路径中。/*********** *******/

我得到的异常是:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML document from file [D:\config\spring\applicationContext-jdbc.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 6; cvc-elt.1: Cannot find the declaration of element 'beans'. 

我使用的Spring版本是:org.springframework.beans-3.0.0.RC1.dll

代码在 JVM 上运行良好。你能指出我在这里做错了什么吗?

感谢和问候安库尔

最佳答案

尝试在您的 xml 文件中使用它,我遇到了同样的问题

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd" >

关于java - ikvm java spring 问题 : Cannot find the declaration of element 'beans' .,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7351191/

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