java - Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException -
i new spring , please can resolve exception.
exception :
exception in thread "main" org.springframework.beans.factory.beancreationexception: error creating bean name 'entitydao' defined in class path resource [springapp-servlet.xml]: cannot resolve reference bean 'configdetails' while setting bean property 'configdetails'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'configdetails' defined in class path resource [springapp-servlet.xml]: bean instantiation via constructor failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [com.taphius.databridge.deserializer.datasourcerconfigdetails]: constructor threw exception; nested exception java.lang.noclassdeffounderror: com/google/gson/gsonbuilder
this main class
public class mainapp { final static logger logger = logger.getlogger(mainapp.class); public static string flume_conf_dir = ""; public static void main(string[] args) { new classpathxmlapplicationcontext("springapp-servlet.xml"); logger.info("application context loaded successfully."); } }
springapp-servlet.xml
<?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:task="http://www.springframework.org/schema/task" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd"> <!-- application context definition springapp dispatcherservlet --> <task:annotation-driven /> <bean id="entitydao" class="com.taphius.databridge.dao.entitydefinationdao"> <property name="configdetails" ref="configdetails" /> </bean> <bean id="configdetails" class="com.taphius.databridge.deserializer.datasourcerconfigdetails"> <constructor-arg> <value type="java.lang.class">com.taphius.databridge.model.datasourcerattributes </value> </constructor-arg> </bean> <bean id="datachecker" class="com.taphius.datachecker.filechecker" init-method="init"> <property name="entitydao" ref="entitydao" /> </bean> <bean id="notifychecker" class="com.taphius.pipeline.notification.pipelinenotifywatcher" init-method="init"> <property name="datachecker" ref="datachecker" /> </bean> <bean id="scheduledjob" class="com.taphius.databridge.scheduler.scheduleddbpoller"> <property name="task" ref="task" /> </bean> <bean id="task" class="com.taphius.databridge.scheduler.customtask"> <property name="entity" ref="entitydao" /> <property name="datachecker" ref="datachecker" /> </bean> <bean name="runmejob" class="org.springframework.scheduling.quartz.jobdetailfactorybean"> <property name="jobclass" value="com.taphius.databridge.scheduler.scheduleddbpoller" /> <property name="jobdataasmap"> <map> <entry key="task" value-ref="task" /> </map> </property> <property name="durability" value="true"></property> </bean> <!-- cron trigger, run every 5 minutes --> <bean id="crontrigger" class="org.springframework.scheduling.quartz.crontriggerfactorybean"> <property name="jobdetail" ref="runmejob" /> <property name="cronexpression" value="0 0/2 * * * ?" /> </bean> <bean class="org.springframework.scheduling.quartz.schedulerfactorybean"> <property name="jobdetails"> <list> <ref bean="runmejob" /> </list> </property> <property name="triggers"> <list> <ref bean="crontrigger" /> </list> </property> </bean> </beans>
you misss jar containing class com/google/gson/gsonbuilder
in classpath. add following dependency pom.xml:
<dependency> <groupid>com.google.code.gson</groupid> <artifactid>gson</artifactid> <version>2.8.1</version> </dependency>
Comments
Post a Comment