으로의 DispatcherServlet에 URI와 HTTP 요청을 찾을 수 없습니다,하지만 난 에 매핑이 Thymeleaf 봄 4
WARNING [http-apr-8080-exec-4] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/hire-platform/] in DispatcherServlet with name 'mvc-dispatcher'
을 가지고 그리고
/WEB-INF/templates/index.html
의 내용이 표시되지 않습니다. 여기
mvc-dispatcher-servlet-xml
입니다 : 내 이전 질문,
Failed to instantiate [org.thymeleaf.templateresolver.ServletContextTemplateResolver]: No default constructor found에서 발견
servletContext
콩이 완전히
How to set ServletContext property for a bean in Spring XML metadata configuration answer부터 붙여 복사됩니다
<?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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
>
<bean
id="viewResolver"
class="org.thymeleaf.spring4.view.ThymeleafViewResolver"
p:templateEngine-ref="templateEngine"
p:characterEncoding="UTF-8"
>
</bean>
<bean
id="servletContext"
class="beans.ServletContextFactory"
></bean>
<bean
id="templateResolver"
class="org.thymeleaf.templateresolver.ServletContextTemplateResolver"
p:prefix="/WEB-INF/templates/"
p:suffix=".html"
p:templateMode="HTML5"
>
<constructor-arg ref="servletContext"/>
</bean>
<bean
id="templateEngine"
class="org.thymeleaf.spring4.SpringTemplateEngine"
p:templateResolver-ref="templateResolver"
>
</bean>
은,이 생성자 매개 변수로 필요합니다. Thymeleaf 대신 JSP (index.jsp
)를 사용하면 HTML 파일 (index.html
)으로 리디렉션해야한다고 생각합니다. 어쩌면 applicationContext.xml
파일에 뭔가 빠졌습니까? 여기 applicationContext.xml
파일이 모습입니다 : 나는 그들이 여기에 필요하지 않은 생각하기 때문에 내가 Spring AOP
부분 SessionFactory
콩 및 <!--<mvc:annotation-driven/>-->
주석을 제거
<?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:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
">
<jdbc:embedded-database id="DataSource" type="HSQL">
</jdbc:embedded-database>
<context:component-scan base-package="beans"/>
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="SessionFactory"></property>
</bean>
<tx:annotation-driven />
. 내가 메이븐에서 Thymeleaf 종속성이 pom.xml
에 포함되어 있습니다
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0-b01</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring4 -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
그래서, 나는 하나 개의 구성 라인 같은 간단한 무언가를 놓치고 있음을 확신합니다. 아무도 도와 주시면 고맙겠습니다. 미리 감사드립니다. P.
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<!-- The Bootstrap listener to start up and shut down Spring's root WebApplicationContext. It is registered to Servlet Container -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
나는 또한 컨트롤러를 추가하는 시도 :
@Controller
public final class MainController {
@RequestMapping(value = "/")
public String displayFirstView() {
return "index.html";
}
}
를하지만 도움이되지 않았다 내가 비슷한 질문을 가지고보기 때문에 는 또한, web.xml 파일을 포함한다. Solution : applicationContext.xml
에 <mvc:annotation-driven/>
을 놓쳤습니다. 여기에 포함 된 MainController
과 같은 첫 번째보기 용 컨트롤러가 있어야합니다. 이 문제에 많은 도움을 주신 사용자에게 감사드립니다.
서버 로그를 확인하십시오. mybe 문제점 배포본 – Jens
@Jens Tomcat Catalina 탭의 Hibernate와 관련하여'org.hsqldb.HsqlException : 사용자에게 권한이 없거나 객체가 없습니다. PUBLIC.LANGUAGES_LIST' 만 있지만 Thymeleaf없이 JSP를 사용하면 또한 발생했지만 index.jsp가 표시되었습니다 –
db 액세스 데이터를 확인해야하는 것처럼 보입니다 – Jens