Reputation: 203
Could some please let me know what things I am missing here. I m getting the below exception
Line 76 in XML document from file [C:\S2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\proj_name\WEB-INF\classes\spring\test-context.xml] is invalid; nested exception is
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content
was found starting with element 'bean'. One of '{"http://www.springframework.org/schema/beans":description,
"http://www.springframework.org/schema/beans":meta,
"http://www.springframework.org/schema/beans":constructor-arg, "http://www.springframework.org/schema/beans":property, "http://www.springframework.org/schema/beans":qualifier, "http://www.springframework.org/schema/beans":lookup-method, "http://www.springframework.org/schema/beans":replaced-method, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.
And I have my test-context.xml as below.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-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/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
<bean id="restAuthenticationEntryPoint" class="com.test.security.RestAuthenticationEntryPoint">
Could anybody please let me know why I am missing here . i have spring 3.0.5 Spring jar
Upvotes: 0
Views: 748
Reputation: 3431
Add <beans:beans/>
to your config xml.
<beans:beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-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/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
<beans:beans id="restAuthenticationEntryPoint" class="com.test.security.RestAuthenticationEntryPoint"/>
</beans:beans>
In your xml you have opened <bean>
tag but not closed.
<beans xmlns....>
where is </beans>
and same for restAuthenticationEntryPoint
so you are getting that exception.
Upvotes: 0
Reputation: 10652
You are missing surrounding <beans>
</beans>
tags:
<beans>
<bean id="restAuthenticationEntryPoint" class="com.test.security.RestAuthenticationEntryPoint">
<beans>
This is what the error message wants to tell you...
Invalid content was found starting with element 'bean'.
"The bean tag is not allowed here"
One of [..] beans, [..] is expected
The only valid tags here are "beans", etc.
Upvotes: 1