초보촙
40
2019-09-19 10:59:26 작성 2019-09-19 10:59:59 수정됨
10
258

Javascript ajax가 윈도우에선 잘 되는데 Centos에선 500오류만 뱉어내는 이유를 못찾겠습니다 ㅠ


$.ajax({

url: url,

type: "POST",

processData: false,  // file전송시 필수

contentType: false,  // file전송시 필수

data: formData,

beforeSend: fnBefore || function() {

},

이 아래는 성공, 실패 함수입니다.

엑셀업로드 시 ajax로 엑셀을 읽어서 db에 삽입하려고 합니다. SQL은 문제가 없는 것을 직접 입력해서 확인했습니다.

url도 잘 들어가는 것을 확인했고 formData도 window에서와 같은 것을 확인했습니다.. 근데 윈도우에서는 잘 돌아가는데 centos환경으로 바꾸니 아예 동작을 안하고 FileuploadException을 자꾸 출력해서 아무리 검색해봐도 답이 나오질 않습니다. spring framework에서 서버는 tomcat 7.0을 사용하고 있습니다.

조언 부탁드리겠습니다.

0
0
  • 답변 10

  • 유리세계
    2k
    2019-09-19 11:04:48

    FileuploadException 내용이 어떻게되나요

    1
  • 초보촙
    40
    2019-09-19 15:31:45 작성 2019-09-20 14:00:59 수정됨

    @유리세계

    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tomcat.util.http.fileupload.FileUploadException
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
    	org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
    	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
    	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
    

    Root Cause

    org.apache.tomcat.util.http.fileupload.FileUploadException
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	java.lang.reflect.Method.invoke(Method.java:498)
    	org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
    	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
    	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:685)
    	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
    	org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	com.storyant.anti.sys.framework.AjaxSessionTimeoutFilter.doFilter(AjaxSessionTimeoutFilter.java:43)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
    	org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
    	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
    	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
    이 오류입니다
    0
  • 유리세계
    2k
    2019-09-19 17:03:44

    경로문제일 것 같은데...

    (AllRecordController.java:192)
    1
  • 초보촙
    40
    2019-09-19 17:08:35

    저 코드 들어가보면 괄호 하나밖에 없는데 무슨 경로 말씀하시는건지 알 수 있을까요..ㅠㅠ

    0
  • 유리세계
    2k
    2019-09-19 17:24:01

    일단 여기 내용이 어떻게되나요?

    AllRecordController.java:192
    1
  • 초보촙
    40
    2019-09-19 17:29:04 작성 2019-09-19 17:33:38 수정됨

    들어가보면 }이거 하나밖에 없습니다 ㅜㅜ

    리퀘스트 url말씀하시는 줄 알고 바꿔보았는데 그건 아니였네요!

    폼데이터에는 윈도우처럼 값이 잘 들어가는 걸 확인했습니다

    0
  • 유리세계
    2k
    2019-09-19 17:35:15

    https://okky.kr/article/321236

    여기 답변들 참조해보시겠어요>

    심각: Servlet.service() for servlet [dispatcher] in context with path
     [] threw exception [Request processing failed; nested exception is 
     org.springframework.web.multipart.MultipartException: Could not parse
      multipart servlet request; nested exception is 
    	org.apache.commons.fileupload.FileUploadException: 
    	Stream ended unexpectedly] with root cause

    분명히 요런 에러도 있으셨을 것 같은데

    0
  • 초보촙
    40
    2019-09-19 17:41:30

    멀티파트는 저번에 해결했었는데 센트오에스라서 다른 건가요 ㅜㅜ 처음이라 너무 어렵네요

    0
  • 유리세계
    2k
    2019-09-19 17:46:41

    로컬환경에서 재대로 된는데 반영한 서버에서 재대로 안되면...

    자바버전/ 서버인코딩/ 서버파일경로

    위 세가지 중에 하나일 거에요

    0
  • 초보촙
    40
    2019-09-19 19:22:27

    감사합니다 하나하나 다시 확인해보겠습니다


    0
  • 로그인을 하시면 답변을 등록할 수 있습니다.