Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Error: no declaration can be found for element 'prop'. At servlet-context.xml

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello community. I'm a newbie Spring user developing my first Spring MVC application.

The following code, located at servlet-context.xml:


Gives me this error:


The matching wildcard is strict, but no declaration can be found for element 'props'



The same error occurred with <bean> element, but it was fixed including 'beans' prefix <beans:bean ..>

My two questions are: How can I fix the 'props' element error? and How can I avoid using 'beans' prefix in every <bean> xml declaration?

Just to mention that I already has the 'bean' xmlns and schema-location declarations, like this:


And if I write the schema location like this, instead of previous delcaration:


In booth cases if I don't put the 'beans' prefix, like this


I have the same error:


The matching wildcard is strict, but no declaration can be found for element 'bean'.
Cannot locate BeanDefinitionParser for element [bean]





Very thankful for your help
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) xmlns:beans="http://www.springframework.org/schema/beans";

That is where you yourself set the "prefix" to "beans"

if it was

xmlns="http://www.springframework.org/schema/beans";

Then you won't need the prefix.

<props> is also part of the beans namespace, so it would need <beans:props> too if you keep the prefix.

Mark
 
Ramon Bonet
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark, understood. All depends if there is a prefix defined at namespaces delcaration or not, you have to include the prefix in all declarations below or not.

But the fact is I already have one 'xmlns' declaration without prefix included among others. Take a look:


I'm not able to write more than one xmlns values without prefix, only once. The rest have to include a ':'prefix.

Is there any way to write multiple xmlsn-non-prefix values?


Pd: note I write the initial bean declaration of servlet-context.xml with the 'beans' prefix, because this is how bean namespace is defined right now

Thanks
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you can only have one. Which I now see you have for the <mvc> namespace. So which do you use more in that file? tags from the mvc namespace, or tags from the beans namespace. Whichever you use more, that should be the no prefix one you want to use.

Mark
 
Ramon Bonet
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, so I guess I'll use no-prefix for <mv> name space. Thank you very much!
 
Are we home yet? Wait, did we forget the tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic