org.springframework.beans.factory.xml.XmlBeanDefinitionReader -Ignored XML validation warning问题

03-10 12:59:59[WARN]org.springframework.beans.factory.xml.XmlBeanDefinitionReader
-Ignored XML validation warning
org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 72; schema_reference.4: 无法读取方案文档 ‘http://www.springframework.org/schema/beans/spring-beans-5.1.4.xsd’, 原因为 1) 无法找到文档; 2) 无法读取文档; 3) 文档的根元素不是 xsd:schema。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:392)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4158)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:4149)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument1(XSDHandler.java:2491)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2193)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:578)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:610)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2447)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1768)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl N S C o n t e n t D r i v e r . s c a n R o o t E l e m e n t H o o k ( X M L N S D o c u m e n t S c a n n e r I m p l . j a v a : 613 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L D o c u m e n t F r a g m e n t S c a n n e r I m p l NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImplFragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3132)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl P r o l o g D r i v e r . n e x t ( X M L D o c u m e n t S c a n n e r I m p l . j a v a : 852 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L D o c u m e n t S c a n n e r I m p l . n e x t ( X M L D o c u m e n t S c a n n e r I m p l . j a v a : 602 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L N S D o c u m e n t S c a n n e r I m p l . n e x t ( X M L N S D o c u m e n t S c a n n e r I m p l . j a v a : 112 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L D o c u m e n t F r a g m e n t S c a n n e r I m p l . s c a n D o c u m e n t ( X M L D o c u m e n t F r a g m e n t S c a n n e r I m p l . j a v a : 505 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . p a r s e r s . X M L 11 C o n f i g u r a t i o n . p a r s e ( X M L 11 C o n f i g u r a t i o n . j a v a : 842 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . p a r s e r s . X M L 11 C o n f i g u r a t i o n . p a r s e ( X M L 11 C o n f i g u r a t i o n . j a v a : 771 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . p a r s e r s . X M L P a r s e r . p a r s e ( X M L P a r s e r . j a v a : 141 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . p a r s e r s . D O M P a r s e r . p a r s e ( D O M P a r s e r . j a v a : 243 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . j a x p . D o c u m e n t B u i l d e r I m p l . p a r s e ( D o c u m e n t B u i l d e r I m p l . j a v a : 339 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . x m l . D e f a u l t D o c u m e n t L o a d e r . l o a d D o c u m e n t ( D e f a u l t D o c u m e n t L o a d e r . j a v a : 77 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . x m l . X m l B e a n D e f i n i t i o n R e a d e r . d o L o a d D o c u m e n t ( X m l B e a n D e f i n i t i o n R e a d e r . j a v a : 434 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . x m l . X m l B e a n D e f i n i t i o n R e a d e r . d o L o a d B e a n D e f i n i t i o n s ( X m l B e a n D e f i n i t i o n R e a d e r . j a v a : 392 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . x m l . X m l B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( X m l B e a n D e f i n i t i o n R e a d e r . j a v a : 336 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . x m l . X m l B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( X m l B e a n D e f i n i t i o n R e a d e r . j a v a : 304 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t B e a n D e f i n i t i o n R e a d e r . j a v a : 188 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t B e a n D e f i n i t i o n R e a d e r . j a v a : 224 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t B e a n D e f i n i t i o n R e a d e r . j a v a : 195 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t B e a n D e f i n i t i o n R e a d e r . j a v a : 257 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t X m l A p p l i c a t i o n C o n t e x t . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t X m l A p p l i c a t i o n C o n t e x t . j a v a : 128 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t X m l A p p l i c a t i o n C o n t e x t . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t X m l A p p l i c a t i o n C o n t e x t . j a v a : 94 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t R e f r e s h a b l e A p p l i c a t i o n C o n t e x t . r e f r e s h B e a n F a c t o r y ( A b s t r a c t R e f r e s h a b l e A p p l i c a t i o n C o n t e x t . j a v a : 133 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . o b t a i n F r e s h B e a n F a c t o r y ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 622 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . r e f r e s h ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 518 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . C l a s s P a t h X m l A p p l i c a t i o n C o n t e x t . < i n i t > ( C l a s s P a t h X m l A p p l i c a t i o n C o n t e x t . j a v a : 144 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . C l a s s P a t h X m l A p p l i c a t i o n C o n t e x t . < i n i t > ( C l a s s P a t h X m l A p p l i c a t i o n C o n t e x t . j a v a : 85 ) a t m y s p r i n g . t e s t H e l l o S p r i n g . m a i n ( t e s t H e l l o S p r i n g . j a v a : 10 ) C a u s e d b y : j a v a . i o . F i l e N o t F o u n d E x c e p t i o n : h t t p : / / w w w . s p r i n g f r a m e w o r k . o r g / s c h e m a / b e a n s / s p r i n g − b e a n s − 5.1.4. x s d a t s u n . n e t . w w w . p r o t o c o l . h t t p . H t t p U R L C o n n e c t i o n . g e t I n p u t S t r e a m 0 ( H t t p U R L C o n n e c t i o n . j a v a : 1890 ) a t s u n . n e t . w w w . p r o t o c o l . h t t p . H t t p U R L C o n n e c t i o n . g e t I n p u t S t r e a m ( H t t p U R L C o n n e c t i o n . j a v a : 1492 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L E n t i t y M a n a g e r . s e t u p C u r r e n t E n t i t y ( X M L E n t i t y M a n a g e r . j a v a : 647 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L V e r s i o n D e t e c t o r . d e t e r m i n e D o c V e r s i o n ( X M L V e r s i o n D e t e c t o r . j a v a : 148 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . x s . o p t i . S c h e m a P a r s i n g C o n f i g . p a r s e ( S c h e m a P a r s i n g C o n f i g . j a v a : 583 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . x s . o p t i . S c h e m a P a r s i n g C o n f i g . p a r s e ( S c h e m a P a r s i n g C o n f i g . j a v a : 686 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . x s . o p t i . S c h e m a D O M P a r s e r . p a r s e ( S c h e m a D O M P a r s e r . j a v a : 530 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . x s . t r a v e r s e r s . X S D H a n d l e r . g e t S c h e m a D o c u m e n t ( X S D H a n d l e r . j a v a : 2181 ) . . . 34 m o r e E x c e p t i o n i n t h r e a d " m a i n " o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . x m l . X m l B e a n D e f i n i t i o n S t o r e E x c e p t i o n : L i n e 5 i n X M L d o c u m e n t f r o m c l a s s p a t h r e s o u r c e [ a p p l i c a t i o n C o n t e x t . x m l ] i s i n v a l i d ; n e s t e d e x c e p t i o n i s o r g . x m l . s a x . S A X P a r s e E x c e p t i o n ; l i n e N u m b e r : 5 ; c o l u m n N u m b e r : 72 ; c v c − e l t . 1 : 找 不 到 元 素 ′ b e a n s ′ 的 声 明 。 a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . x m l . X m l B e a n D e f i n i t i o n R e a d e r . d o L o a d B e a n D e f i n i t i o n s ( X m l B e a n D e f i n i t i o n R e a d e r . j a v a : 404 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . x m l . X m l B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( X m l B e a n D e f i n i t i o n R e a d e r . j a v a : 336 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . x m l . X m l B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( X m l B e a n D e f i n i t i o n R e a d e r . j a v a : 304 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t B e a n D e f i n i t i o n R e a d e r . j a v a : 188 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t B e a n D e f i n i t i o n R e a d e r . j a v a : 224 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t B e a n D e f i n i t i o n R e a d e r . j a v a : 195 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n D e f i n i t i o n R e a d e r . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t B e a n D e f i n i t i o n R e a d e r . j a v a : 257 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t X m l A p p l i c a t i o n C o n t e x t . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t X m l A p p l i c a t i o n C o n t e x t . j a v a : 128 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t X m l A p p l i c a t i o n C o n t e x t . l o a d B e a n D e f i n i t i o n s ( A b s t r a c t X m l A p p l i c a t i o n C o n t e x t . j a v a : 94 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t R e f r e s h a b l e A p p l i c a t i o n C o n t e x t . r e f r e s h B e a n F a c t o r y ( A b s t r a c t R e f r e s h a b l e A p p l i c a t i o n C o n t e x t . j a v a : 133 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . o b t a i n F r e s h B e a n F a c t o r y ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 622 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . r e f r e s h ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 518 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . C l a s s P a t h X m l A p p l i c a t i o n C o n t e x t . < i n i t > ( C l a s s P a t h X m l A p p l i c a t i o n C o n t e x t . j a v a : 144 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . C l a s s P a t h X m l A p p l i c a t i o n C o n t e x t . < i n i t > ( C l a s s P a t h X m l A p p l i c a t i o n C o n t e x t . j a v a : 85 ) a t m y s p r i n g . t e s t H e l l o S p r i n g . m a i n ( t e s t H e l l o S p r i n g . j a v a : 10 ) C a u s e d b y : o r g . x m l . s a x . S A X P a r s e E x c e p t i o n ; l i n e N u m b e r : 5 ; c o l u m n N u m b e r : 72 ; c v c − e l t . 1 : 找 不 到 元 素 ′ b e a n s ′ 的 声 明 。 a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . u t i l . E r r o r H a n d l e r W r a p p e r . c r e a t e S A X P a r s e E x c e p t i o n ( E r r o r H a n d l e r W r a p p e r . j a v a : 203 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . u t i l . E r r o r H a n d l e r W r a p p e r . e r r o r ( E r r o r H a n d l e r W r a p p e r . j a v a : 134 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L E r r o r R e p o r t e r . r e p o r t E r r o r ( X M L E r r o r R e p o r t e r . j a v a : 396 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L E r r o r R e p o r t e r . r e p o r t E r r o r ( X M L E r r o r R e p o r t e r . j a v a : 327 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L E r r o r R e p o r t e r . r e p o r t E r r o r ( X M L E r r o r R e p o r t e r . j a v a : 284 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . x s . X M L S c h e m a V a l i d a t o r . h a n d l e S t a r t E l e m e n t ( X M L S c h e m a V a l i d a t o r . j a v a : 1901 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . x s . X M L S c h e m a V a l i d a t o r . s t a r t E l e m e n t ( X M L S c h e m a V a l i d a t o r . j a v a : 741 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L N S D o c u m e n t S c a n n e r I m p l . s c a n S t a r t E l e m e n t ( X M L N S D o c u m e n t S c a n n e r I m p l . j a v a : 374 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L N S D o c u m e n t S c a n n e r I m p l PrologDriver.next(XMLDocumentScannerImpl.java:852) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:434) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:257) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:128) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:94) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:622) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:518) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85) at myspring.testHelloSpring.main(testHelloSpring.java:10) Caused by: java.io.FileNotFoundException: http://www.springframework.org/schema/beans/spring-beans-5.1.4.xsd at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1890) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:148) at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:583) at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:686) at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:530) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2181) ... 34 more Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 72; cvc-elt.1: 找不到元素 'beans' 的声明。 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:257) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:128) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:94) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:622) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:518) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85) at myspring.testHelloSpring.main(testHelloSpring.java:10) Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 72; cvc-elt.1: 找不到元素 'beans' 的声明。 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1901) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl PrologDriver.next(XMLDocumentScannerImpl.java:852)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)atcom.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)atcom.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)atcom.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)atcom.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)atorg.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77)atorg.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:434)atorg.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)atorg.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)atorg.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195)atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:257)atorg.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:128)atorg.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:94)atorg.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)atorg.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:622)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:518)atorg.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)atorg.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)atmyspring.testHelloSpring.main(testHelloSpring.java:10)Causedby:java.io.FileNotFoundException:http://www.springframework.org/schema/beans/springbeans5.1.4.xsdatsun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1890)atsun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)atcom.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647)atcom.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:148)atcom.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:583)atcom.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:686)atcom.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:530)atcom.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2181)...34moreExceptioninthread"main"org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:Line5inXMLdocumentfromclasspathresource[applicationContext.xml]isinvalid;nestedexceptionisorg.xml.sax.SAXParseException;lineNumber:5;columnNumber:72;cvcelt.1:beansatorg.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)atorg.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)atorg.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195)atorg.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:257)atorg.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:128)atorg.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:94)atorg.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)atorg.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:622)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:518)atorg.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)atorg.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)atmyspring.testHelloSpring.main(testHelloSpring.java:10)Causedby:org.xml.sax.SAXParseException;lineNumber:5;columnNumber:72;cvcelt.1:beansatcom.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)atcom.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)atcom.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)atcom.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)atcom.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)atcom.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1901)atcom.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741)atcom.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)atcom.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImplNSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl F r a g m e n t C o n t e n t D r i v e r . n e x t ( X M L D o c u m e n t F r a g m e n t S c a n n e r I m p l . j a v a : 3132 ) a t c o m . s u n . o r g . a p a c h e . x e r c e s . i n t e r n a l . i m p l . X M L D o c u m e n t S c a n n e r I m p l FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3132) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3132)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImplPrologDriver.next(XMLDocumentScannerImpl.java:852)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:434)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
… 14 more

问题:

这是因为,Spring就是加载不了bean

解决办法:

Spring bean的一个属性default-lazy-init="true"和关于xsd解析文件版本号,把本来是5.0的版本号改成4.0项目,在再后边加上default-lazy-init=“true”,就能正常启动,如图所示:
org.springframework.beans.factory.xml.XmlBeanDefinitionReader -Ignored XML validation warning问题_第1张图片

你可能感兴趣的:(SSM问题)