File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes unable to integrate my dao classes with spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Reply locked New topic
Author

unable to integrate my dao classes with spring

Satish Jhaldiyal
Greenhorn

Joined: Dec 30, 2008
Posts: 8
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


Its all in mind.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Did you correctly declare the namespace ?


[My Blog]
All roads lead to JavaRanch
Satish Jhaldiyal
Greenhorn

Joined: Dec 30, 2008
Posts: 8
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
Harvinder Singh g
Greenhorn

Joined: Dec 05, 2009
Posts: 8
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
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Please don't resurrect old threads. Create a new thread with your question. I am going to close this thread.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: unable to integrate my dao classes with spring
 
Similar Threads
Trying to run web app but getting exception no declaration found for <context:componet>
Spring Tiles Integration
problem with apache axis ,,
HELP:-( org.xml.sax.SAXParseException
Document root element "beans", must match DOCTYPE root "null" in eclipse