javascript,HTML,CSS
[javascript] getOutputStream() has already been called for this response
코린이예요
2019. 2. 22. 11:13
반응형
1 | getOutputStream() has already been called for this response | cs |
아래 링크에서 tomcat doc를 살펴보면
"java.lang.IllegalStateException"은 "getOutputStream"이미 해당 response로 called 되면 발생하는 예외라고 적혀있다.
즉 getOutputStream() 이 2번 호출...
위 에러 메세지로 구글링을 좀 해보니 해결방법은
-> out.clear();를 response.getOutputStream(); 하기 전에 실행하면 된다고 한다.
하지만 내 소스를 뒤져봤지만 getOutputStream() 메소드를 호출하는부분이 없음..
도대체 무엇이 문제일까?
view
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | $("#deviceComponetIdSelect").change(function(e){ var deviceComponentId = $("#deviceComponetIdSelect").val(); var deviceModelId = "${deviceModelId}"; $("#swVersionIdSelect").empty(); $("#swVersionIdSelect").prepend("<option selected value=\"\">Select</option>"); $.ajax({ url: '${ctx}/operation/device/addSw/ajax', type: 'GET', data: {deviceComponentId : deviceComponentId, deviceModelId : deviceModelId}, dataType: 'json', success: function(data){ alert("success"); }, error : function(jqXHR, textStatus, errorThrown) { //document.getElementById("deviceModelName").value = ""; alert("error : " + textStatus); } }); }); | cs |
controller
1 2 3 4 5 6 7 8 9 10 11 12 | @RequestMapping(value = "/operation/device/addSw/ajax", method = RequestMethod.GET) @PreAuthorize("hasAnyRole('ROLE_ADMIN, operation/device|R')") public @ResponseBody List<SwVersion> ajaxList(@ModelAttribute("command") SwVersionListCommand command, ModelMap modelMap) { Assert.notNull(command.getDeviceModelId(), "deviceModelId must be provided."); Assert.notNull(command.getDeviceComponentId(), "devicedComponentId must be provided."); List<SwVersion> swVersionList = swVersionService.findByDevCompIdAndModId(command.getDeviceModelId(), command.getDeviceComponentId()); return swVersionList; } | cs |
view와 controller 쪽에서만 계속 살펴보다가
domain에서 @ManyToOne & @OneToMany 관계를 모두 지웠더니 정상적으로 response가 되었다.
이거는 조금더 분석 해봐야할 것 같다.
근본적인 해결방법 및 원인은 파악하지 못한 상태다.
반응형