Questo errore è dovuto all'analisi non corretta del file xml. Utilizzo Eclipse per convalidare dà l'errore:
cvc-complex-type.2.3: Element 'beans' cannot have character [children], because the type's content type is element-only.
Sembra che ci sia un po 'strano personaggio tra una o molte di quelle <bean>
dichiarazioni. Hai copiato questo testo da qualche altra parte?
Rimuovere tutti gli spazi e i caratteri di nuova riga tra le definizioni <bean>
e reinserirli con l'editor.
UPDATE copia & incollatura in Notepad ++ il testo nel codepaste hai fornito, e impostando il set di caratteri UTF-8 ha mostrato questi personaggi nelle righe vuote: xA0. Questa è la traduzione Unicode standard per
. Questa è probabilmente la causa di questo problema.
Questa convalida ok per me:
<?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">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/HibernateDB" />
<property name="username" value="HibernateDB" />
<property name="password" value="java" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />
<property name="annotatedClasses">
<list>
<value>hdao.HibernateObject</value>
</list>
</property>
</bean><bean id="springHibernateOperator" class="hdao.SpringHibernateOperatorImplementation">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>
fonte
2011-10-20 12:12:11
inviare il codice XML e l'errore che hai trovato nella tua domanda per favore –