Unable to locate Spring NamespaceHandler for XML schema namespace http://www.springframework.org/schema/data/solr - spring

I am trying to integrate spring and Apache solr. For that i am trying NamespaceHandler http://www.springframework.org/schema/data/solr. But this giving me the following error.
Can any please help me.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task"
xmlns:solr="http://www.springframework.org/schema/data/solr"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/oxm
http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/data/solr
http://www.springframework.org/schema/data/solr/spring-solr.xsd
">
This is leading to an error
Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/data/solr]Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]
Thanx in advance for any help..

If this is a new project, you should start from Spring Boot and add Spring Data Solr into it. There are sample projects of how to do it. You can also check a real project using Spring Boot, and Spring Data Solr for auto-complete.

Related

How to resolve this error in springMVC?

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace [http://www.springframework.org/schema/context]
Short answer: use the correct syntax in the spring XML configuration file.
Here is an example that includes the context schema:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
... config stuff
</beans>

Spring-Data-JPA causes XSD validation error in Spring STS using XML configuration

Eclipse/STS reports errors using Spring 3.2.1 with Spring-data-jpa together.
I have some XML configuration files with the following header:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
I am using Spring 3.2.1 with Spring-Data-JPA 1.3.0 and Eclipse/STS is reporting this:
Referenced file contains errors
(http://www.springframework.org/schema/data/jpa)
This happens in every single XML configuration file that contains the data-jpa schema.
When I remove JPA from the XML config, everything is just fine.
Is my configuration wrong or what happens here?
Thanks!
Paul
Today there is not a http://www.springframework.org/schema/data/jpa/spring-jpa.xml file so you have to use http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd, but this file use http://www.springframework.org/schema/data/repository/spring-repository.xsd that does not exist too so you have to add the location of this schema in your context file:
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
http://www.springframework.org/schema/data/repository
http://www.springframework.org/schema/data/repository/spring-repository-1.5.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.2.xsd"

failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-3.0.xsd'

While starting my Spring App, I am getting the following error :
WARNING: Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document
'http://www.springframework.org/schema/beans/spring-beans-3.0.xsd', because
1) could not find the document;
2) the document could not be read;
3) the root element of the document is not <xsd:schema>.
My springapp-servlet.xml is as follows :
<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean name="/hello.htm" class="springapp.web.HelloController"/>
</beans>
Please suggest.
When I got this error message, it was merely because of a missing jar in my CLASSPATH. Some spring applications seem to be very hungry for spring jars. My app wound up needing all of these on the classpath:
${OTS_DIR}/org.springframework.aop-${VERSION}.jar:\
${OTS_DIR}/org.springframework.aspects-${VERSION}.jar:\
${OTS_DIR}/com.springsource.org.aopalliance-${AOPALLIANCE_VER}.jar:\
${OTS_DIR}/org.springframework.asm-${VERSION}.jar:\
${OTS_DIR}/org.springframework.beans-${VERSION}.jar:\
${OTS_DIR}/org.springframework.context-${VERSION}.jar:\
${OTS_DIR}/org.springframework.core-${VERSION}.jar:\
${OTS_DIR}/org.springframework.expression-${VERSION}.jar:\
${OTS_DIR}/org.springframework.jdbc-${VERSION}.jar:\
${OTS_DIR}/org.springframework.jms-${VERSION}.jar:\
${OTS_DIR}/org.springframework.orm-${VERSION}.jar:\
${OTS_DIR}/org.springframework.transaction-${VERSION}.jar:\
${OTS_DIR}/org.springframework.instrument-${VERSION}.jar
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Can't load spring 3 schemas

i am using Spring 3.0.5.RELEASE
and today when building the project with maven, i am getting following errors in appicationContext.xml file:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element
'context:component-scan'.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:annotation-
config'.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-
driven'.
i tried to open the schema links:
Spring XML Beans Schema
Spring Framework's declarative
transaction management infrastructure
Spring Framework's application
context support
but i always gets the page Forbidden !
here's how i am configuring the applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
please advise how to fix this error.
seems that the public schemas are not available anymore, so i load the schemas from the jars on the classpath instead as follows:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
classpath:/org/springframework/beans/factory/xml/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
classpath:/org/springframework/transaction/config/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
classpath:/org/springframework/context/config/spring-context-3.0.xsd">
Seems you are experiencing this problem: Spring Beans Schema no longer available on the Web? Are you defining schemaLocation explicitly?
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/context/spring-context-3.0.xsd
">

Drools integrated with spring faced with a xsd not found warning

I'm using Spring+Drools in my Web Application.The following is the drools modules configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:drools="http://drools.org/schema/drools-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://drools.org/schema/drools-spring
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd"
default-autowire="byName">
<drools:kbase id="kbase1">
<drools:resources>
<drools:resource type="DRL" source="classpath:uniteStickyRules.drl"/>
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession1" type="stateful" kbase="kbase1"/>
When I ran my application using this configuration in my junit project it worked, yet it came with the following problem when I startup my Web application. As a result, I couldnot find my kbase bean.
2012-03-29 12:55:48,402 WARN resolver.SpringPluggableSchemas - Could not find schema classpath:org/drools/container/spring/drools-service-spring.xsd for URI: http://drools.org/schema/drools-service-spring.xsd,
class path resource [org/drools/container/spring/drools-service-spring.xsd] cannot be resolved to URL because it does not exist
2012-03-29 12:55:48,413 WARN resolver.SpringPluggableSchemas - Could not find schema classpath:file:/C:/Users/Dan%20Diephouse/workspace/xfire/target/checkout/xfire-spring/target/test-generated/services.xsd for URI: http://xfire.codehaus.org/config/1.0,
class path resource [file:/C:/Users/Dan%20Diephouse/workspace/xfire/target/checkout/xfire-spring/target/test-generated/services.xsd] cannot be resolved to URL because it does not exist
You see, I didn't put the drools-service-spring.xsd in my .xml file. So I'm quite stuck with it. Any suggestions?

Resources