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

(dpr) #1


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...

(David Pilato) #2

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

(dpr) #3

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


<elasticsearch:repositories base-package=""/>

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

could you please suggest.

(dpr) #4

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

<elasticsearch:repositories base-package=""/>

(dpr) #5

"<elasticsearch:repositories base-package=""/>"

(dpr) #6

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=""

(David Pilato) #7

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


Works well...

(David Pilato) #8

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.

(dpr) #9

I am using

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 ?

(David Pilato) #10

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.

(dpr) #11

Thanks, will do it..

(system) #12