[Original] javaee project problem summary (2)

Source: Internet
Author: User
2. There is no ID/IDREF binding for IDREF error in Spring Configuration

The There is no ID/IDREF binding for IDREF error occurred during Spring configuration factory today. The exception information is as follows:

ERROR ContextLoader: 215-Context initialization failed
Org. springframework. beans. factory. xml. xmlBeanDefinitionStoreException: Line 52 in XML document from class path resources [applicationContext-transcation.xml] is invalid; nested exception is org. xml. sax. SAXParseException: cvc-id.1: There is no ID/IDREF binding for IDREF 'sessionfactory '.
At org. springframework. beans. factory. xml. XmlBeanDefinitionReader. doLoadBeanDefinitions (XmlBeanDefinitionReader. java: 404)
At org. springframework. beans. factory. xml. XmlBeanDefinitionReader. loadBeanDefinitions (XmlBeanDefinitionReader. java: 342)
At org. springframework. beans. factory. xml. XmlBeanDefinitionReader. loadBeanDefinitions (XmlBeanDefinitionReader. java: 310)
At org. springframework. beans. factory. support. AbstractBeanDefinitionReader. loadBeanDefinitions (AbstractBeanDefinitionReader. java: 143)
At org. springframework. beans. factory. support. AbstractBeanDefinitionReader. loadBeanDefinitions (AbstractBeanDefinitionReader. java: 178)
At org. springframework. beans. factory. support. AbstractBeanDefinitionReader. loadBeanDefinitions (AbstractBeanDefinitionReader. java: 149)
At org. springframework. web. context. support. XmlWebApplicationContext. loadBeanDefinitions (XmlWebApplicationContext. java: 124)
At org. springframework. web. context. support. XmlWebApplicationContext. loadBeanDefinitions (XmlWebApplicationContext. java: 92)
At org. springframework. context. support. AbstractRefreshableApplicationContext. refreshBeanFactory (AbstractRefreshableApplicationContext. java: 123)
At org. springframework. context. support. AbstractApplicationContext. obtainFreshBeanFactory (AbstractApplicationContext. java: 422)
At org. springframework. context. support. AbstractApplicationContext. refresh (AbstractApplicationContext. java: 352)
At org. springframework. web. context. ContextLoader. createWebApplicationContext (ContextLoader. java: 255)
At org. springframework. web. context. ContextLoader. initWebApplicationContext (ContextLoader. java: 199)
At org. springframework. web. context. ContextLoaderListener. contextInitialized (ContextLoaderListener. java: 45)
At org. apache. catalina. core. StandardContext. listenerStart (StandardContext. java: 4723)
At org. apache. catalina. core. StandardContext $1. call (StandardContext. java: 5226)
At org. apache. catalina. core. StandardContext $1. call (StandardContext. java: 5221)
At java. util. concurrent. FutureTask $ Sync. innerRun (FutureTask. java: 303)
At java. util. concurrent. FutureTask. run (FutureTask. java: 138)
At java. util. concurrent. ThreadPoolExecutor $ Worker. runTask (ThreadPoolExecutor. java: 886)
At java. util. concurrent. ThreadPoolExecutor $ Worker. run (ThreadPoolExecutor. java: 908)
At java. lang. Thread. run (Thread. java: 619)
Caused by: org. xml. sax. SAXParseException: cvc-id.1: There is no ID/IDREF binding for IDREF 'sessionfactory '.
At com.sun.org. apache. xerces. internal. util. ErrorHandlerWrapper. createSAXParseException (ErrorHandlerWrapper. java: 195)
At com.sun.org. apache. xerces. internal. util. ErrorHandlerWrapper. error (ErrorHandlerWrapper. java: 131)
At com.sun.org. apache. xerces. internal. impl. XMLErrorReporter. reportError (XMLErrorReporter. java: 384)
At com.sun.org. apache. xerces. internal. impl. XMLErrorReporter. reportError (XMLErrorReporter. java: 318)
At com.sun.org. Apache. xerces. Internal. impl. Xs. xmlschemavalidator $ xsierrorreporter. reporterror (xmlschemavalidator. Java: 410)
At com.sun.org. Apache. xerces. Internal. impl. Xs. xmlschemavalidator. reportschemaerror (xmlschemavalidator. Java: 3165)
At com.sun.org. Apache. xerces. Internal. impl. Xs. xmlschemavalidator. handleendelement (xmlschemavalidator. Java: 2191)
At com.sun.org. Apache. xerces. Internal. impl. Xs. xmlschemavalidator. endelement (xmlschemavalidator. Java: 791)
At com.sun.org. Apache. xerces. Internal. impl. xmldocumentfragmentscannerimpl. scanendelement (xmldocumentfragmentscannerimpl. Java: 1774)
At com.sun.org. Apache. xerces. Internal. impl. xmldocumentfragmentscannerimpl $ fragmentcontentdriver. Next (xmldocumentfragmentscannerimpl. Java: 2930)
At com.sun.org. Apache. xerces. Internal. impl. xmldocumentscannerimpl. Next (xmldocumentscannerimpl. Java: 648)
At com.sun.org. Apache. xerces. Internal. impl. xmlnsdocumentscannerimpl. Next (xmlnsdocumentscannerimpl. Java: 140)
At com.sun.org. Apache. xerces. Internal. impl. xmldocumentfragmentscannerimpl. scandocument (xmldocumentfragmentscannerimpl. Java: 510)
At com.sun.org. Apache. xerces. Internal. parsers. xml11configuration. parse (xml11configuration. Java: 807)
At com.sun.org. Apache. xerces. Internal. parsers. xml11configuration. parse (xml11configuration. Java: 737)
At com.sun.org. Apache. xerces. Internal. parsers. xmlparser. parse (xmlparser. Java: 107)
At com.sun.org. Apache. xerces. Internal. parsers. domparser. parse (domparser. Java: 225)
At com.sun.org. Apache. xerces. Internal. JAXP. documentbuilderimpl. parse (documentbuilderimpl. Java: 283)
At org. springframework. Beans. Factory. xml. defaultdocumentloader. loaddocument (defadocumentdocumentloader. Java: 75)
At org. springframework. beans. factory. xml. XmlBeanDefinitionReader. doLoadBeanDefinitions (XmlBeanDefinitionReader. java: 396)
... 21 more
2012-5-23 21:38:42 org. apache. catalina. core. StandardContext listenerStart
Severe: Exception sending context initialized event to listener instance of class org. springframework. web. context. ContextLoaderListener
Org. springframework. beans. factory. xml. xmlBeanDefinitionStoreException: Line 52 in XML document from class path resources [applicationContext-transcation.xml] is invalid; nested exception is org. xml. sax. SAXParseException: cvc-id.1: There is no ID/IDREF binding for IDREF 'sessionfactory '.
At org. springframework. beans. factory. xml. XmlBeanDefinitionReader. doLoadBeanDefinitions (XmlBeanDefinitionReader. java: 404)
At org. springframework. beans. factory. xml. XmlBeanDefinitionReader. loadBeanDefinitions (XmlBeanDefinitionReader. java: 342)
At org. springframework. Beans. Factory. xml. xmlbeandefinitionreader. loadbeandefinitions (xmlbeandefinitionreader. Java: 310)
At org. springframework. Beans. Factory. Support. abstractbeandefinitionreader. loadbeandefinitions (abstractbeandefinitionreader. Java: 143)
At org. springframework. Beans. Factory. Support. abstractbeandefinitionreader. loadbeandefinitions (abstractbeandefinitionreader. Java: 178)
At org. springframework. Beans. Factory. Support. abstractbeandefinitionreader. loadbeandefinitions (abstractbeandefinitionreader. Java: 149)
At org. springframework. Web. Context. Support. xmlwebapplicationcontext. loadbeandefinitions (xmlwebapplicationcontext. Java: 124)
At org. springframework. Web. Context. Support. xmlwebapplicationcontext. loadbeandefinitions (xmlwebapplicationcontext. Java: 92)
At org. springframework. context. support. AbstractRefreshableApplicationContext. refreshBeanFactory (AbstractRefreshableApplicationContext. java: 123)
At org. springframework. context. support. AbstractApplicationContext. obtainFreshBeanFactory (AbstractApplicationContext. java: 422)
At org. springframework. context. support. AbstractApplicationContext. refresh (AbstractApplicationContext. java: 352)
At org. springframework. web. context. ContextLoader. createWebApplicationContext (ContextLoader. java: 255)
At org. springframework. web. context. ContextLoader. initWebApplicationContext (ContextLoader. java: 199)
At org. springframework. web. context. ContextLoaderListener. contextInitialized (ContextLoaderListener. java: 45)
At org. apache. catalina. core. StandardContext. listenerStart (StandardContext. java: 4723)
At org. apache. catalina. core. StandardContext $1. call (StandardContext. java: 5226)
At org. apache. catalina. core. StandardContext $1. call (StandardContext. java: 5221)
At java. util. concurrent. FutureTask $ Sync. innerRun (FutureTask. java: 303)
At java. util. concurrent. FutureTask. run (FutureTask. java: 138)
At java. util. concurrent. ThreadPoolExecutor $ Worker. runTask (ThreadPoolExecutor. java: 886)
At java. util. concurrent. ThreadPoolExecutor $ Worker. run (ThreadPoolExecutor. java: 908)
At java. lang. Thread. run (Thread. java: 619)

Caused by: org. xml. sax. SAXParseException: cvc-id.1: There is no ID/IDREF binding for IDREF'SessionFactory'.

From the error message, we can see that this error is related to sessionFactory. sessionFactory is the object of the HibernateSessionFactory class and has been applied to the spring configuration file applicationContext. therefore, find the sub-configuration file (springForOthers. xml) the following configuration is found:

<Property name = "sessionFactory">
<RefLocal= "SessionFactory"/>
</Property>

The error appears in the red-bold local. If you use local, it indicates you can find the bean with the id sessionFactory in the current allocation file, the correct method is to use <ref bean = "sessionFactory"/> and change local to bean to search for all beans, not just the current configuration file, after this setting, the error is solved.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.