0

I am trying to run the following example . I am using Spring Tool Suite and I have create, a Spring MVC Project. I configure everything(I think). But I am getting the following exception: PasteBin Exception from server.

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>SpringMVCloginExample</display-name>
    <servlet>
        <servlet-name>springLoginApplication</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/springWeb.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>springLoginApplication</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>

springBeanConfiguration.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
        <bean id="loginDelegate" class="com.havistudio.delegate.LoginDelegate">
            <property name="userService" ref="userService"></property>
        </bean>
        <bean id="userService" class="com.havistudio.service.impl.UserServiceImpl">
            <property name="userDao" ref="userDao"></property>
        </bean>
        <bean name="userDao" class="com.havistudio.dao.impl.UserDaoImpl">
            <property name="dataSource" ref="dataSource"></property>
        </bean>
        <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/sprinexamples" />
            <property name="username" value="root" />
            <property name="password" value="kostas" />
        </bean>
    </beans>

springWeb.xml:

    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-3.0.xsd">
        <context:component-scan base-package="com.havistudio" />
        <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
          <property name="prefix" value="/jsp/" />
          <property name="suffix" value=".jsp" />
       </bean>
        <import resource="springBeanConfiguration.xml"/>
    </beans>

I am new at the Spring Framework. Thanks.

3
  • 1
    Its complaining about mysql jar missing from your class path Commented Jul 31, 2015 at 18:28
  • 1
    add the mysql.jar inside \WebContent\WEB-INF\lib Commented Jul 31, 2015 at 19:01
  • Thanks both you for the help! Commented Aug 1, 2015 at 7:04

1 Answer 1

1

Exception from server reads:

Could not load JDBC driver class [com.mysql.jdbc.Driver]

So add the mysql.jar inside \WebContent\WEB-INF\lib.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.