Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cvc-elt.1: Cannot find the declaration of element 'beans' [SPR-10400] #15033

Closed
spring-issuemaster opened this issue Mar 20, 2013 · 2 comments
Assignees

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Mar 20, 2013

Eugène Münch opened SPR-10400 and commented

I'm stuck on my project because of this issue "cvc-elt.1: Cannot find the declaration of element 'beans'. " from my applicationContext-mongo.xml.

I have maven dependencies on my classpath and the project is generated using Roo.

here is my applicationContext-mongo.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mongo="http://www.springframework.org/schema/data/mongo"


	xsi:schemaLocation="http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">

    <mongo:db-factory dbname="${mongo.database}" host="${mongo.host}" id="mongoDbFactory" port="${mongo.port}"/>

    <mongo:repositories base-package="fr.afpa"/>

    <!-- To translate any MongoExceptions thrown in @Repository annotated classes -->
    <context:annotation-config/>

    <bean class="org.springframework.data.mongodb.core.MongoTemplate" id="mongoTemplate">
        <constructor-arg ref="mongoDbFactory"/>
    </bean>

</beans>

and my roo script:

// Spring Roo 1.2.3.RELEASE [rev 7fd62b6] log opened at 2013-03-19 22:06:01
project --topLevelPackage fr.afpa
mongo setup --databaseName dbprojet2 --host localhost --port 27017
entity mongo --class ~.domains.Rubrique --testAutomatically
field string --fieldName name --notNull 
field string --fieldName surname --notNull 
repository mongo --interface ~.repositories.RubriqueRepository --entity ~.domains.Rubrique
service --interface ~.services.RubriqueService --entity ~.domains.Rubrique
perform test
web mvc setup
perform test
web mvc all --package ~.controllers

It's very frustating!!!!!!.

Can anyone help please???

regards.


Affects: 3.2 GA

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Mar 20, 2013

Phil Webb commented

It looks like you xmlns declarations are incorrect, the default xmlns should be set to http://www.springframework.org/schema/beans but instead your file has a beans: prefix. Try:

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:mongo="http://www.springframework.org/schema/data/mongo"
  xsi:schemaLocation="http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">

  <!-- Bean Declarations -->

</beans>

I assume this file was generated by Spring Roo, if it was not hand edited you might want to raise a JIRA with that team.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Mar 21, 2013

Eugène Münch commented

Hi Phil,

Thank you for your answer.

I'm new to spring (started using it a month ago) and old Perl developper.

I did solve (last night here) the issue that was frustated me for a week now and happy to share with you.
You are totally right Phil!!!!!!!!!!!!

Bellow is the solution.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:cloud="http://schema.cloudfoundry.org/spring" xmlns:context="http://www.springframework.org/schema/context" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://schema.cloudfoundry.org/spring http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd">

<!-- To translate any MongoExceptions thrown in @Repository annotated classes -->
<context:annotation-config/>


<mongo:db-factory dbname="${mongo.database}" host="${mongo.host}" id="mongoDbFactory" port="${mongo.port}"/>

<mongo:repositories base-package="fr.afpa"/>


<bean class="org.springframework.data.mongodb.core.MongoTemplate" id="mongoTemplate">
    <constructor-arg ref="mongoDbFactory"/>
</bean>

</beans>

To end, Thank you to all you guys working on the springsource framework and expecially on the ROOoooooooooooooooo!!!!!!!!!!!!!!!!
you are doing a tremendous great job and it's really leverage the burden on our shoulder! furthermore it is so juicy to generate code with Roo!!!

Anyway, I may not stop thanking you!

ROOooooooooooooooooooooooooooooo! (mean thank you !!!!!!!!!!!!!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.