• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error running the application

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am getting an error while starting the application. It is a simple application which uses Spring on the web side and Hibernate to manage jdbc. Couldn't identify the error. Can anyone please help me?
Listing out the code and the error below:

applicationContext-dao.xml


ecom.properties file



applicationContext-jdbc.xml


hibernate.cfg.xml



and finally, web.xml



I think I've added all the necessary jar files to the lib folder of the WEB-INF folder.

The error I got is :
  • error log

    23-Apr-2011 19:51:05 org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\PC Connectivity Solution\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;;C:\Program Files\jEdit;c:\Program Files\Java\jdk1.6.0_21\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\QuickTime\QTSystem\
    23-Apr-2011 19:51:05 org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:EcomTesting' did not find a matching property.
    23-Apr-2011 19:51:05 org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    23-Apr-2011 19:51:05 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 588 ms
    23-Apr-2011 19:51:05 org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    23-Apr-2011 19:51:05 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.26
    23-Apr-2011 19:51:06 org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    23-Apr-2011 19:51:06 org.springframework.web.context.ContextLoader initWebApplicationContext
    INFO: Root WebApplicationContext: initialization started
    23-Apr-2011 19:51:06 org.springframework.context.support.AbstractApplicationContext prepareRefresh
    INFO: Refreshing org.springframework.web.context.support.XmlWebApplicationContext@538d7ace: display name [Root WebApplicationContext]; startup date [Sat Apr 23 19:51:06 BST 2011]; root of context hierarchy
    23-Apr-2011 19:51:06 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [applicationContext-dao.xml]
    23-Apr-2011 19:51:06 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [applicationContext-jdbc.xml]
    23-Apr-2011 19:51:06 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
    INFO: Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@538d7ace]: org.springframework.beans.factory.support.DefaultListableBeanFactory@5adf48c4
    23-Apr-2011 19:51:07 org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
    INFO: Loading properties file from class path resource [ecom.properties]
    23-Apr-2011 19:51:07 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
    INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5adf48c4: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,sessionFactory,transactionManager,hibernateTemplate,jdbcTemplate,InsValue,ecomProperties,dataSource]; root of factory hierarchy
    90 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA
    109 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA
    114 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
    120 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
    128 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
    233 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA
    558 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(5) Element type "hibernate-mapping" must be declared.
    559 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(5) Attribute "default-cascade" must be declared for element type "hibernate-mapping".
    559 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(5) Attribute "default-access" must be declared for element type "hibernate-mapping".
    559 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(5) Attribute "default-lazy" must be declared for element type "hibernate-mapping".
    559 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(5) Attribute "auto-import" must be declared for element type "hibernate-mapping".
    575 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(6) Element type "class" must be declared.
    575 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(6) Attribute "name" must be declared for element type "class".
    575 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(6) Attribute "table" must be declared for element type "class".
    577 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(7) Element type "meta" must be declared.
    578 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(7) Attribute "attribute" must be declared for element type "meta".
    578 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(8) Element type "id" must be declared.
    578 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(8) Attribute "name" must be declared for element type "id".
    578 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(8) Attribute "type" must be declared for element type "id".
    578 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(9) Element type "column" must be declared.
    578 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(9) Attribute "name" must be declared for element type "column".
    578 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(10) Element type "generator" must be declared.
    578 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(10) Attribute "class" must be declared for element type "generator".
    579 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(12) Element type "property" must be declared.
    579 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(12) Attribute "name" must be declared for element type "property".
    579 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(12) Attribute "type" must be declared for element type "property".
    579 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(13) Element type "column" must be declared.
    579 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(13) Attribute "name" must be declared for element type "column".
    579 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(15) Element type "property" must be declared.
    579 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(15) Attribute "name" must be declared for element type "property".
    579 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(15) Attribute "type" must be declared for element type "property".
    580 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(16) Element type "column" must be declared.
    580 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(16) Attribute "name" must be declared for element type "column".
    23-Apr-2011 19:51:07 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
    INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5adf48c4: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,sessionFactory,transactionManager,hibernateTemplate,jdbcTemplate,InsValue,ecomProperties,dataSource]; root of factory hierarchy
    23-Apr-2011 19:51:07 org.springframework.web.context.ContextLoader initWebApplicationContext
    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: invalid mapping
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    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:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: org.hibernate.MappingException: invalid mapping
    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:777)
    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:64)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:631)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
    ... 30 more
    Caused by: org.xml.sax.SAXParseException: Element type "hibernate-mapping" must be declared.
    at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
    at org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1807)
    at org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:3633)
    at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1229)
    at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:938)
    at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
    at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:773)
    ... 35 more
    23-Apr-2011 19:51:07 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.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: invalid mapping
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    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:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: org.hibernate.MappingException: invalid mapping
    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:777)
    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:64)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:631)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
    ... 30 more
    Caused by: org.xml.sax.SAXParseException: Element type "hibernate-mapping" must be declared.
    at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
    at org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1807)
    at org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:3633)
    at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1229)
    at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:938)
    at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
    at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:773)
    ... 35 more
    23-Apr-2011 19:51:07 org.apache.catalina.core.StandardContext start
    SEVERE: Error listenerStart
    23-Apr-2011 19:51:07 org.apache.catalina.core.StandardContext start
    SEVERE: Context [/EcomTesting] startup failed due to previous errors
    23-Apr-2011 19:51:07 org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    23-Apr-2011 19:51:07 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    SEVERE: A web application registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.



  • This is the first time that I've tried to configured Spring and Hibernate. I've worked little bit on it before.
    Thanks in advance..!
     
    Ranch Hand
    Posts: 672
    4
    Eclipse IDE Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Nitin Menon wrote:Caused by: org.xml.sax.SAXParseException: Element type "hibernate-mapping" must be declared.



    This is the main exception.
    Seems like an issue with mapping files. Can you show us your mapping files..
     
    Nitin Menon
    Ranch Hand
    Posts: 88
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    This is the mapping file :



    and the VO class is

     
    Prasad Krishnegowda
    Ranch Hand
    Posts: 672
    4
    Eclipse IDE Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The mapping file looks ok.. are you having the hibernate.jar and other required jar files in the classpath?
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic