2011-08-22 11 views
5

Ecco gli estratti del file .xml del mio contesto Spring.Spring <jee: jndi-lookup> tag & `SAXParseException`

<?xml version="1.0" encoding="UTF-8"?> 
<beans:beans xmlns="http://www.springframework.org/schema/batch" 
    xmlns:beans="http://www.springframework.org/schema/beans" 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:jee="http://www.springframework.org/schema/jee" 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-2.0.xsd 
     http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd 
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd 
     http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> 

    <beans:import 
     resource="classpath:com/batch/jobs/data-source-context.xml" /> 

    <job id="xxxx"> 
     <step id="loadRecord"> 
      <tasklet> 
       <chunk reader="dtaFileItemReader" writer="dtaGroupWriter" 
        commit-interval="${job.commit.interval}" /> 
      </tasklet> 
     </step> 
    </job>    
    <jee:jndi-lookup id="dataSource" jndi-name="jdbc"></jee:jndi-lookup>   

    <beans:bean id="incrementerParent" class="${batch.database.incrementer.class}"> 
     <beans:property name="dataSource" ref="dataSource" /> 
     <beans:property name="incrementerName" value="ID" /> 
    </beans:bean> 

ottengo un'eccezione dicendo che:

nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'jee:jndi-lookup' 
+1

btw: si 'usando primavera-fagioli-2.0' potrebbe si desidera effettuare l'aggiornamento a 3.0? – Ralph

risposta

2

Si sta mescolando Spring (beans, aop e tx) 2.0 con lo schema JEE dalla Spring 3.0, che probabilmente porterà a problemi.

+1

avevi ragione. Scarica la nuova versione di Spring e cambia tutti i namespace. Ora funziona bene. Grazie. – nobody

+0

Potete per favore elaborare? Cosa deve essere fatto? – Aniruddha

+0

Assicurarsi che le definizioni dello spazio dei nomi nel contesto xml puntino tutte alla * stessa * versione. – beny23

2

Sembra che la primavera non ha trovato il org/springframework/ejb/config/spring-jee-3.0.xsd in fase di esecuzione.

Questo file si trova in spring-context-3.0.x.RELESE.jar, verificare che questo file sia distribuito correttamente.

9

Si dispone di una dichiarazione dello spazio dei nomi errata da qualche parte, probabilmente per bean e JEE.

Come per la documentation, la dichiarazione JEE XMLNS dovrebbe essere:

<?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:jee="http://www.springframework.org/schema/jee" 
     xsi:schemaLocation=" 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> 

<!-- <bean/> definitions here --> 

</beans> 
Problemi correlati