• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

applicationContext.xml - Can not find definition for element 'beans'

 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I'm trying to integrate spring security into my app and get the following error in the applicationContext.xml

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: <Line 5, Column 263>: XML-24538: (Error) Can not find definition for element 'beans'

The file:applicationContext.xml contains:-



Has anybody got any clues.

Mat
 
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Can you provide the complete application context file?
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have some time ago face problem like that I have used spring 3 all jar file for web, context etc then it solved.
 
Mat Anthony
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
thanks for your response.
I have cahnged the applicationContext_security.xml file to now contain the following:-



I now get the following error:-
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/applicationContext_security.xml] is invalid; nested exception is oracle.xml.parser.schema.XSDException: Connection timed out: connect
Caused by: oracle.xml.parser.schema.XSDException: Connection timed out: connect

Here are some of the jar files that i use:-
org.springframework.aop-3.0.5.RELEASE.jar
org.springframework.asm-3.0.5.RELEASE.jar
org.springframework.beans-3.0.5.RELEASE.jar
org.springframework.context-3.0.5.RELEASE.jar
org.springframework.context.support-3.0.5.RELEASE.jar
org.springframework.core-3.0.5.RELEASE.jar
org.springframework.expression-3.0.5.RELEASE.jar
org.springframework.orm-3.0.5.RELEASE.jar
org.springframework.transaction-3.0.5.RELEASE.jar
org.springframework.web-3.0.5.RELEASE.jar

spring-hibernate3_2.0.1.jar
spring-jdbc2.5.6.jar
spring-security-config-3_1.0.M2.jar
spring-security-core-3_1.0.M2.jar
spring-security-taglibs-3_1.0.M2.jar
spring-security-web-3_1.0.M2.jar
spring.jar

xmlcomp.jar
xmlparserv2.jar

el-api-2.2.jar
el-impl-2.2.jar

Not sure whats causing this oracle.xml.parser.schema.XSDException: Connection timed out: connect

Mat











 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy, Mat.

Champ, try this: use the file of your first post, create a file named spring.schemas and place it in the META-INF directory of your WAR file. This file should have the following content:



Please try that and let us know if it works.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on migration project from websphere to jboss 6.3 eap. When i deploy my application on jboss, i am getting Parser exception as below:


18:41:51,567 ERROR [com.silvermoongroup.was.startup.ejb.EagerClassLoaderBean]
(ServerService Thread Pool -- 77) Error when initialising class: Unable to return
specified BeanFactory instance:
factory key [com.silvermoongroup.common], from group with resource name
[classpath:com/churchmutual/ocns/common/beanRefContext.xml];
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'com.silvermoongroup.common' defined in class path resource
[com/churchmutual/ocns/common/beanRefContext.xml]: Instantiation of bean failed;
nested exception is org.springframework.beans.BeanInstantiationException: Could
not instantiate bean class
[org.springframework.context.support.ClassPathXmlApplicationContext]:
Constructor threw exception; nested exception is
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 37
in XML document from class path resource [com/silvermoongroup/base/tx/jee-
transaction-context.xml] is invalid; nested exception is
org.xml.sax.SAXParseException; lineNumber: 37; columnNumber: 82; cvc-elt.1:
Cannot find the declaration of element 'beans'.:
org.springframework.beans.factory.access.BootstrapException: Unable to return
specified BeanFactory instance: factory key [com.silvermoongroup.common], from
group with resource name
[classpath:com/churchmutual/ocns/common/beanRefContext.xml]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'com.silvermoongroup.common' defined in class path resource
[com/churchmutual/ocns/common/beanRefContext.xml]: Instantiation of bean failed;
nested exception is org.springframework.beans.BeanInstantiationException: Could
not instantiate bean class
[org.springframework.context.support.ClassPathXmlApplicationContext]:
Constructor threw exception; nested exception is
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 37
in XML document from class path resource [com/silvermoongroup/base/tx/jee-
transaction-context.xml] is invalid; nested exception is
org.xml.sax.SAXParseException; lineNumber: 37; columnNumber: 82; cvc-elt.1:
Cannot find the declaration of element 'beans'.


So i changed beans xmlns to DTD like this:


<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-2.5.xsd">


to


<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">


and it worked fine, there is no parsing exception as such.
But in one xml having transaction configuration like this:


<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">


when i changed it to above mentioned DTD, it throwing exception.
org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 15; Document root element "tx:transaction", must match DOCTYPE root "beans".

Please help me to resolve this issue.
reply
    Bookmark Topic Watch Topic
  • New Topic