I am doing a simple example and getting below error. Here is my spring.xml:
<beans xmlns="http://www.springframework.org/schema/beans/beans"
xmlns:util="http://www.springframework.org/schema/util/util"
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.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<bean id="t" class="beans.Test">
<property name="fruits">
<util:list list-class="java.util.Vector">
<value>Apple</value>
<value>Mango</value>
<value>Banana</value>
</util:list>
</property>
<property name="cricketors">
<util:set set-class="java.util.TreeSet">
<value>Sachin</value>
<value>Sehwag</value>
<value>Dhoni</value>
</util:set>
</property>
<property name="cc" >
<util:map map-class="java.util.Hashtable">
<entry key="India" value="Delhi"></entry>
<entry key="Pak" value="Islamabad"></entry>
<entry key="USA" value="Wshington DC"></entry>
</util:map>
</property>
</bean>
</beans>
This is the exception I am getting:
Exception in thread "main"
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from class path resource [resources/spring.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 67; cvc-elt.1: Cannot find the declaration of element 'beans'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at Test.Client.main(Client.java:11)
Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 67; cvc-elt.1: Cannot find the declaration of element 'beans'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
... 14 more
The error message you are having is:
Cannot find the declaration of element 'beans'.
The XML namespace for beans element is http://www.springframework.org/schema/beans and not http://www.springframework.org/schema/beans/beans. This is mentioned in the documentation.
You should change your XML configuration to have, at the top:
<beans xmlns="http://www.springframework.org/schema/beans"
Related
Collegues, i have Camel context file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring-2.0.0.xsd">
<bean id="myFilter" class="com.ac.am.CamelComp.CurrentDateFileFilter"/>
<bean id="xsdProcessor" class="com.ac.am.CamelComp.MessProcessor"/>
<bean id="startPolicy" class="org.apache.camel.routepolicy.quartz2.CronScheduledRoutePolicy">
<property name="routeStartTime" value="0 0/5 * ? * 1-6 *" />
</bean>
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="uploadFromFtp" routePolicyRef="startPolicy">
<camel:from uri="sftp://
&throwExceptionOnConnectFailed=true
&consumer.delay=10000
&recursive=true"/>
<camel:to uri="bean:xsdProcessor"/>
<camel:to uri="file:sftp-inbound"/>
</route>
</camel:camelContext>
</beans>
I compiled pogramm using mvn clean compile assembly:single.
When i run jar i receive next stack trace:
[32m13:37:27.923[0;39m [34mINFO [0;39m [32m[main][0;39m
[36mo.s.b.f.xml.XmlBeanDefinitionReader[0;39m : Loading XML bean
definitions from class path resource [camel-context.xml]
[32m13:37:28.331[0;39m [31mWARN [0;39m [32m[main][0;39m
[36mo.s.c.a.AnnotationConfigApplicationContext[0;39m : Exception
encountered during context initialization - cancelling refresh
attempt:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 24 in XML document from class path resource [camel-context.xml]
is invalid; nested exception is org.xml.sax.SAXParseException;
lineNumber: 24; columnNumber: 66; cvc-complex-type.3.2.2: Attribute
'routePolicyRef' is not allowed to appear in element 'route'.
Exception in thread "main"
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 24 in XML document from class path resource [camel-context.xml]
is invalid; nested exception is org.xml.sax.SAXParseException;
lineNumber: 24; columnNumber: 66; cvc-complex-type.3.2.2: Attribute
'routePolicyRef' is not allowed to appear in element 'route'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
....
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.(AnnotationConfigApplicationContext.java:84)
at com.ac.am.AmeFtp.main(AmeFtp.java:32) Caused by: org.xml.sax.SAXParseException; lineNumber: 24; columnNumber: 66;
cvc-complex-type.3.2.2: Attribute 'routePolicyRef' is not allowed to
appear in element 'route'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown
Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
... 16 more
lineNumber 23 is:
<route id="uploadFromFtp" routePolicyRef="startPolicy">
Could you help to fix it? Thank you.
UPDATE
camel was added to route, but nothing canges
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<camel:route id="uploadFromFtp" routePolicyRef="startPolicy">
<camel:from uri="sftp:......
&throwExceptionOnConnectFailed=true
&consumer.delay=10000
&recursive=true"/>
<camel:to uri="bean:xsdProcessor"/>
<camel:to uri="file:sftp-inbound"/>
</camel:route>
</camel:camelContext>
Stack:
Caused by: org.xml.sax.SAXParseException; lineNumber: 24; columnNumber: 72; cvc-complex-type.3.2.2: Attribute 'routePolicyRef' is not allowed to appear in element 'camel:route'.
lineNumber: 24; is <camel:camelContext xmlns="http://camel.apache.org/schema/spring">
Your camel namespace
xmlns:camel="http://camel.apache.org/schema/spring" is mapped to the 2.0.0 version of the schema http://camel.apache.org/schema/spring/camel-spring-2.0.0.xsd (via xsi:schemaLocation), which does not have routePolicyRef attribute defined yet.
It looks like this attribute has only been added in 2.1.0
...
<xs:attribute name="routePolicyRef" type="xs:string"/>
...
hence, the error.
You can probably try to update your xsi:schemaLocation to point a proper version of schema (2.1.0 or later), taking that you are using an appropriate version of the framework itself.
Getting following Error for Spring Yarn Application.
But Every things seems to be well placed like XSD and EVerything
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/hadoop/spring-hadoop.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.util.ErrorHandlerWrapper.warning(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaWarning(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) [xercesImpl-2.9.1.jar:na]
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:510) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at com.xx.poc.Application.main(Application.java:88) [bin/:na]
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hdp:configuration'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:510)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.xx.poc.Application.main(Application.java:88)
Caused by: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hdp:configuration'.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at
Here is my ApplicationContext.xml.
No fire wall issues nothing it works fine if we remove those hdp tags.
Also worked with different options like putting xsd to classpath etx.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:hdp="http://www.springframework.org/schema/hadoop" xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd">
<context:property-placeholder location="classpath:application.properties" />
<hdp:configuration>
fs.defaultFS=${fs.default.name}
mapred.job.tracker=${mapred.job.tracker}
</hdp:configuration>
<hdp:job id="wordCountJobId" input-path="${input.path}"
output-path="${output.path}" jar-by-class="com.xx.yy.Application"
mapper="com.xx.yy.Map" reducer="com.xx.yy.Reduce" />
<hdp:job-runner id="wordCountJobRunner" job-ref="wordCountJobId"
run-at-startup="true" />
</beans>
Looks like you are missing the schema from your classpath - the XSD is in the namespace sub-project and gets bundled into the spring-data-hadoop jar.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-hadoop</artifactId>
<version>2.4.0.RELEASE</version>
</dependency>
works fine for me.
I have a webapp configured with a webfilter that uses ehcache. Everything worked fine until I upgraded to Tomcat 8.0.15. The following error prevents my app to start:
Caused by: org.xml.sax.SAXException: null:7: Element <cache> does not allow attribute "maxBytesLocalDisk".
at net.sf.ehcache.config.BeanHandler.setAttribute(BeanHandler.java:282)
at net.sf.ehcache.config.BeanHandler.startElement(BeanHandler.java:113)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:155)
... 26 more
Here is my ehcache configuration:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="true" monitoring="autodetect" dynamicConfig="true">
<diskStore path="java.io.tmpdir"/>
<cache name="CachingRestFilter"
maxBytesLocalHeap="100M"
maxBytesLocalDisk="1G"
eternal="false"
memoryStoreEvictionPolicy="LFU">
<persistence strategy="localTempSwap"/>
</cache>
</ehcache>
The same app works with Tomcat 7.0.54. Is this an issue with Tomcat?
I'm studying Spring and its Login system. I'm trying to following this example: http://www.beingjavaguys.com/2014/05/spring-security-custom-login-form.html.
When I start tomcat from eclipse, I get immediately this error on the eclipse console:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 4 in XML document from ServletContext resource [/WEB-INF/security-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 85; cvc-elt.1: impossibile trovare la dichiarazione dell'elemento "beans:beans".
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:530)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:444)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:388)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 85; cvc-elt.1: impossibile trovare la dichiarazione dell'elemento "beans:beans".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
... 23 more
ott 08, 2014 11:16:00 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
ott 08, 2014 11:16:00 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/SpringLogin] startup failed due to previous errors
ott 08, 2014 11:16:00 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
ott 08, 2014 11:16:00 AM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:172)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1078)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1052)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1000)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:554)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
The italian sentence impossibile trovare la dichiarazione dell'elemento "beans:beans" means impossible to find the declaration of the object "beans:beans"
this is the file that generates the error
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="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-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
<http auto-config="true">
<intercept-url pattern="/profile**" access="ROLE_ADMIN">
<form-login login-page="/login" username-parameter="username" password-parameter="password" default-target-url="/profile" authentication-failure-url="/login?authfailed">
<logout logout-success-url="/login?logout">
</logout></form-login></intercept-url></http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user" password="user#123" authorities="ROLE_ADMIN">
</user></user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
What it mean?? I'm using spring 3.1.4
Assuming you have copied the tutorials example files, in your security-config.xml file, try replacing these opening and closing elements and namespace declarations:
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ... />
</beans:beans>
With:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" ... />
</beans>
Hope that helps.
I am getting this error when trying to start up my hibernate. I am a hibernate newbie so was hoping someone could point out the mistake I made with my cfg. I included the error, hope it is an easy fix, thanks.
<?xml version='1.0' encoding='utf-8'?>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:#localhost:1521:orcl"</property>
<property name="connection.username">scott</property>
<property name="connection.password">tiger</property>
<property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
</session-factory>
Exception in thread "main" org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2241)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:230)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:71)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2158)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:212)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:71)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2137)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:206)
at HibernateContext.setConfiguration(HibernateContext.java:20)
at HibernateContext.addClass(HibernateContext.java:205)
at HibernateContext.addClasses(HibernateContext.java:216)
at main.main(main.java:8)
Caused by: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 89; Attribute "value" must be declared for element type "property".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2238)
... 11 more
Try using
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
As a newbie, you can read entire hibernate documentation at
http://www.hibernate.org/docs
change : connection.driver_class
to official :
hibernate.connection.driver_class
also read this article