Ошибка при загрузке web-приложения java на tomcat

169
19 октября 2018, 18:20

Изучаю spring, перевожу web приложение java на spring. При загрузке выскакивает ошибка: One or more listeners failed to start. Бьюсь с этим уже второй день, помогите пожалуйста хоть чем-нибудь(может направите на верный путь, вообще не знаю что делать уже) web.xml:

<?xml version="1.0" encoding="UTF-8"?>
 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
  version="4.0"
  metadata-complete="true">  
 <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/root-context.xml</param-value>
 </context-param>
 <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    <load-on-startup>1</load-on-startup>
 </listener>
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
    <display-name>Controller</display-name>
    <servlet-name>servlet</servlet-name>
    <servlet-class>web.MainServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>servlet</servlet-name>
    <url-pattern>/servlet</url-pattern>
</servlet-mapping>
<listener>
    <listener-class>web.MainSessionListener</listener-class>
</listener>
<error-page> 
    <exception-type>java.lang.Throwable</exception-type> 
    <location>/errorPage.jsp</location> 
</error-page>
</web-app>

root-context.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:jpa="http://www.springframework.org/schema/data/jpa"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
                           http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
                           http://www.springframework.org/schema/data/jpa
                           http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
                           http://www.springframework.org/schema/context
                           http://www.springframework.org/schema/context/spring-context-4.3.xsd"
    default-autowire="byName">
    <bean id="MySqlDaoFactory" class="mysql.MySqlDaoFactory">
    </bean>
    <bean id="Connection" class="mysql.MySqlDaoFactory"
    factory-bean="MySqlDaoFactory" factory-method="getConnection">
    </bean>
    <bean id="studentDao" class="mysql.MySqlStudentDao"
    factory-bean="MySqlDaoFactory" factory-method="getStudentDAO">
    </bean>
    <bean id="subjectDao" class="mysql.MySqlSubjectDao"
    factory-bean="MySqlDaoFactory" factory-method="getSubjectDAO">
    </bean>
</beans>
Answer 1

У Вас отсутствует так называемый DispatcherServlet в web.xml.

    <servlet>
    <servlet-name>spring-dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath:path/to/your/mvc-context.xml
        </param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
READ ALSO
AWS размер каталога (папки)

AWS размер каталога (папки)

мне интересно, как взять размер конкретной папки в amazonClient ? Я знаю, что все внутри Амазона - это обьектыНо ведь как-то же можно взять размер...

142
Не работает Seter в массив на Java

Не работает Seter в массив на Java

Не получается понять причину, почему не работает сетерВыставил значение в сетере - а результат инициализации всё равно 0

157
Сложение значений одинаковых ключей

Сложение значений одинаковых ключей

Есть значение (Double) и ключ (String)

130