안녕로봇

블로그 이미지

안녕로봇

'Spring'에 해당되는 글 16건

제목 날짜
  • 톰캣7 시작시 SEVERE: Error configuring application listener of class ~.ServletContextListener 에러 2017.06.28
  • 특정 시간에 작동하는 메서드 - 스케쥴러 설정하기 2017.05.08
  • 핸들러 get, post 방식 처리 확인 2017.05.04
  • 인터셉터 - 로그인확인 2017.04.12
  • 스프링 - 파일 업로드 처리 2017.04.04
  • 스프링 프로젝트 설정파일들 간단분석 2017.04.02
  • 서버 시작시 에러 증상 (STS 또는 이클립스) 2017.04.02
  • 포트 문제로 서버 실행이 되지않을때(STS 툴 기준) 2017.04.02
  • STS - 스프링 MVC 프로젝트 만들때 설정해야할것들1 2017.03.31
  • Spring tool suits - 처음 프로젝트 생성후 에러발생 2017.03.30

톰캣7 시작시 SEVERE: Error configuring application listener of class ~.ServletContextListener 에러

Spring/Spring 에러 처리 2017. 6. 28. 13:45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class ~~~~~.ServletContextListener
java.lang.ClassNotFoundException: ~~~~~.ServletContextListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at   
   org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
at      
 
at    org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4618)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5184)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5179)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Colored by Color Scripter
cs



(STS 기준) 이때는 Project -> clean -> clean all projects 선택후 ok


재 실행해보면 해결



출처: https://stackoverflow.com/questions/7849452/classnotfoundexception-with-servletcontextlistener

저작자표시 비영리 변경금지 (새창열림)

'Spring > Spring 에러 처리' 카테고리의 다른 글

핸들러 get, post 방식 처리 확인  (0) 2017.05.04
서버 시작시 에러 증상 (STS 또는 이클립스)  (0) 2017.04.02
포트 문제로 서버 실행이 되지않을때(STS 툴 기준)  (0) 2017.04.02
Spring tool suits - 처음 프로젝트 생성후 에러발생  (0) 2017.03.30
이클립스 콘솔에도 에러가 안떴는데 - 404에러 발생  (0) 2017.03.30
Posted by 안녕로봇

특정 시간에 작동하는 메서드 - 스케쥴러 설정하기

Spring 2017. 5. 8. 13:46


* servlet-context.xml(파일 이름은 다를 수 있음) 설정에 추가


<beans:beans xsi:schemaLocation="http://www.springframework.org/schema/task 

  http://www.springframework.org/schema/task/spring-task.xsd">

<task:scheduler id="jobScheduler" pool-size="10" />

<task:annotation-driven scheduler="jobScheduler" />




*특정 시간에 작동하길 원하는 컨트롤러 내부 메서드에 다음 어노테이션 추가


@Scheduled(cron="0 0 0 1 * * ")

public void doSchedule() {~~~~~~~}


cron= 설정시간 순서는 초 분 시 일 월 요일(1.일요일~7.토요일) 년도

일정간격으로 실행하고 싶을때는 (cron=" ~ ") 대신 (fixedRate=60000) 이런식으로 적어주면 된다 (60000 => 60초마다 실행)

저작자표시 비영리 변경금지 (새창열림)

'Spring' 카테고리의 다른 글

인터셉터 - 로그인확인  (0) 2017.04.12
스프링 - 파일 업로드 처리  (0) 2017.04.04
스프링 프로젝트 설정파일들 간단분석  (0) 2017.04.02
STS - 스프링 MVC 프로젝트 만들때 설정해야할것들  (1) 2017.03.31
Controller 클래스 만들때 고려하기 (이클립스 기준)  (0) 2017.03.28
Posted by 안녕로봇

핸들러 get, post 방식 처리 확인

Spring/Spring 에러 처리 2017. 5. 4. 21:59

한 뷰페이지 내에서 <c:import~> 또는 <jsp:include ~> 액션태그로 다른 뷰페이지의 실행 결과를 포함시킬 경우


1. 현재 뷰페이지가 핸들러에서 post방식으로 처리되서 넘어오고 

2. <c:import~>된 뷰페이지가 핸들러에서 get방식으로만 처리된다면


현재 뷰페이지에 <c:import~>로 첨부시킨다고해도 해당 뷰페이지의 실행결과가 표시되지않는다


ex) 

a뷰페이지 핸들러

@requestMapping(value="~", method=RequestMethod.POST) 


a뷰페이지에 import된 b뷰페이지 핸들러

@requestMapping(value="~", method=RequestMethod.GET) 


결과:  import 된 b뷰페이지의 결과를 가져오지 못함. POST 또는 GET으로 일치시키면 해결

저작자표시 비영리 변경금지 (새창열림)

'Spring > Spring 에러 처리' 카테고리의 다른 글

톰캣7 시작시 SEVERE: Error configuring application listener of class ~.ServletContextListener 에러  (0) 2017.06.28
서버 시작시 에러 증상 (STS 또는 이클립스)  (0) 2017.04.02
포트 문제로 서버 실행이 되지않을때(STS 툴 기준)  (0) 2017.04.02
Spring tool suits - 처음 프로젝트 생성후 에러발생  (0) 2017.03.30
이클립스 콘솔에도 에러가 안떴는데 - 404에러 발생  (0) 2017.03.30
Posted by 안녕로봇

인터셉터 - 로그인확인

Spring 2017. 4. 12. 09:07


* 사용하기 위해서는 dispatcher-servlet 설정파일에 설정 추가

- mapping태그 path 속성: 인터셉터 적용할 명령어들 추가

- beans:ref bean="~~~~" : 인터셉터 클래스 참조 (이 때 클래스의 첫글자는 소문자로 수정)




* 사용자(요청) -> dispatcher-servlet -> 이부분 인터셉터( preHandle ) -> controller -> (postHandle)

-> 사용자(view) -> 예외상황이 발생해도(afterCompletion)


preHandle: 컨트롤러가 실행되기전에 먼저 조건을 체크하는 메서드


postHandle: 컨트롤러가 요청을 처리한 후에 호출되는 메서드


afterCompletion: 뷰를 통해 사용자에게 응답을 전송한뒤에 실행되는 메서드(예외가 발생해도 실행됨)



저작자표시 비영리 변경금지 (새창열림)

'Spring' 카테고리의 다른 글

특정 시간에 작동하는 메서드 - 스케쥴러 설정하기  (0) 2017.05.08
스프링 - 파일 업로드 처리  (0) 2017.04.04
스프링 프로젝트 설정파일들 간단분석  (0) 2017.04.02
STS - 스프링 MVC 프로젝트 만들때 설정해야할것들  (1) 2017.03.31
Controller 클래스 만들때 고려하기 (이클립스 기준)  (0) 2017.03.28
Posted by 안녕로봇

스프링 - 파일 업로드 처리

Spring 2017. 4. 4. 16:33

1. 입력받기(사용자로부터)

      ㄱ. 입력받는 뷰페이지에서...

     1. form에 enctype="multipart/form-data 속성 추가

  <form id="frmWrite" name="frmWrite" method="post" 

action='<c:url value="/reBoard/write.do"/>' enctype="multipart/form-data">

     2. form 태그 내부에 받는 태그 넣기

        <label for="upfile">첨부파일</label>

        <input type="file" name="upfile" id="upfile">(최대 2M)



2. 서버에 파일 저장시키기

ㄱ. 업로드 위치 관련 설정 정보 파일 생성 및 추가 fileUpload.properties


ㄴ. context-common.xml에 빈등록 처리하기

<util:properties id="fileUploadProperties" location="classpath:/config/props/fileUpload.properties" />


ㄷ. 서비스 인터페이스, 서비스 구현 클래스에 파일 업로드처리부분 추가

1. 서비스 인터페이스: public List<Map<String, Object>> fileUpload(HttpServletRequest request);

2. 서비스 구현클래스: ReBoardServiceImpl 멤버변수로 추가하고 @Resource 설정

예) @Resource(name="fileUploadProperties")

private Properties fileProperties;

3. public List<Map<String, Object>> fileUpload(HttpServletRequest request); 메서드 구현

파일을 서버에 업로드 처리하고,

파일명, 파일이름(변경된), 원래파일명 Map에 키,밸류로 저장 => List에 Map들을 저장



3. 저장한 파일명과 파일사이즈, 원래 파일명을 포함해서 글내용을 DB에 저장하기

ㄱ. List에서 Map을 꺼내고 거기서 키로 밸류를 받아서 DB 테이블에 넣는다(다른 정보도 같이 받아서 DB 테이블에 저장)


저작자표시 비영리 변경금지 (새창열림)

'Spring' 카테고리의 다른 글

특정 시간에 작동하는 메서드 - 스케쥴러 설정하기  (0) 2017.05.08
인터셉터 - 로그인확인  (0) 2017.04.12
스프링 프로젝트 설정파일들 간단분석  (0) 2017.04.02
STS - 스프링 MVC 프로젝트 만들때 설정해야할것들  (1) 2017.03.31
Controller 클래스 만들때 고려하기 (이클립스 기준)  (0) 2017.03.28
Posted by 안녕로봇

스프링 프로젝트 설정파일들 간단분석

Spring 2017. 4. 2. 21:25


* 전체적인 설정관련 파일들 소개


* src 하위에 설정파일 2개






저작자표시 비영리 변경금지 (새창열림)

'Spring' 카테고리의 다른 글

인터셉터 - 로그인확인  (0) 2017.04.12
스프링 - 파일 업로드 처리  (0) 2017.04.04
STS - 스프링 MVC 프로젝트 만들때 설정해야할것들  (1) 2017.03.31
Controller 클래스 만들때 고려하기 (이클립스 기준)  (0) 2017.03.28
스프링 프로젝트 시작하기 설정(이클립스 기준)  (0) 2017.03.28
Posted by 안녕로봇

서버 시작시 에러 증상 (STS 또는 이클립스)

Spring/Spring 에러 처리 2017. 4. 2. 15:12

증상

서버 실행시 아래와 같은 메시지가 나오면서 서버가 실행 안될때


Could not load the Tomcat server configuration at \Servers\Tomcat v8.0 Server at localhost-config. 

The configuration may be corrupt or incomplete.

Resource is out of sync with the file system: '/Servers/Tomcat v8.0 Server at localhost-config/server.xml'.


해결

그냥  Servers 선택후 F5 또는 우클릭-refresh 하면됨


저작자표시 비영리 변경금지 (새창열림)

'Spring > Spring 에러 처리' 카테고리의 다른 글

톰캣7 시작시 SEVERE: Error configuring application listener of class ~.ServletContextListener 에러  (0) 2017.06.28
핸들러 get, post 방식 처리 확인  (0) 2017.05.04
포트 문제로 서버 실행이 되지않을때(STS 툴 기준)  (0) 2017.04.02
Spring tool suits - 처음 프로젝트 생성후 에러발생  (0) 2017.03.30
이클립스 콘솔에도 에러가 안떴는데 - 404에러 발생  (0) 2017.03.30
Posted by 안녕로봇

포트 문제로 서버 실행이 되지않을때(STS 툴 기준)

Spring/Spring 에러 처리 2017. 4. 2. 13:50

증상

STS 툴로 프로젝트 생성하고 실행하려는데 아래와 같이 포트가 사용중이라고 뜨면서 되지않을때


Port 8080 required by Pivotal tc Server Developer Edition v3.2 is already in use. 

The server may already be running in another process, or a system process may be using the port. 

To start this server you will need to stop the other process or change the port number(s).



해결


1. 메뉴에서 run - run configurations 선택


2. Java Application 선택후 마우스 더블 클릭이나 마우스 우클릭후 new 선택


3. 새로 생성된 설정에서 arguments 탭 클릭 - VM arguments에 "-Dserver.port=9090" 입력 



출처는 역시나 스택오버플로우

http://stackoverflow.com/questions/27174981/spring-tool-suite-port-8080-required-by-pivotal-tc-server-developer-edition-v3





저작자표시 비영리 변경금지 (새창열림)

'Spring > Spring 에러 처리' 카테고리의 다른 글

핸들러 get, post 방식 처리 확인  (0) 2017.05.04
서버 시작시 에러 증상 (STS 또는 이클립스)  (0) 2017.04.02
Spring tool suits - 처음 프로젝트 생성후 에러발생  (0) 2017.03.30
이클립스 콘솔에도 에러가 안떴는데 - 404에러 발생  (0) 2017.03.30
No mapping found for HTTP request with URI  (0) 2017.03.28
Posted by 안녕로봇

STS - 스프링 MVC 프로젝트 만들때 설정해야할것들

Spring 2017. 3. 31. 11:29

[1] Spring MVC 프로젝트 만들기


New - Spring legacy Project

- Spring MVC Project


[2] web.xml

위치 :  WEB-INF/


1) 모든 *.do 요청을 DispatcherServlet 이 받도록 설정

   DispatcherServlet 에서 사용할 스프링 설정파일 지정 

   - 웹에 종속적인 빈 관리 [자식]

2) 웹어플리케이션 전체(springherb)에서 사용할 

스프링 설정 파일 지정

   - 웹에 종속적이지 않은 빈 관리 [부모]

3) 한글 인코딩 필터 설정


[3] servlet-context.xml

위치 : src\main\webapp\WEB-INF\spring\appServlet

웹에 종속적인 스프링 설정파일


1) viewResolver 설정

논리적인 뷰 이름에 접두사, 접미사 지정


2) <context:component-scan ...

@Controller annotation이 붙은 빈을 자동으로 등록해주도록


3) <annotation-driven />

애노테이션 방식의 컨트롤러를 사용할 때 필요한 DispatcherServlet 전략빈을 

자동으로 등록해줌


4)

<resources mapping="/resources/**" location="/resources/" />

<default-servlet-handler/>


/resources/** 는 DispatcherServlet이 걸르지 않도록 지정


[4] 웹에 종속적이지 않은 스프링 설정파일

웹 어플리테이션(springherb) 전체에서 사용하는 설정파일


위치: src\main\resources\config\spring


(1) context-common.xml

1) <context:component-scan  ..

@Controller 어노테이션이 붙은 빈을 제외한 나머지 빈들을 자동으로 

등록해주도록 설정


2) MultipartResolver

파일 업로드 관련 설정



(2) context-database.xml

- 데이터베이스 관련 설정


1) 데이터베이스 연결정보 지정

dataSource


2) 트랜잭션 관리자, 트랜잭션 처리 관련 설정

<bean id="transactionManager"...


<tx:annotation-driven />


3) Mybatis 객체 설정

sqlSessionFactoryBean



[5] database.properties

위치 : src\main\resources\config\props


context-database.xml 에서 사용할 DB연결 정보들이

들어있는 프로퍼티 파일


[6] mybatis-config.xml

위치: src\main\resources\config\mybatis\oracle


마이바티스 설정 파일


[7] 매퍼 xml

위치: src\main\resources\config\mybatis\mapper\oracle


[8] pom.xml

maven 설정 파일


위치 : sp_ws\springherb

   

<dependencies>


<repositories>


카피


[9] log4j.xml


로깅 설정 파일

레벨 설정 가능 - 나중에 코드 조작 없이도 


위치 : src\main\resources


저작자표시 비영리 변경금지 (새창열림)

'Spring' 카테고리의 다른 글

스프링 - 파일 업로드 처리  (0) 2017.04.04
스프링 프로젝트 설정파일들 간단분석  (0) 2017.04.02
Controller 클래스 만들때 고려하기 (이클립스 기준)  (0) 2017.03.28
스프링 프로젝트 시작하기 설정(이클립스 기준)  (0) 2017.03.28
스프링 MVC  (1) 2017.03.27
Posted by 안녕로봇

Spring tool suits - 처음 프로젝트 생성후 에러발생

Spring/Spring 에러 처리 2017. 3. 30. 11:58

처음 프로젝트 생성후 

repository 파일을 다 받았는데도


servlet-context.xml

root-context.xml


위 파일들에서 에러가 발생했을때


pom.xml에서

<dependency></dependency> 부분을 지웠다가 저장후 다시 되돌렸다가(ctrl+z) 3~4번 껐다 키면

에러가 사라짐


혹은 여기를 참고

http://stackoverflow.com/questions/15520127/sts-first-springmvcproject-servlet-context-xml-root-context-xml-error

저작자표시 비영리 변경금지 (새창열림)

'Spring > Spring 에러 처리' 카테고리의 다른 글

핸들러 get, post 방식 처리 확인  (0) 2017.05.04
서버 시작시 에러 증상 (STS 또는 이클립스)  (0) 2017.04.02
포트 문제로 서버 실행이 되지않을때(STS 툴 기준)  (0) 2017.04.02
이클립스 콘솔에도 에러가 안떴는데 - 404에러 발생  (0) 2017.03.30
No mapping found for HTTP request with URI  (0) 2017.03.28
Posted by 안녕로봇
이전페이지 다음페이지
블로그 이미지

by 안녕로봇

공지사항

    최근...

  • 포스트
  • 댓글
  • 트랙백
  • 더 보기

태그

  • 파일
  • Serialize
  • 서버
  • selectKey
  • 어노테이션
  • jsp
  • ClassNotFoundException
  • 스프링
  • jQuery
  • 핸들러
  • 시작
  • 설정
  • El
  • 스케쥴러
  • Sts
  • Spring
  • 표현언어
  • 업로드
  • 에러
  • ajax
  • 이벤트
  • 스프링 프레임워크
  • mybatis
  • 페이징
  • 한글인코딩
  • 마이바티스
  • 인터셉터
  • 400에러
  • css
  • tomcat

글 보관함

«   2025/08   »
일 월 화 수 목 금 토
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

링크

카테고리

학습 (27)
Spring (16)
Spring 에러 처리 (7)
mybatis (3)
JSP (3)
jQuery JavaScript (4)
HTML CSS (0)
Java (1)
자바 용어 정리 (1)
학습 내용 정리 (0)
실습 작성 및 비교 (0)
Oracle (0)
오라클 용어 정리 (0)
학습 내용 정리 (0)

카운터

Total
Today
Yesterday
방명록 : 관리자 : 글쓰기
안녕로봇's Blog is powered by daumkakao
Skin info material T Mark3 by 뭐하라
favicon

안녕로봇

  • 태그
  • 링크 추가
  • 방명록

관리자 메뉴

  • 관리자 모드
  • 글쓰기
  • 학습 (27)
    • Spring (16)
      • Spring 에러 처리 (7)
    • mybatis (3)
    • JSP (3)
    • jQuery JavaScript (4)
    • HTML CSS (0)
    • Java (1)
      • 자바 용어 정리 (1)
      • 학습 내용 정리 (0)
      • 실습 작성 및 비교 (0)
    • Oracle (0)
      • 오라클 용어 정리 (0)
      • 학습 내용 정리 (0)

카테고리

PC화면 보기 티스토리 Daum

티스토리툴바