• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
  • Carey Brown
  • salvin francis
  • Claude Moore

Cannot find the declaration of element 'beans'  RSS feed

Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I am new to Spring and I am having a problem getting my standalone application to run outside of the Spring Source environment. When I export the program I receive the following error when I try to run it. I can't understand why it runs great within Spring and gets errors when it is move outside that environment. Thanks for any assistance you can provide.

Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefiniti
onStoreException: Line 9 in XML document from class path resource [org/interface
Transfer/fgc-common-dao-context.xml] is invalid; nested exception is org.xml.sax
.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.

This is my common-dao-contex.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"

<context:component-scan base-package="org/interfaceTransfer"/>

<context:property-placeholder location="file:src/fgc-common.properties" ignore-unresolvable="true"/>

Posts: 13447
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing I would check is path and/or classpath. When you run the app in the Spring Source (I assume you mean STS) environment, the platform takes care of these settings for you. When you run outside of the STS, you have to take care of it yourself somehow.
Tim Bryant
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured this out, it had to do with using Spring to create a runnable JAR file. When creating the JAR file with Spring it allows you to select one of three options under Library handling:
- Extract required libraries into generated JAR
- Package required libraries into generated JAR
- Copy required libraries into a sub-folder next to the generated JAR
When I used option 1 & 2 this would cause the error to occur. When I used option 3 the application worked correctly without any errors.
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also getting the same error
Here is my xml file

Here is the error

Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!