@ Test
Public void testXML () {
ApplicationContext context=
New ClassPathXmlApplicationContext (" the applicationcontext.xml ");
User User=context. GetBean (User. The class);
The user. The toString ();
}
The XML file is as follows:
<? The XML version="1.0" encoding="utf-8"?>XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance"
XMLNS: context="http://www.springframework.org/schema/context"
XMLNS: aop="http://www.springframework.org/schema/aop"
XMLNS: tx="http://www.springframework.org/schema/tx"
Xsi: schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd "& gt;
Error message is as follows:
Org. Springframework. Beans. Factory. BeanDefinitionStoreException: Unexpected exception parsing XML document from the class path resource [the applicationcontext.xml]; Nested exception is Java. Lang. ExceptionInInitializerError
The at org. Springframework. Beans. Factory. XML. XmlBeanDefinitionReader. DoLoadBeanDefinitions (XmlBeanDefinitionReader. Java: 414)
The at org. Springframework. Beans. Factory. XML. XmlBeanDefinitionReader. LoadBeanDefinitions (XmlBeanDefinitionReader. Java: 336)
The at org. Springframework. Beans. Factory. XML. XmlBeanDefinitionReader. LoadBeanDefinitions (XmlBeanDefinitionReader. Java: 304)
The at org. Springframework. Beans. Factory. Support. AbstractBeanDefinitionReader. LoadBeanDefinitions (AbstractBeanDefinitionReader. Java: 181)
The at org. Springframework. Beans. Factory. Support. AbstractBeanDefinitionReader. LoadBeanDefinitions (AbstractBeanDefinitionReader. Java: 217)
The at org. Springframework. Beans. Factory. Support. AbstractBeanDefinitionReader. LoadBeanDefinitions (AbstractBeanDefinitionReader. Java: 188)
The at org. Springframework. Beans. Factory. Support. AbstractBeanDefinitionReader. LoadBeanDefinitions (AbstractBeanDefinitionReader. Java: 252)
The at org. Springframework. Context. Support. AbstractXmlApplicationContext. LoadBeanDefinitions (AbstractXmlApplicationContext. Java: 127)
The at org. Springframework. Context. Support. AbstractXmlApplicationContext. LoadBeanDefinitions (AbstractXmlApplicationContext. Java: 93)
The at org. Springframework. Context. Support. AbstractRefreshableApplicationContext. RefreshBeanFactory (AbstractRefreshableApplicationContext. Java: 129)
The at org. Springframework. Context. Support. AbstractApplicationContext. ObtainFreshBeanFactory (AbstractApplicationContext. Java: 614)
The at org. Springframework. Context. Support. AbstractApplicationContext. Refresh (AbstractApplicationContext. Java: 515)
The at org. Springframework. Context. Support. ClassPathXmlApplicationContext. & lt; init> (ClassPathXmlApplicationContext. Java: 139)
The at org. Springframework. Context. Support. ClassPathXmlApplicationContext. & lt; init> (ClassPathXmlApplicationContext. Java: 83)
The at cn. Tewuyiang. Test. Test02. TestXML (46) Test02. Java:
At sun. Reflect. NativeMethodAccessorImpl. Invoke0 (Native Method)
At sun. Reflect. NativeMethodAccessorImpl. Invoke (NativeMethodAccessorImpl. Java: 62)
At sun. Reflect. DelegatingMethodAccessorImpl. Invoke (43) DelegatingMethodAccessorImpl. Java:
The at Java. Lang. Reflect. Method. Invoke (498) Method. The Java:
The at org. Junit. Runners. Model. FrameworkMethod $1. RunReflectiveCall (FrameworkMethod. Java: 50)
The at org. Junit. Internal. Runners. Model. ReflectiveCallable. Run (ReflectiveCallable. Java: 12)
The at org. Junit. Runners. Model. FrameworkMethod. InvokeExplosively (FrameworkMethod. Java: 47)
The at org. Junit. Internal. Runners. Statements. InvokeMethod. Evaluate (InvokeMethod. Java: 17)
The at org. Junit. Runners. ParentRunner. RunLeaf (ParentRunner. Java: 325)
The at org. Junit. Runners. BlockJUnit4ClassRunner. RunChild (BlockJUnit4ClassRunner. Java: 78)
The at org. Junit. Runners. BlockJUnit4ClassRunner. RunChild (BlockJUnit4ClassRunner. Java: 57)
The at org. Junit. Runners. ParentRunner $3. The run (ParentRunner. Java: 290)
The at org. Junit. Runners. ParentRunner $1. The schedule (ParentRunner. Java: 71)
The at org. Junit. Runners. ParentRunner. RunChildren (ParentRunner. Java: 288)
The at org. Junit. Runners. ParentRunner. Access the $000 (ParentRunner. Java: 58)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull