ERROR Trying to connect to MySQL in STS using Spring Framework and Hibernate -


[console output][1] [1]: http://i.stack.imgur.com/d79nj.png error trying connect database. ideas why?
did research, went through code several times , still can't understand why not connect.

web.xml   <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"           xmlns="http://xmlns.jcp.org/xml/ns/javaee"           xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">   <display-name>estore</display-name>       <listener>         <listener-class>org.springframework.web.context.contextloaderlistener</listener-class>     </listener>     <context-param>         <param-name>contextconfiglocation</param-name>         <param-value>/web-inf/spring/*</param-value>     </context-param>      <servlet>         <servlet-name>dispatcher</servlet-name>         <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>       <servlet-mapping>         <servlet-name>dispatcher</servlet-name>         <url-pattern>/</url-pattern>     </servlet-mapping>  </web-app>  dispatcher-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:context="http://www.springframework.org/schema/context"     xmlns:jdbc="http://www.springframework.org/schema/jdbc"     xmlns:jee="http://www.springframework.org/schema/jee"     xmlns:mvc="http://www.springframework.org/schema/mvc"     xmlns:tx="http://www.springframework.org/schema/tx"     xsi:schemalocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.2.xsd         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">       <context:component-scan base-package="com.estore"/>      <mvc:annotation-driven/>      <bean id="viewresolver" class="org.springframework.web.servlet.view.internalresourceviewresolver">         <property name="prefix" value="/web-inf/views/"/>         <property name="suffix" value=".jsp"/>     </bean>      <mvc:resources location="/web-inf/resources/" mapping="/resources/**"/>      <tx:annotation-driven />  </beans>  applicationcontext.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:context="http://www.springframework.org/schema/context"     xmlns:jdbc="http://www.springframework.org/schema/jdbc"     xmlns:jee="http://www.springframework.org/schema/jee"     xmlns:mvc="http://www.springframework.org/schema/mvc"     xmlns:tx="http://www.springframework.org/schema/tx"     xsi:schemalocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.2.xsd         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">       <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource">         <property name="driverclassname" value="com.mysql.jdbc.driver" />         <property name="url" value="jdbc:mysql://localhost:3306/storedb" />         <property name="username" value="storeadm" />         <property name="password" value="storeadm123" />     </bean>      <bean id="sessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean">         <property name="datasource" ref="datasource"></property>         <property name="hibernateproperties">             <props>                 <prop key="hibernate.dialect">org.hibernate.dialect.mysql5dialect</prop>                 <prop key="hibernate.hbm2ddl.auto">update</prop>                 <prop key="hibernate.show_sql">true</prop>                 <prop key="hibernate.format_sql">true</prop>             </props>         </property>          <property name="packagestoscan">             <list>                 <value>com.estore</value>             </list>         </property>      </bean>      <bean id="transactionmanager" class="org.springframework.orm.hibernate4.hibernatetransactionmanager">         <property name="sessionfactory" ref="sessionfactory"></property>     </bean>  </beans>  homecontroller.java          package com.estore.controllers;      import java.io.ioexception;     import java.util.list;      import org.springframework.beans.factory.annotation.autowired;     import org.springframework.stereotype.controller;     import org.springframework.ui.model;     import org.springframework.web.bind.annotation.pathvariable;     import org.springframework.web.bind.annotation.requestmapping;      import com.estore.dao.productdao;     import com.estore.model.product;       @controller     public class homecontroller {          @autowired         private productdao productdao;          @requestmapping("/")         public string home() {             return "home";         }          @requestmapping("/productlist")         public string getproducts(model model) {             list<product> products = productdao.getallproducts();             model.addattribute("products", products);              return "productlist";         }          @requestmapping("/productlist/viewproduct/{productid}") //{} - path variable         public string viewproduct(@pathvariable string productid, model model) throws ioexception { // having @pathvariable grab variable "value" path                                                                                                     //then give "value" "productid" string             product product = productdao.getproductbyid(productid);             model.addattribute(product);              return "viewproduct";         }     }  productdao.java      package com.estore.dao;  import java.util.list;  import com.estore.model.product;  public interface productdao {      void addproduct(product product);      product getproductbyid(string id);      list<product> getallproducts();      void deleteproduct(string id);  }  productdaoimpl      package com.estore.dao.impl;  import java.util.list;  import org.hibernate.query; import org.hibernate.session; import org.hibernate.sessionfactory; import org.springframework.beans.factory.annotation.autowired; import org.springframework.stereotype.repository; import org.springframework.transaction.annotation.transactional;  import com.estore.dao.productdao; import com.estore.model.product;   @repository @transactional public class productdaoimpl implements productdao {      @autowired     private sessionfactory sessionfactory;      public void addproduct(product product) {         session session =  sessionfactory.getcurrentsession();         session.saveorupdate(product);         session.flush();     }      public product getproductbyid(string id) {         session session = sessionfactory.getcurrentsession();          product product = (product)session.get(product.class, id);         session.flush();          return product;     }      public list<product> getallproducts(){         session session = sessionfactory.getcurrentsession();         query query = session.createquery("from product");         list<product> products = query.list();          session.flush();          return products;     }        public void deleteproduct(string id) {         session session = sessionfactory.getcurrentsession();         session.delete(getproductbyid(id));          session.flush();     } } 


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -