Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/c

Hi,

I am trying to load an XML file consisting of elasticsearch properties. In the jave spring web application, I am trying to load the xml file using the below line -
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

applicationContext.xml is located under src/main/reosurces.

Below errors I am getting when I run the application from UI.

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment;
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment;

Can anyone please suggest on this.

Thanks in advance...

Wrong mailing list I guess. Not related to elasticsearch here.

Yes this is related to spring framework, but I get the error in my XML also when I add the following line -

xmlns:elasticsearch="http://www.springframework.org/schema/data/elasticsearch"

<elasticsearch:repositories base-package="com.xx.daos.elasticsearch.report"/>

Error occured processing XML 'org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/
core/env/Environment;'.

could you please suggest.

One more line is missing in my previous message. This is the line where we get error.

<elasticsearch:repositories base-package="com.pn.daos.elasticsearch.report"/>

"<elasticsearch:repositories base-package="com.pn.daos.elasticsearch.report"/>"

Sorry, I was trying to send one line containing <> brackets, it is not posted. Therefore, I had to post so many times. I removed the brackets and posting it.
elasticsearch:repositories base-package="com.pn.daos.elasticsearch.report"

It's because you are not formatting your code before posting.

<test></test>

Works well...

Here probably your applicationContext.xml is wrong or you are missing some libs or you are using an incompatible version of Spring...

Well. Hard to know without details.

I am using
spring-data-elasticsearch-1.3.2.RELEASE.jar
spring-data-commons-1.11.2.RELEASE.jar

And all other spring jars like spring-beans, spring-context, spring-core, ...etc of 4.0.2 version.
Are these versions compatible with spring-data-elasticsearch ?

I don't know.

I'd try to locate where class org.springframework.beans.factory.xml.XmlReaderContext lives and if the method getEnvironment() method exists in this jar.

But I think you'd better ask this in Spring forums.

Thanks, will do it..