开发者

ikvm java spring issue: Cannot find the declaration of element 'beans'.

开发者 https://www.devze.com 2023-04-03 09:11 出处:网络
I am using ikvm .46 to convery java to dll. I am trying to call a function written in java (converted to DLL ) that loads spring beans.I have converted all dependencies to dll.

I am using ikvm .46 to convery java to dll.

I am trying to call a function written in java (converted to DLL ) that loads spring beans.I have converted all dependencies to dll. But Event the simplest application context is not getting loaded.

App context : /**************/

    <?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> 

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

Code snippet to load Beans: /*****************/

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' is being passed to function and all xml exists on the path. /******************/

Th exception that I get is :

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreExce开发者_JAVA技巧ption: 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 version that I am using is : org.springframework.beans-3.0.0.RC1.dll

Code works fine with JVM. Can you please point out what I am doing wrong here?

Thanks and regards Ankur


try using this in your xml file I had the same problem

<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" >
0

精彩评论

暂无评论...
验证码 换一张
取 消