spring - java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlBeanDefinitionReader.setEnvironment -
i getting below error though code simple:
2016-02-39 15:25:10 debug standardenvironment:112 - initializing new standardenvironment 2016-02-39 15:25:10 debug standardenvironment:107 - adding [systemproperties] propertysource lowest search precedence 2016-02-39 15:25:10 debug standardenvironment:107 - adding [systemenvironment] propertysource lowest search precedence 2016-02-39 15:25:10 debug standardenvironment:116 - initialized standardenvironment propertysources [systemproperties,systemenvironment] 2016-02-39 15:25:10 info classpathxmlapplicationcontext:503 - refreshing org.springframework.context.support.classpathxmlapplicationcontext@1ee0005: startup date [mon feb 08 15:25:10 ist 2016]; root of context hierarchy exception in thread "main" java.lang.nosuchmethoderror: org.springframework.beans.factory.xml.xmlbeandefinitionreader.setenvironment(lorg/springframework/core/env/environment;)v @ org.springframework.context.support.abstractxmlapplicationcontext.loadbeandefinitions(abstractxmlapplicationcontext.java:86) @ org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:131) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:530) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:444) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:139) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:83) @ com.deloitte.batch.client.persondaoclient.main(persondaoclient.java:28)
code:
package com.anirban.batch.client; import java.util.arraylist; import java.util.list; import org.apache.log4j.logger; import org.springframework.context.applicationcontext; import org.springframework.context.support.classpathxmlapplicationcontext; import com.anirban.batch.dao.persondao; import com.anirban.batch.domain.person; public class persondaoclient { static logger log = logger.getlogger(persondaoclient.class.getname()); public static void main(string[] args) { long personid=2; applicationcontext ctx = new classpathxmlapplicationcontext("applicationcontext.xml"); persondao persondao = (persondao) ctx.getbean(persondao.class); person person = persondao.getpersonbyid(personid); system.out.println(person); system.out.println(); list<person> personlist = (list<person>) persondao.getpersonlist(); for(person p : personlist){ system.out.print(p.getpersonid()+" "); system.out.print(p.getfirstname()+" "); system.out.println(p.getlastname()); } personlist = new arraylist<person>(); personlist.add(new person("abc", "def")); personlist.add(new person("ijk", "lmn")); personlist.add(new person("opq", "rst")); persondao.save(personlist); } }
dependencies below:
<properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <spring.version>3.1.3.release</spring.version> <spring-batch.version>2.1.9.release</spring-batch.version> </properties> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-oxm</artifactid> <version>3.0.5.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-tx</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-aspects</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjweaver</artifactid> <version>1.6.1</version> </dependency> <dependency> <groupid>commons-dbcp</groupid> <artifactid>commons-dbcp</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-orm</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework.batch</groupid> <artifactid>spring-batch-core</artifactid> <version>${spring-batch.version}</version> </dependency> <dependency> <groupid>org.springframework.batch</groupid> <artifactid>spring-batch-infrastructure</artifactid> <version>${spring-batch.version}</version> </dependency> <dependency> <groupid>org.codehaus.castor</groupid> <artifactid>castor-xml</artifactid> <version>1.3.2</version> </dependency> <!-- hibernate dependencies --> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>4.1.8.final</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>4.1.8.final</version> </dependency> <dependency> <groupid>com.oracle</groupid> <artifactid>ojdbc6</artifactid> <version>11.2.0</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.5.10</version> </dependency> </dependencies>
as working spring batch there batch dependencies. can please help. missing basic cant find out.
import bellow package
import org.springframework.beans.factory.beanfactory; import org.springframework.beans.factory.xml.xmlbeanfactory;
Mr Benjamin went above and beyond their requirements to assist me with my loan which i used expand my pharmacy business,They were friendly, professional, and absolute gems to work with.I will recommend anyone looking for loan to contact. 247officedept@gmail.com.WhatsApp ... + 19893943740.
ReplyDelete