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

unable to integrate my dao classes with spring

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Dear all,

I have DAO classes and i am doing something like


<context:component-scan base-package="com.pgi.em.dataaccess"/>

in my springs-bean.xml.

This particular line is giving me the following error

org.springframework.beans.factory.BeanDefinitionStoreException: Line 15 in XML d
ocument from ServletContext resource [/WEB-INF/classes/spring-beans.xml] is inva
lid; nested exception is org.xml.sax.SAXParseException: Element type "context:co
mponent-scan" must be declared.
Caused by:
org.xml.sax.SAXParseException: Element type "context:component-scan" must be dec
lared.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)



Can anybody please throw some light and let me know the possible remedy. Any help would be appreciated.

Thanks,
satish
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Did you correctly declare the namespace ?
 
Satish Jhaldiyal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Christophe Verré wrote:Did you correctly declare the namespace ?



hi Chris,

Thanks for your reply. yes i have 'em in my xml file. Following is my beans and error message i am getting...

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.1.xsd">

<context:component-scan
base-package="com.pan.eim.dataaccess.hibernate"/>



and message i am getting is

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Confi
uration problem: Unable to locate NamespaceHandler for namespace [http://www.sp
ingframework.org/schema/context]
Offending resource: ServletContext resource [/WEB-INF/classes/spring-beans.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.er
or(FailFastProblemReporter.java:59)



thanks,
satish
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,

I am also facing a similar problem.

My applicationContext.xml :



My POM.xml



Please help. I am stuck with this problem from past few days.
I have searched a lot but of no use. I even tried using spring xsd version 3.

Thanks.

Satish Jhaldiyal wrote:

Christophe Verré wrote:Did you correctly declare the namespace ?



hi Chris,

Thanks for your reply. yes i have 'em in my xml file. Following is my beans and error message i am getting...

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.1.xsd">

<context:component-scan
base-package="com.pan.eim.dataaccess.hibernate"/>



and message i am getting is

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Confi
uration problem: Unable to locate NamespaceHandler for namespace [http://www.sp
ingframework.org/schema/context]
Offending resource: ServletContext resource [/WEB-INF/classes/spring-beans.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.er
or(FailFastProblemReporter.java:59)



thanks,
satish

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please don't resurrect old threads. Create a new thread with your question. I am going to close this thread.

Thanks

Mark
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Your pom includes two versions of Spring.

Remove

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.0</version>
</dependency>

Also component-scan automatically includes context:annotation-config.

Mark

 
    Bookmark Topic Watch Topic
  • New Topic