Spring 오류 정리

Nux·2022년 1월 18일
0

오류정리

목록 보기
2/5
post-thumbnail

No mapping found for HTTP request with URI / module org.eclipse.jst.jee.server missing

  • servlet-context.xml, web.xml 아무것도 안건드렸는데 오류 계속 발생
  • Tomcat overview에서 아래 두 목록 체크하고 해결

    혹은

    server 설정 후 apply








ModelView override시 HttpServletRequest,Response import불가

web.xml

	<servlet>
		<servlet-name>dispatcher</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
	</servlet>
	
	<servlet-mapping>
		<servlet-name>dispatcher</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>
  • Tomcat v.10에서는 위 서블릿 클래스로 ModelView 사용불가
  • Tomcat v.9로 변경 후 아래와 같이 수정하니 해결
	<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>





Cannot find class [Controller경로] for bean with name '/매핑한경로' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]

  • Newlecture 스프링 프레임워크 강의 수강 중 발생했던 오류

dispatcher-servlet.xml

<bean id="/notice/list" class="com.newlecture.web.controller.notice.ListController"/>

controller

public class ListController implements Controller{
	@Override
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		
		ModelAndView mv = new ModelAndView("notice/list");

		return mv;
	}
}
  • 맞게 매핑하고 경로도 잘 입력했는데 오류 발생

    프로젝트 빌드패스에서 jre로 설정해서 해결






Unsatisfied dependency expressed through constructor parameter 0

  • Newlecture 스프링 프레임워크 강의 수강 중 발생 했던 오류
  • ui와 entity에 각각 @Component를 생성하고 실행했으나 entity에서 값을 받아오지 못함

Program.java

ui

  • Component에 이름(console)도 제대로 설정하고, null값을 받아올 때 분기도 설정

entity

  • value값까지 넣었는데도 불러오지 못함

entity에서 매개변수 값이 있을 때의 생성자만 생성했기 때문에 발생했던 오류
public NewlecExam(){}로 기본생성자 생성 후 정상 실행됨






Unsatisfied dependency expressed through field

  • vo-dao-service-controller를 연결시키던 중 발생했던 에러
  • 대부분 어노테이션을 잘못 붙여 발생하는 문제
  • 나의 경우에는 mapper파일의 type에 오타가 있었음
  • 경로를 알맞게 수정해서 해결





절대 URI인 [http://java.sun.com/jsp/jstl/core]을(를), web.xml 또는 이 애플리케이션과 함께 배치된 JAR 파일 내에서 찾을 수 없습니다.

  • jstl jar파일을 C:\Program Files\Apache Software Foundation\apache-tomcat-9.0.56\lib에 복붙

다운로드 링크: https://mvnrepository.com/artifact/javax.servlet/jstl






Error creating bean with name 'sqlSession' defined in file 어쩌구

  • mybatis설정파일(eGov의 경우 context-mapper.xml) 수정
<property name="mapperLocations" value="classpath:com/domain/sql/mapper/*.xml"/>

<property name="mapperLocations" value="classpath*:com/domain/sql/mapper/*.xml"/>

<!-- classpath뒤에 *을 붙여줌 -->





0개의 댓글