powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Java [игнор отключен] [закрыт для гостей] / Spring. No web application context found.
15 сообщений из 15, страница 1 из 1
Spring. No web application context found.
    #38403857
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Пытаюсь разобраться со Спрингом с помощью разных мануалов.

WEB.xml
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <!--
     Описание корневого контейнера, разделяемого всеми сервлетами и фильтрами 
    -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/root-context.xml</param-value>
    </context-param>
    <!--
     Создаёт контейнер Spring, разделяемый всеми сервлетами и фильтрами 
    -->
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    <!--
     Базовый сервлет, обрабатывает все запросы к приложению 
    -->
    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <!--  Фильтр для перекодировки в utf8  -->
    <filter>
        <filter-name>charsetFilter</filter-name>
            <filter-class>
                org.springframework.web.filter.CharacterEncodingFilter
            </filter-class>
            <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF-8</param-value>
            </init-param>
            <init-param>
                <param-name>forceEncoding</param-name>
                <param-value>true</param-value>
            </init-param>
    </filter>
    <filter-mapping>
        <filter-name>charsetFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>



root-context.xml
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
    <!--
     Root Context: определяет ресурсы, доступные всему приложению, всем сервлетам 
    -->
    <!--
     Включаем опцию использования конфигурационных аннотаций (@Annotation-based configuration)
    -->
    <context:annotation-config/>
    <!--
     Определяем папки, в которых будем автоматически искать бины-компоненты (@Component, @Service)  
    -->
    <context:component-scan base-package="com.gmail.dosofredriver.springtest.dao"/>
    <context:component-scan base-package="com.gmail.dosofredriver.springtest.service"/>
    <!--
     Файл с настройками ресурсов для работы с данными (Data Access Resources) 
    -->
    <import resource="data.xml"/>
    <!--  Файл с настройками безопасности  -->
    <import resource="security.xml"/>
</beans>



servlet-context.xml
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
<beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xsi:schemaLocation=" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    <!--
     DispatcherServlet Context: определяет настройки одного сервлета; бины, 
                    которые доступны только ему 
    -->
    <!--
     Разрешаем использование аннотаций Spring MVC (то есть @Controller и.т.д) 
    -->
    <annotation-driven/>
    <!--
     Всю статику (изображения, css-файлы, javascript) положим в папку webapp/resources 
                    и замаппим их на урл вида /resources/** 
    -->
    <resources mapping="/resources/**" location="/resources/"/>
    <!--
     Отображение видов на jsp-файлы, лежащие в папке /WEB-INF/views 
    -->
    <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/views/"/>
        <beans:property name="suffix" value=".jsp"/>
    </beans:bean>
    <!--  Файл с настройками контроллеров  -->
    <beans:import resource="controllers.xml"/>
</beans:beans>



index.jsp
Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
<%@ page language="java" contentType="text/html; charset=utf8"
	pageEncoding="utf8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf8">
	<title><spring:message code="label.title" /></title>
</head>
<body>

<a href="<c:url value="/logout" />">
	<spring:message code="label.logout" />
</a>
  
<h2><spring:message code="label.title" /></h2>

<form:form method="post" action="add" commandName="user">

	<table>
		<tr>
			<td><form:label path="firstname">
				<spring:message code="label.firstname" />
			</form:label></td>
			<td><form:input path="firstname" /></td>
		</tr>
		<tr>
			<td><form:label path="lastname">
				<spring:message code="label.lastname" />
			</form:label></td>
			<td><form:input path="lastname" /></td>
		</tr>
		<tr>
			<td><form:label path="email">
				<spring:message code="label.email" />
			</form:label></td>
			<td><form:input path="email" /></td>
		</tr>
		<tr>
			<td><form:label path="telephone">
				<spring:message code="label.telephone" />
			</form:label></td>
			<td><form:input path="telephone" /></td>
		</tr>
		<tr>
			<td colspan="2"><input type="submit"
				value="<spring:message code="label.adduser"/>" /></td>
		</tr>
	</table>
</form:form>

<h3><spring:message code="label.users" /></h3>
<c:if test="${!empty userList}">
	<table class="data">
		<tr>
			<th><spring:message code="label.firstname" /></th>
			<th><spring:message code="label.email" /></th>
			<th><spring:message code="label.telephone" /></th>
			<th>&nbsp;</th>
		</tr>
		<c:forEach items="${userList}" var="user">
			<tr>
				<td>${user.lastname}, ${user.firstname}</td>
				<td>${user.email}</td>
				<td>${user.telephone}</td>
				<td><a href="delete/${user.id}"><spring:message code="label.delete" /></a></td>
			</tr>
		</c:forEach>
	</table>
</c:if>

</body>
</html>



IDE - Netbeans
Сервер - Tomcat 7.0.34

При попытке обращения к странице из браузера получаю это:

Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
HTTP Status 500 - An exception occurred processing JSP page /index.jsp at line 10

type Exception report

message An exception occurred processing JSP page /index.jsp at line 10

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 10

7: <html>
8: <head>
9: 	<meta http-equiv="Content-Type" content="text/html; charset=utf8">
10: 	<title><spring:message code="label.title" /></title>
11: </head>
12: <body>
13: 


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:465)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

root cause

java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
	org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:90)
	org.springframework.web.servlet.support.RequestContextUtils.getWebApplicationContext(RequestContextUtils.java:85)
	org.springframework.web.servlet.support.RequestContext.initContext(RequestContext.java:209)
	org.springframework.web.servlet.support.JspAwareRequestContext.initContext(JspAwareRequestContext.java:74)
	org.springframework.web.servlet.support.JspAwareRequestContext.<init>(JspAwareRequestContext.java:48)
	org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77)
	org.apache.jsp.index_jsp._jspx_meth_spring_005fmessage_005f0(index_jsp.java:153)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:93)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.34 logs.
Apache Tomcat/7.0.34



Прошу вашей помощи, дорогие форумчане.
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38403965
redwhite90
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
DoSOfRedRiver,

Код: java
1.
<title><spring:message code="label.title" /></title>



попробуй убрать эту строку из jsp
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38404099
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
redwhite90,

Собсна

Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
HTTP Status 500 - An exception occurred processing JSP page /index.jsp at line 15

type Exception report

message An exception occurred processing JSP page /index.jsp at line 15

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 15

12: <body>
13: 
14: <a href="<c:url value="/logout" />">
15: 	<spring:message code="label.logout" />
16: </a>
17:   
18: <h2><spring:message code="label.title" /></h2>


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:465)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

root cause

java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
	org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:90)
	org.springframework.web.servlet.support.RequestContextUtils.getWebApplicationContext(RequestContextUtils.java:85)
	org.springframework.web.servlet.support.RequestContext.initContext(RequestContext.java:209)
	org.springframework.web.servlet.support.JspAwareRequestContext.initContext(JspAwareRequestContext.java:74)
	org.springframework.web.servlet.support.JspAwareRequestContext.<init>(JspAwareRequestContext.java:48)
	org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77)
	org.apache.jsp.index_jsp._jspx_meth_spring_005fmessage_005f0(index_jsp.java:170)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:102)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.34 logs.



И вроде ж лисенер зареган. Что не так то?
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38404113
WGA
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
WGA
Гость
DoSOfRedRiver,

А что в логах Tomcat'а?
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38404162
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
WGA,

Папка logs пустая, как ни странно.
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38404206
IDVsbruck
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
В root-context.xml добавить:
Код: xml
1.
2.
3.
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
	<property name="basename" value="/WEB-INF/config/messages"/>
</bean>


Для spring-bundles этого хватит.
Если нет мультиязычности, то создать файл messages.properties (или как он там у тебя называется). Если есть мультиязычность, то messages_en.properties, messages_ru.properties, ...
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38408620
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
IDVsbruck,

Не помогло :\


...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38408623
Фотография Blazkowicz
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
web.xml не пробовали в lower case назвать?
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38408953
JavaSpringFrameworkHibernateGWT
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Выложи сюда проект. Я посмотрю.
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38409097
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Blazkowicz,

А вроде помогло даже. Во всяком случае, сейчас появилось куча других ошибок на стадии деплоя. Не думал что оно case sensivity, спасибо.
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38409766
Atum1
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Смотрите видео и делайте все как там сказано :

http://www.youtube.com/playlist?list=PLC97BDEFDCDD169D7
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38409787
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Atum1,

Спасибо. Жаль, конечно, не на русском, но думаю разберусь ;)
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38409906
risk
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
DoSOfRedRiverBlazkowicz,

А вроде помогло даже. Во всяком случае, сейчас появилось куча других ошибок на стадии деплоя. Не думал что оно case sensivity, спасибо.
Ну ява же она кросплатформенная, а линкс кейссенсетив ))))
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38409919
Atum1
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Там все просто в картинках с примерами :-)


Есть и по русски

YouTube Video
...
Рейтинг: 0 / 0
Spring. No web application context found.
    #38410170
DoSOfRedRiver
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Atum1,

Пожалуй, Юрий Ткач мне больше подойдёт. Там много рассказывают теории полезной, лекции неплохие.
...
Рейтинг: 0 / 0
15 сообщений из 15, страница 1 из 1
Форумы / Java [игнор отключен] [закрыт для гостей] / Spring. No web application context found.
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]