2016-08-29 9 views
0

Könnten einige bitte lassen Sie mich wissen, was ich hier vermisse. Ich bekomme die folgende AusnahmeSpring Bean Tag Fehler

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. 

Und ich habe meine test-context.xml wie unten.

<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"> 

Könnte jemand bitte lassen Sie mich wissen, warum ich hier bin fehlt. Ich habe Frühjahr 3.0.5 Frühling jar

Antwort

1

Sie sind rund um <beans></beans> Tags fehlen:

<beans> 
    <bean id="restAuthenticationEntryPoint" class="com.test.security.RestAuthenticationEntryPoint"> 
<beans> 

Dies ist, was die Fehlermeldung will Ihnen sagen, ...

ungültiger Inhalt gefunden wurde Beginnend mit Element 'Bean'.

"Das Bean-Tag ist nicht erlaubt hier"

Einer von [..] Bohnen, [..] erwartet wird

Die einzige gültige Tags hier sind "Bohnen" usw.

+0

Vielen Dank, dass Sie meine Zeit gespart haben. – ashishl

0

Fügen Sie <beans:beans/> zu Ihrer Konfigurations-XML hinzu.

<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 Ihrem xml Sie <bean> Tag aber nicht geschlossen geöffnet haben. <beans xmlns....> wo ist </beans> und das gleiche für restAuthenticationEntryPoint so erhalten Sie diese Ausnahme.