spring mvc - autowiring and injecting the properties using deployment by maven -


not able run , showing errors on console giving error when running on jetty cannot autowire autowiring done here

org.springframework.beans.factory.beancreationexception: error creating bean name 'employeecontroller': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private com.dineshonjava.service.employeeservice com.dineshonjava.controller.employeecontroller.employeeservice; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'employeeservice': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private com.dineshonjava.dao.employeedao com.dineshonjava.service.employeeserviceimpl.employeedao; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'employeedao': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autow ire field: private org.hibernate.sessionfactory com.dineshonjava.dao.employeedaoimpl.sessionfactory; nested exception java.lang.noclassdeffounderror: lorg/hibernate/cache/cacheprovider;         @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor.postprocesspropertyvalues(autowiredannotationbeanpostprocessor.java:285)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1074)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:517)         @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:456)         @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:291)         @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:222)         @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:288)         @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:190)         @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:580)         @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:895)         @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:425)         @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:442)         @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:458)         @ org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:339)         @ org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:306)         @ org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:127)         @ javax.servlet.genericservlet.init(genericservlet.java:241)         @ org.mortbay.jetty.servlet.servletholder.initservlet(servletholder.java:440)         @ org.mortbay.jetty.servlet.servletholder.dostart(servletholder.java:263)         @ org.mortbay.component.abstractlifecycle.start(abstractlifecycle.java:50)         @ org.mortbay.jetty.servlet.servlethandler.initialize(servlethandler.java:685)         @ org.mortbay.jetty.servlet.context.startcontext(context.java:140)         @ org.mortbay.jetty.webapp.webappcontext.startcontext(webappcontext.java:1250)         @ org.mortbay.jetty.handler.contexthandler.dostart(contexthandler.java:517)         @ org.mortbay.jetty.webapp.webappcontext.dostart(webappcontext.java:467)         @ org.mortbay.jetty.plugin.jetty6pluginwebappcontext.dostart(jetty6pluginwebappcontext.java:115)         @ org.mortbay.component.abstractlifecycle.start(abstractlifecycle.java:50)         @ org.mortbay.jetty.handler.handlercollection.dostart(handlercollection.java:152)         @ org.mortbay.jetty.handler.contexthandlercollection.dostart(contexthandlercollection.java:156)         @ org.mortbay.component.abstractlifecycle.start(abstractlifecycle.java:50)         @ org.mortbay.jetty.handler.handlercollection.dostart(handlercollection.java:152)         @ org.mortbay.component.abstractlifecycle.start(abstractlifecycle.java:50)         @ org.mortbay.jetty.handler.handlerwrapper.dostart(handlerwrapper.java:130)         @ org.mortbay.jetty.server.dostart(server.java:224)         @ org.mortbay.component.abstractlifecycle.start(abstractlifecycle.java:50)         @ org.mortbay.jetty.plugin.jetty6pluginserver.start(jetty6pluginserver.java:132)         @ org.mortbay.jetty.plugin.abstractjettymojo.startjetty(abstractjettymojo.java:441)         @ org.mortbay.jetty.plugin.abstractjettymojo.execute(abstractjettymojo.java:383)         @ org.mortbay.jetty.plugin.abstractjettyrunmojo.execute(abstractjettyrunmojo.java:210)         @ org.mortbay.jetty.plugin.jetty6runmojo.execute(jetty6runmojo.java:184)         @ org.apache.maven.plugin.defaultbuildpluginmanager.executemojo(defaultbuildpluginmanager.java:101)         @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:209)         @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:153)         @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:145)         @ org.apache.maven.lifecycle.internal.lifecyclemodulebuilder.buildproject(lifecyclemodulebuilder.java:84)         @ org.apache.maven.lifecycle.internal.lifecyclemodulebuilder.buildproject(lifecyclemodulebuilder.java:59)         @ org.apache.maven.lifecycle.internal.lifecyclestarter.singlethreadedbuild(lifecyclestarter.java:183)         @ org.apache.maven.lifecycle.internal.lifecyclestarter.execute(lifecyclestarter.java:161)         @ org.apache.maven.defaultmaven.doexecute(defaultmaven.java:320)         @ org.apache.maven.defaultmaven.execute(defaultmaven.java:156)         @ org.apache.maven.cli.mavencli.execute(mavencli.java:537)         @ org.apache.maven.cli.mavencli.domain(mavencli.java:196)         @ org.apache.maven.cli.mavencli.main(mavencli.java:141)         @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)         @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39)         @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25)         @ java.lang.reflect.method.invoke(method.java:589)         @ org.codehaus.plexus.classworlds.launcher.launcher.launchenhanced(launcher.java:290)         @ org.codehaus.plexus.classworlds.launcher.launcher.launch(launcher.java:230)         @ org.codehaus.plexus.classworlds.launcher.launcher.mainwithexitcode(launcher.java:409)         @ org.codehaus.plexus.classworlds.launcher.launcher.main(launcher.java:352) 2014-06-27 11:09:03.961:info::opened c:\my-app1\target\2014_06_27.request.log 2014-06-27 11:09:04.008:info::started selectchannelconnector@0.0.0.0:8080 [info] started jetty server 2014-06-27 11:12:51.009:info::shutdown hook executing 2014-06-27 11:12:51.009:info::stopped selectchannelconnector@0.0.0.0:8080 2014-06-27 11:12:51.618:info::shutdown hook complete[info] jetty server exiting. [info] ------------------------------------------------------------------------ [info] build success 

here code controller , here code controller here ee have done autowiring needed

**

 , here code controller     here ee have done autowiring needed      **        package com.dineshonjava.controller;      import java.util.arraylist;     import java.util.hashmap;     import java.util.list;     import java.util.map;      import javax.annotation.resource;      import org.springframework.beans.factory.annotation.autowired;     import org.springframework.beans.factory.annotation.qualifier;     import org.springframework.stereotype.controller;     import org.springframework.validation.bindingresult;     import org.springframework.web.bind.annotation.modelattribute;     import org.springframework.web.bind.annotation.requestmapping;     import org.springframework.web.bind.annotation.requestmethod;     import org.springframework.web.servlet.modelandview;      import com.dineshonjava.bean.employeebean;     import com.dineshonjava.model.employee;     import com.dineshonjava.service.employeeservice;       @controller     @requestmapping("myproject")     public class employeecontroller {          @autowired         private employeeservice employeeservice;      /*  @resource         @qualifier("employeeservice")         private employeeservice employeeservice;*/          @requestmapping(value = "/save", method = requestmethod.post)         public modelandview saveemployee(@modelattribute("command") employeebean employeebean,                  bindingresult result) {             employee employee = preparemodel(employeebean);             employeeservice.addemployee(employee);             return new modelandview("redirect:/add.html");         }          @requestmapping(value="/employees", method = requestmethod.get)         public modelandview listemployees() {             map<string, object> model = new hashmap<string, object>();             model.put("employees",  preparelistofbean(employeeservice.listemployeess()));             return new modelandview("employeeslist", model);         }          @requestmapping(value = "/add", method = requestmethod.get)         public modelandview addemployee(@modelattribute("command")  employeebean employeebean,                 bindingresult result) {             map<string, object> model = new hashmap<string, object>();             model.put("employees",  preparelistofbean(employeeservice.listemployeess()));             return new modelandview("addemployee", model);         }          @requestmapping(value = "/index", method = requestmethod.get)         public modelandview welcome() {             return new modelandview("index");         }          @requestmapping(value = "/delete", method = requestmethod.get)         public modelandview editemployee(@modelattribute("command")  employeebean employeebean,                 bindingresult result) {             employeeservice.deleteemployee(preparemodel(employeebean));             map<string, object> model = new hashmap<string, object>();             model.put("employee", null);             model.put("employees",  preparelistofbean(employeeservice.listemployeess()));             return new modelandview("addemployee", model);         }          @requestmapping(value = "/edit", method = requestmethod.get)         public modelandview deleteemployee(@modelattribute("command")  employeebean employeebean,                 bindingresult result) {             map<string, object> model = new hashmap<string, object>();             model.put("employee", prepareemployeebean(employeeservice.getemployee(employeebean.getid())));             model.put("employees",  preparelistofbean(employeeservice.listemployeess()));             return new modelandview("addemployee", model);         }          private employee preparemodel(employeebean employeebean){             employee employee = new employee();         //  employee.setempaddress(employeebean.getaddress());             employee.setempage(employeebean.getage());         //  employee.setempname(employeebean.getname());             employee.setsalary(employeebean.getsalary());             employee.setempid(employeebean.getid());             employeebean.setid(null);             return employee;         }          private list<employeebean> preparelistofbean(list<employee> employees){             list<employeebean> beans = null;             if(employees != null && !employees.isempty()){                 beans = new arraylist<employeebean>();                 employeebean bean = null;                 for(employee employee : employees){                     bean = new employeebean();                 //  bean.setname(employee.getempname());                     bean.setid(employee.getempid());                 //  bean.setaddress(employee.getempaddress());                     bean.setsalary(employee.getsalary());                     bean.setage(employee.getempage());                     beans.add(bean);                 }             }             return beans;         }          private employeebean prepareemployeebean(employee employee){             employeebean bean = new employeebean();         //bean.setaddress(employee.getempaddress());             bean.setage(employee.getempage());         //  bean.setname(employee.getempname());             bean.setsalary(employee.getsalary());             bean.setid(employee.getempid());             return bean;         }     }    here code of employeeservice class       package com.dineshonjava.service;  import java.util.list;  import org.springframework.beans.factory.annotation.autowired; import org.springframework.stereotype.service; import org.springframework.transaction.annotation.propagation; import org.springframework.transaction.annotation.transactional;  import com.dineshonjava.dao.employeedao; import com.dineshonjava.model.employee;  @service("employeeservice") @transactional(propagation = propagation.supports, readonly = true) public class employeeserviceimpl implements employeeservice {      @autowired     private employeedao employeedao;      @transactional(propagation = propagation.required, readonly = false)     public void addemployee(employee employee) {         employeedao.addemployee(employee);     }      public list<employee> listemployeess() {         return employeedao.listemployeess();     }      public employee getemployee(int empid) {         return employeedao.getemployee(empid);     }      public void deleteemployee(employee employee) {         employeedao.deleteemployee(employee);     }  } 

pom file

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">     <modelversion>4.0.0</modelversion>     <groupid>com.mycompany.app</groupid>     <artifactid>my-app1</artifactid>     <packaging>jar</packaging>     <version>1.0-snapshot</version>     <name>my-app1</name>     <url>http://maven.apache.org</url>     <build>         <plugins>             <plugin>                 <groupid>org.apache.tomcat.maven</groupid>                 <artifactid>tomcat7-maven-plugin</artifactid>                 <version>2.0-snapshot</version>             </plugin>              <plugin>                 <groupid>org.apache.tomcat.maven</groupid>                 <artifactid>tomcat7-maven-plugin</artifactid>                 <configuration>                     <port>8080</port>                     <path>/</path>                 </configuration>                 <dependencies>                     <dependency>                         <groupid>org.apache.tomcat.embed</groupid>                         <artifactid>tomcat-embed-core</artifactid>                         <version>7.0.29</version>                     </dependency>                 </dependencies>             </plugin>              <plugin>                 <groupid>org.apache.maven.plugins</groupid>                 <artifactid>maven-compiler-plugin</artifactid>                 <version>2.0</version>                 <configuration>                     <!--<executable>c:/program files/java/jdk1.6.0/bin/javac</executable> -->                     <!--<source>1.6</source> -->                     <!--<target>1.6</target> -->                     <executable>c:\program files\java\jdk1.6.0\bin/javac</executable>                     <source>1.6</source>                     <target>1.6</target>                 </configuration>             </plugin>                 <plugin>                 <groupid>org.mortbay.jetty</groupid>                 <artifactid>maven-jetty-plugin</artifactid>                 <version>6.1.24</version>                 <configuration>                     <stopport>9966</stopport>                     <stopkey>my-app1</stopkey>                     <!-- redeploy every x seconds if changes detected, 0 no automatic                          redeployment -->                     <scanintervalseconds>0</scanintervalseconds>                     <!-- make sure jetty finds widgetset -->                     <webappconfig>                         <contextpath>/my-app1</contextpath>                         <baseresource implementation="org.mortbay.resource.resourcecollection">                             <!-- workaround maven/jetty issue http://jira.codehaus.org/browse/jetty-680 -->                             <!-- <resources>src/main/webapp,${project.build.directory}/${project.build.finalname}</resources> -->                             <resourcesascsv>src/main/webapp,${project.build.directory}/classes</resourcesascsv>                         </baseresource>                     </webappconfig>                     <systemproperties>                         <systemproperty>                             <name>logback.configurationfile</name>                             <value>file:src/main/resources/logback-jetty.xml</value>                         </systemproperty>                     </systemproperties>                     <requestlog implementation="org.mortbay.jetty.ncsarequestlog">                         <filename>${project.build.directory}/yyyy_mm_dd.request.log</filename>                         <retaindays>90</retaindays>                         <append>true</append>                         <extended>false</extended>                     </requestlog>                 </configuration>             </plugin>          </plugins>     </build>      <dependencies>         <dependency>             <groupid>junit</groupid>             <artifactid>junit</artifactid>             <version>3.8.1</version>             <scope>test</scope>         </dependency>         <dependency>             <groupid>org.eclipse.jetty</groupid>             <artifactid>jetty-server</artifactid>             <version>9.2.0.m1</version>         </dependency>         <dependency>             <groupid>org.apache.geronimo.specs</groupid>             <artifactid>geronimo-activation_1.0.2_spec</artifactid>             <version>1.2</version>         </dependency>          <dependency>             <groupid>org.apache.geronimo.specs</groupid>             <artifactid>geronimo-stax-api_1.0_spec</artifactid>             <version>1.0.1</version>         </dependency>         <dependency>             <groupid>org.apache.servicemix.bundles</groupid>             <artifactid>org.apache.servicemix.bundles.xalan</artifactid>             <version>2.7.1_3</version>         </dependency>         <dependency>             <groupid>org.apache.servicemix.bundles</groupid>             <artifactid>org.apache.servicemix.bundles.xerces</artifactid>             <version>2.9.1_4</version>         </dependency>          <dependency>             <groupid>javax.xml.bind</groupid>             <artifactid>jaxb-api</artifactid>             <version>2.1</version>         </dependency>          <dependency>             <groupid>xom</groupid>             <artifactid>xom</artifactid>             <version>1.2.5</version>         </dependency>          <dependency>             <groupid>xerces</groupid>             <artifactid>xmlparserapis</artifactid>             <version>2.6.2</version>         </dependency>           <dependency>             <groupid>org.antlr</groupid>             <artifactid>stringtemplate</artifactid>             <version>3.2.1</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-context</artifactid>             <version>3.0.6.release</version>         </dependency>           <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-api</artifactid>             <version>1.7.2</version>         </dependency>         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>jul-to-slf4j</artifactid>             <version>1.7.2</version>         </dependency>         <dependency>             <groupid>log4j</groupid>             <artifactid>log4j</artifactid>             <version>1.2.17</version>         </dependency>           <dependency>             <groupid>aopalliance</groupid>             <artifactid>aopalliance</artifactid>             <version>1.0</version>         </dependency>          <dependency>             <groupid>asm</groupid>             <artifactid>asm</artifactid>             <version>1.5.3</version>         </dependency>          <dependency>             <groupid>asm</groupid>             <artifactid>asm-all</artifactid>             <version>3.2</version>         </dependency>          <dependency>             <groupid>cglib</groupid>             <artifactid>cglib-full</artifactid>             <version>2.0.2</version>         </dependency>          <dependency>             <groupid>commons-beanutils</groupid>             <artifactid>commons-beanutils</artifactid>             <version>1.6.1</version>         </dependency>           <dependency>             <groupid>org.apache.commons</groupid>             <artifactid>commons-lang3</artifactid>             <version>3.3</version>         </dependency>          <dependency>             <groupid>commons-io</groupid>             <artifactid>commons-io</artifactid>             <version>2.1</version>         </dependency>          <dependency>             <groupid>commons-fileupload</groupid>             <artifactid>commons-fileupload</artifactid>             <version>1.2.2</version>         </dependency>          <dependency>             <groupid>commons-logging</groupid>             <artifactid>commons-logging</artifactid>             <version>1.1.1</version>         </dependency>           <dependency>             <groupid>dom4j</groupid>             <artifactid>dom4j</artifactid>             <version>1.6.1</version>         </dependency>          <dependency>             <groupid>org.glassfish</groupid>             <artifactid>javax.resource</artifactid>             <version>3.1.1</version>         </dependency>          <dependency>             <groupid>net.sf.ehcache</groupid>             <artifactid>ehcache-core</artifactid>             <version>2.6.8</version>         </dependency>         <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-annotations</artifactid>             <version>3.4.0.ga</version>         </dependency>          <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-entitymanager</artifactid>             <version>3.4.0.ga</version>         </dependency>          <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-validator</artifactid>             <version>4.2.0.final</version>         </dependency>            <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-core</artifactid>             <version>4.3.1.final</version>         </dependency>           <dependency>             <groupid>com.ibm.icu</groupid>             <artifactid>icu4j</artifactid>             <version>4.8</version>         </dependency>          <dependency>             <groupid>org.javassist</groupid>             <artifactid>javassist</artifactid>             <version>3.18.1-ga</version>         </dependency>           <dependency>             <groupid>javax.xml.bind</groupid>             <artifactid>jaxb-api</artifactid>             <version>2.2.1</version>         </dependency>          <dependency>             <groupid>org.jdom</groupid>             <artifactid>jdom</artifactid>             <version>1.1.3</version>         </dependency>          <dependency>             <groupid>javax.servlet</groupid>             <artifactid>jstl</artifactid>             <version>1.2</version>         </dependency>          <dependency>             <groupid>org.apache.geronimo.specs</groupid>             <artifactid>geronimo-jta_1.1_spec</artifactid>             <version>1.1.1</version>         </dependency>          <dependency>             <groupid>org.apache.logging.log4j</groupid>             <artifactid>log4j-core</artifactid>             <version>2.0-beta9</version>         </dependency>          <dependency>             <groupid>org.apache.lucene</groupid>             <artifactid>lucene-core</artifactid>             <version>3.5.0</version>         </dependency>          <dependency>             <groupid>javax.mail</groupid>             <artifactid>mail</artifactid>             <version>1.4.1</version>         </dependency>          <dependency>             <groupid>com.github.ferstl</groupid>             <artifactid>spring-jdbc-oracle-ojdbc</artifactid>             <version>1.0.0</version>         </dependency>           <dependency>             <groupid>javax.servlet</groupid>             <artifactid>servlet-api</artifactid>             <version>2.5</version>         </dependency>           <dependency>             <groupid>org.apache.commons</groupid>             <artifactid>commons-collections4</artifactid>             <version>4.0</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-aop</artifactid>             <version>4.0.2.release</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-core</artifactid>             <version>3.0.5.release</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-expression</artifactid>             <version>3.0.5.release</version>         </dependency>           <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-asm</artifactid>             <version>3.0.5.release</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-beans</artifactid>             <version>3.0.5.release</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-webmvc</artifactid>             <version>3.0.5.release</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-tx</artifactid>             <version>3.0.5.release</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-orm</artifactid>             <version>3.0.5.release</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-web</artifactid>             <version>3.0.5.release</version>         </dependency>             <dependency>             <groupid>javax.validation</groupid>             <artifactid>validation-api</artifactid>             <version>1.0.0.ga</version>         </dependency>          <dependency>             <groupid>org.apache.xmlbeans</groupid>             <artifactid>xmlbeans</artifactid>             <version>2.3.0</version>         </dependency>          <dependency>             <groupid>org.apache.geronimo.specs</groupid>             <artifactid>geronimo-annotation_1.0_spec</artifactid>             <version>1.1.1</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-jdbc</artifactid>             <version>3.0.5.release</version>         </dependency>      </dependencies>  </project> 

i don't think there's wrong controller per se. wants employeeservice injected wants else injected, et cetera, until hibernate's sessionfactory cannot find cacheprovider. have incomplete hibernate on classpath. however, cacheprovider should available in hibernate , hibernate core packages. go, maven!


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -