Unable to locate Spring NamespaceHandler for element











up vote
0
down vote

favorite












So I have a spring project that I will want to use with a h2 database but am having some trouble with the initial set up and I can't seem to figure out what's wrong.
Here are my dependencies in my pom file.



<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
</dependency>

</dependencies>


and here is my beans.xml file



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
xmlns:context="https://mvnrepository.com/artifact/org.springframework/spring-context"
xmlns:jdbc="https://mvnrepository.com/artifact/org.springframework/spring-jdbc">

<context:component-scan base-package="darragh"></context:component-scan>

<jdbc:embedded-database id="dataSource" type="h2">
<jdbc:script location="schema.sql" />
<jdbc:script location="data.sql" />
</jdbc:embedded-database>




I am getting the following errors.




Unable to locate Spring NamespaceHandler for element 'context:component-scan' of schema namespace 'https://mvnrepository.com/
artifact/org.springframework/spring-context'




and




Unable to locate Spring NamespaceHandler for element 'jdbc:embedded-database' of schema namespace 'https://mvnrepository.com/
artifact/org.springframework/spring-jdbc'




Forgive me as I'm new to spring and don't understand why I am these error messages










share|improve this question
























  • try to have same version for spring-context and spring-jdbc
    – Deadpool
    Nov 11 at 2:17










  • @Deadpool Ah ok updated the question with same versions. Still same error though
    – John O C
    Nov 11 at 2:21










  • http://www.springframework.org/schema/context/spring-context-3.0.xsd add this in xsi:schemaLocation can you try this
    – Deadpool
    Nov 11 at 2:35










  • @Deadpool When you say add do you mean replace what's already in the " ". By replacing it with your line I get the following error "Multiple annotations found at this line: - cvc-elt.1: Cannot find the declaration of element 'beans'. - SchemaLocation: schemaLocation value = 'springframework.org/schema/context/spring- context-3.0.xsd' must have even number of URI's." on line 6 my jdbc one
    – John O C
    Nov 11 at 2:40

















up vote
0
down vote

favorite












So I have a spring project that I will want to use with a h2 database but am having some trouble with the initial set up and I can't seem to figure out what's wrong.
Here are my dependencies in my pom file.



<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
</dependency>

</dependencies>


and here is my beans.xml file



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
xmlns:context="https://mvnrepository.com/artifact/org.springframework/spring-context"
xmlns:jdbc="https://mvnrepository.com/artifact/org.springframework/spring-jdbc">

<context:component-scan base-package="darragh"></context:component-scan>

<jdbc:embedded-database id="dataSource" type="h2">
<jdbc:script location="schema.sql" />
<jdbc:script location="data.sql" />
</jdbc:embedded-database>




I am getting the following errors.




Unable to locate Spring NamespaceHandler for element 'context:component-scan' of schema namespace 'https://mvnrepository.com/
artifact/org.springframework/spring-context'




and




Unable to locate Spring NamespaceHandler for element 'jdbc:embedded-database' of schema namespace 'https://mvnrepository.com/
artifact/org.springframework/spring-jdbc'




Forgive me as I'm new to spring and don't understand why I am these error messages










share|improve this question
























  • try to have same version for spring-context and spring-jdbc
    – Deadpool
    Nov 11 at 2:17










  • @Deadpool Ah ok updated the question with same versions. Still same error though
    – John O C
    Nov 11 at 2:21










  • http://www.springframework.org/schema/context/spring-context-3.0.xsd add this in xsi:schemaLocation can you try this
    – Deadpool
    Nov 11 at 2:35










  • @Deadpool When you say add do you mean replace what's already in the " ". By replacing it with your line I get the following error "Multiple annotations found at this line: - cvc-elt.1: Cannot find the declaration of element 'beans'. - SchemaLocation: schemaLocation value = 'springframework.org/schema/context/spring- context-3.0.xsd' must have even number of URI's." on line 6 my jdbc one
    – John O C
    Nov 11 at 2:40















up vote
0
down vote

favorite









up vote
0
down vote

favorite











So I have a spring project that I will want to use with a h2 database but am having some trouble with the initial set up and I can't seem to figure out what's wrong.
Here are my dependencies in my pom file.



<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
</dependency>

</dependencies>


and here is my beans.xml file



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
xmlns:context="https://mvnrepository.com/artifact/org.springframework/spring-context"
xmlns:jdbc="https://mvnrepository.com/artifact/org.springframework/spring-jdbc">

<context:component-scan base-package="darragh"></context:component-scan>

<jdbc:embedded-database id="dataSource" type="h2">
<jdbc:script location="schema.sql" />
<jdbc:script location="data.sql" />
</jdbc:embedded-database>




I am getting the following errors.




Unable to locate Spring NamespaceHandler for element 'context:component-scan' of schema namespace 'https://mvnrepository.com/
artifact/org.springframework/spring-context'




and




Unable to locate Spring NamespaceHandler for element 'jdbc:embedded-database' of schema namespace 'https://mvnrepository.com/
artifact/org.springframework/spring-jdbc'




Forgive me as I'm new to spring and don't understand why I am these error messages










share|improve this question















So I have a spring project that I will want to use with a h2 database but am having some trouble with the initial set up and I can't seem to figure out what's wrong.
Here are my dependencies in my pom file.



<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
</dependency>

</dependencies>


and here is my beans.xml file



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
xmlns:context="https://mvnrepository.com/artifact/org.springframework/spring-context"
xmlns:jdbc="https://mvnrepository.com/artifact/org.springframework/spring-jdbc">

<context:component-scan base-package="darragh"></context:component-scan>

<jdbc:embedded-database id="dataSource" type="h2">
<jdbc:script location="schema.sql" />
<jdbc:script location="data.sql" />
</jdbc:embedded-database>




I am getting the following errors.




Unable to locate Spring NamespaceHandler for element 'context:component-scan' of schema namespace 'https://mvnrepository.com/
artifact/org.springframework/spring-context'




and




Unable to locate Spring NamespaceHandler for element 'jdbc:embedded-database' of schema namespace 'https://mvnrepository.com/
artifact/org.springframework/spring-jdbc'




Forgive me as I'm new to spring and don't understand why I am these error messages







java xml spring spring-boot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 4:58









mhshimul

4,7532825




4,7532825










asked Nov 11 at 2:07









John O C

225




225












  • try to have same version for spring-context and spring-jdbc
    – Deadpool
    Nov 11 at 2:17










  • @Deadpool Ah ok updated the question with same versions. Still same error though
    – John O C
    Nov 11 at 2:21










  • http://www.springframework.org/schema/context/spring-context-3.0.xsd add this in xsi:schemaLocation can you try this
    – Deadpool
    Nov 11 at 2:35










  • @Deadpool When you say add do you mean replace what's already in the " ". By replacing it with your line I get the following error "Multiple annotations found at this line: - cvc-elt.1: Cannot find the declaration of element 'beans'. - SchemaLocation: schemaLocation value = 'springframework.org/schema/context/spring- context-3.0.xsd' must have even number of URI's." on line 6 my jdbc one
    – John O C
    Nov 11 at 2:40




















  • try to have same version for spring-context and spring-jdbc
    – Deadpool
    Nov 11 at 2:17










  • @Deadpool Ah ok updated the question with same versions. Still same error though
    – John O C
    Nov 11 at 2:21










  • http://www.springframework.org/schema/context/spring-context-3.0.xsd add this in xsi:schemaLocation can you try this
    – Deadpool
    Nov 11 at 2:35










  • @Deadpool When you say add do you mean replace what's already in the " ". By replacing it with your line I get the following error "Multiple annotations found at this line: - cvc-elt.1: Cannot find the declaration of element 'beans'. - SchemaLocation: schemaLocation value = 'springframework.org/schema/context/spring- context-3.0.xsd' must have even number of URI's." on line 6 my jdbc one
    – John O C
    Nov 11 at 2:40


















try to have same version for spring-context and spring-jdbc
– Deadpool
Nov 11 at 2:17




try to have same version for spring-context and spring-jdbc
– Deadpool
Nov 11 at 2:17












@Deadpool Ah ok updated the question with same versions. Still same error though
– John O C
Nov 11 at 2:21




@Deadpool Ah ok updated the question with same versions. Still same error though
– John O C
Nov 11 at 2:21












http://www.springframework.org/schema/context/spring-context-3.0.xsd add this in xsi:schemaLocation can you try this
– Deadpool
Nov 11 at 2:35




http://www.springframework.org/schema/context/spring-context-3.0.xsd add this in xsi:schemaLocation can you try this
– Deadpool
Nov 11 at 2:35












@Deadpool When you say add do you mean replace what's already in the " ". By replacing it with your line I get the following error "Multiple annotations found at this line: - cvc-elt.1: Cannot find the declaration of element 'beans'. - SchemaLocation: schemaLocation value = 'springframework.org/schema/context/spring- context-3.0.xsd' must have even number of URI's." on line 6 my jdbc one
– John O C
Nov 11 at 2:40






@Deadpool When you say add do you mean replace what's already in the " ". By replacing it with your line I get the following error "Multiple annotations found at this line: - cvc-elt.1: Cannot find the declaration of element 'beans'. - SchemaLocation: schemaLocation value = 'springframework.org/schema/context/spring- context-3.0.xsd' must have even number of URI's." on line 6 my jdbc one
– John O C
Nov 11 at 2:40



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245235%2funable-to-locate-spring-namespacehandler-for-element%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245235%2funable-to-locate-spring-namespacehandler-for-element%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Full-time equivalent

さくらももこ

13 indicted, 8 arrested in Calif. drug cartel investigation