뎁스노트 / 언어 / Java

언어

질문Spring CORS 에러 발생 질문드립니다...

corsFilter() fetch 요청 파라미터 해당 사진은 POST이며 GET도 동일하게  credentials: 'include', 추가되어있습니다 나머지 put patch del 경우 url option을 파라미터로 받아 같은 post를 호출하게 되어있습니다 springBootVersion '2.0.1.RELEASE' java 1.8 jboss 사용 환경 : 로컬호스트에서는 해당 문제가 발생하지 않지만 배포된 서버에서 테스트시 해당 문제 발생 문제 : 컨트롤러에 @PostMapping("/???") 특정 하나의 메소드 호출시 CORS 에러발생 저장버튼 클릭시 업로드된 파일을 로컬 경로에 업로드 하고 / 이후 해당 행을 DB에 저장하는 쿼리를 요청하는 메소드입니다 신규 추가시 파일을 업로드하고 행을 저장 시 이상 없이 저장이 되는데 이미 존재하는 행에 저장버튼 클릭시 에러가 발생합니다 로컬과 차이 : 로컬에서 확인되는 응답헤더에 Access-Control-Allow-Credentials, Access-Control-Allow-Origin 이 2개의 헤더가 서버에서는 반환되지 않습니다 에러 메시지 : Access to fetch at '요청URL' from origin '오리진URL' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. POST http://0.00.000.000:4022/??? net::ERR_FAILED 500 (Internal Server Error) Uncaught (in promise) Error: File upload failed. Please try again later. 비고: config.setAllowCredentials(true); 와 config.addAllowedOrigin("*"); 를 함께 쓸 수 없다고 하여 명시적으로 선언도 해주었고 클라이언트단에서 credentials: 'include', 도 추가해주었지만 해결되지 않고 정확한 문제파악조차 되지 않아 질문드립니다
328
2
0
sonaki84
sonaki84·2025-01-22
만약 앞단에 Nginx를 쓰고 있다면, Nginx에서 CORS 설정을 한 경우에 스프링부트까지 요청이 오기 전에 Nginx에서 먼저 CORS 헤더 처리가 되었을 수도 있습니다.  즉, 스프링부트에서 CORS 설정을 한다면 Nginx의 CORS 설정을 빼야할 수도 있습니다.
무린
무린·2025-01-22
올려주신 내용으로 보았을 때, 서버에서 500 에러가 발생하면서 CORS 헤더가 응답에 추가되지 않았을 가능성이 높은 것 같습니다. 500 Internal Server Error가 발생하는 것은 CORS 설정과는 상관없이 서버측의 오류로 발생하는 에러입니다. 이 에러가 발생하면서 CORS 헤더가 응답에 추가되지 않기 때문에 CORS 에러 메시지도 같이 보여...

질문javafx event 처리 질문입니다

package application; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.layout.BorderPane; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) { try { WebView webView = new WebView(); WebEngine webEngine = webView.getEngine(); webEngine.setJavaScriptEnabled(true); webEngine.load("http://localhost:8080/SnakeGame/script.jsp"); BorderPane root = new BorderPane(); root.setCenter(webView); Scene scene = new Scene(root, 800, 600); // 웹 페이지가 포커스를 받을 수 있도록 설정 webView.requestFocus(); // 키 이벤트 처리 scene.setOnKeyPressed(event -> { KeyCode keyCode = event.getCode(); String direction = ""; switch (keyCode) { case UP: direction = "Up"; break; case DOWN: direction = "Down"; break; case LEFT: direction = "Left"; break; case RIGHT: direction = "Right"; break; default: return; } webEngine.executeScript("snake.changeDirection('" + direction + "');"); event.consume(); // 기본 스크롤 방지 }); primaryStage.setScene(scene); primaryStage.setTitle("SnakeGame"); primaryStage.show(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { launch(args); } } 코딩 완전 초보라서 질문을 남깁니다. 현 코드에서 jsp랑 연결하여 javafx로 실행은 됐는데 실행시 키보드 입력 스크롤 움직임이 기본으로 되더라구요..어떻게 처리해야할까요?
397
1
0
무린
무린·2024-08-17
코드에서 키보드 입력 시 기본 스크롤 움직임이 발생하는 문제를 해결하기 위해서는, JavaFX의 WebView가 키 이벤트를 처리할 수 있도록 포커스를 유지하고, 키 입력 시 스크롤이 발생하지 않도록 설정해야 합니다. 현재 코드에서는 이미 event.consume();를 사용하여 키 이벤트를 소비하고 기본 스크롤 동작을 방지하려고 하고 있습니다. 그...
뎁스_3060뎁스_3060· 2년전

질문12-Jun-2024 02:22:02.119 경고

12-Jun-2024 02:22:02.119 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.121 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.122 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.123 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.124 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.125 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.126 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.127 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.129 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.130 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:02.132 경고 [http-nio-8007-exec-26420] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/cmm/fms/selectFileInfs_n.do] to the cache for web application [] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache 12-Jun-2024 02:22:10.132 정보 [ContainerBackgroundProcessor[StandardEngine[kidijsp]]] org.apache.catalina.webresources.Cache.backgroundProcess The background cache eviction process was unable to free [10] percent of the cache for Context [] - consider increasing the maximum size of the cache. After eviction approximately [5,417,457] KB of data remained in the cache. 12-Jun-2024 02:22:20.134 정보 [ContainerBackgroundProcessor[StandardEngine[kidijsp]]] org.apache.catalina.webresources.Cache.backgroundProcess The background cache eviction process was unable to free [10] percent of the cache for Context [] - consider increasing the maximum size of the cache. After eviction approximately [5,417,457] KB of data remained in the cache. 어떻게 해야하나요..뭘 봐야하나요? ㅜㅜ 죄송합니다.
446
0
뎁스_3059뎁스_3059· 2년전

질문curl을 통한 api 서버에 접근은 되는데 java HttpURLConnection 로 api 서버에 접근하면 타임아웃이 뜨는 이유?

안녕하세요.. 제가 api 서버에 접근해서 json 형식의 데이터를 받아로고 싶어 java로 URL obj = new URL(url); con = (HttpURLConnection) obj.openConnection(); 이용해서 해당 서버에 연결을 시도하였지만 Connection timed out 예외가 발생했습니다. 그래서 타임아웃이 발생한 웹서버(was)에 SSH로 콘솔에 접속해서 curl 명령어로 api 서버에 접근했더니 정상적으로 원하는 데이터를 받아 올 수 있었습니다. 예상되고 조언을 듣기에는 같은 서버에서라도 curl 명령어로 접근하는 것과 was 에서 접근할때 방화벽 쪽 걸리는 것이 아닐까 예상되는데 과연 이것 때문인지.. 저는 처음에 curl로 api서버에 접근하던 was에서 java 웹프로그램으로 접근을 하던 같은 서버니깐 같은 방화벽 정책이던 같은 네트워크던 통해서 접근하는게 아닐까 했는데..... 이것이 아닌것 같습니다. 이 예상이 맞을까요? 어떻게 하면 원인을 찾을 수 있을지 방법을 고수님들께 질문 드립니다. 감사합니다. 정리하면 동일한 같은 서버에서 api서버 접속시 java로 만든 웹사이트에서는 타임아웃 예외가 발생하고 콜솔에서 curl 로 api 서버 접속시 정상적으로 값을 받아오는 상황 입니다.... -_-;;;
371
0
Evan KwonEvan Kwon· 3년전

질문SpringBoot에서 JPA를 활용하여 create하는 과정에서 DDL 오류

이렇게 create를 만들어서 DDL를 생성하는 과정에서 오류가 나는데 application.properties에는 ####################서버설정#################### server.port=5000 server.servlet.context-path= spring.datasource.url=jdbc:oracle:thin:@localhost:1521:XE spring.datasource.username=Danaga spring.datasource.password=Danaga 테이블생성 spring.jpa.hibernate.ddl-auto=create spring.jpa.show-sql=true spring.jpa.properties.hibernate.format_sql=true spring.jpa.defer-datasource-initialization=true 이렇게 작성했는데 뭐가 문제인지 모르겠습니다. 밑에는 오류난 부분을 복붙했습니다. org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL " drop table board cascade constraints" via JDBC [ORA-00942: table or view does not exist ] at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:92) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.internal.Helper.applySqlString(Helper.java:235) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.internal.Helper.applySqlStrings(Helper.java:219) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropTables(SchemaDropperImpl.java:362) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropConstraintsTablesSequences(SchemaDropperImpl.java:253) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:215) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:185) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:155) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:115) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:242) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at java.base/java.util.HashMap.forEach(HashMap.java:1421) ~[na:na] at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.boot.internal.SessionFactoryObserverForSchemaExport.sessionFactoryCreated(SessionFactoryObserverForSchemaExport.java:37) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:293) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1455) ~[hibernate-core-6.2.9.Final.jar:6.2.9.Final] at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1817) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1158) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-3.1.4.jar:3.1.4] at com.danaga.AvengersApplication.main(AvengersApplication.java:13) ~[main/:na]
401
0
뎁스_2864뎁스_2864· 3년전

질문Java파일에 JRE파일이 없습니다.

이클립스에 BouncyCastle 을 적용하려던 중 이런식으로 Java파일에 JRE파일이 없습니다. eclipse , intelliJ 모두 실행은 잘 됩니다. JRE파일이 없을땐 어떻게 해야하나요...?
199
0
정희정희· 3년전

질문Frida 후킹 관련

Frida를 통하여 com.test.test 클래스의 test() 함수를 후킹할 때 해당 함수를 호출한 클래스를 출력하는 방법이 있을까요?
628
1
0
무린
무린·2023-08-08
Frida를 사용하여 특정 함수를 후킹하고 해당 함수를 호출한 클래스의 정보를 출력하는 것이 가능합니다. 다음은 Java의 com.test.test 클래스의 test() 함수를 후킹하고, 해당 함수를 호출한 클래스의 정보를 출력하는 예시 스크립트입니다. Java.perform(function() { var testClass = Java.use('c...
샤드샤드· 4년전

질문aUGwjsU=같은 문자열은 뭔가요?

qr코드 같은거 찍으면 나오던데 보기엔 base64같아서 디코딩해봤는데 안되더라구요 저런 문자열은 정체가 뭔가요?
860
1
1
0
케이플
케이플·2023-04-30
Base64로 인코딩된 데이터인 듯 하나 이 문자열만으로는 데이터가 무엇인지 알 수 없습니다. QR 코드는 일반적으로 텍스트, URL, 연락처 정보, 지리적 위치 정보 등 다양한 유형의 데이터를 인코딩할 수 있습니다. 어디에서 QR 코드 스캔하신 문자열인지는 모르겠습니다만 스캔하신 곳에서 제공하는 서비스가 무엇이냐에따라 문자열의 정...
DianeDiane· 4년전

질문이기는 경우의 수 프린트 하기 질문이에요!

안녕하세요! 자바로 틱택토(Tic Tac Toe)라는 게임을 하고 있는데 메소드 중에서 X플레이어와 O플레이어가 각자 이길 수 있는 경우의 수를 프린트 하는 int countAllWinningBoards(String board, char player)라는 메소드를 구현 중이에요. (이기는 조건은 아래에 나와요) 여기서 파라미터로 board와 player를 받고 있는데 board의 예로는 XOX------(첫번째 세개는 가장 윗줄, 두번째 ---는 두번째 줄이지만 빈줄, 마지막 ---는 가장 아랫줄 그리고 이것도 빈줄이에요. 보드는 꽉 찰수도 아니면 빈곳이 있을수도 있어요!) player는 X와 O 둘 중 하나가 와요. 이기는 보드의 예시는 XOXOXO--X 이거예요. 밑에 있는거랑 똑같지만 한줄로 표시해야해요! X O X O X O - - X 작성자가 보드와 플레이어를 입력 했을때 그 플레이어가 주어진 보드에서 이길 가능성이 얼마인지 int로 반환해야하는데 예로 들어서 X O X O X O - X - 이것처럼 XOXOXO-X- 와 X를 입력했을 경우에 리턴값은 2예요. 왜냐하면 X가 1)왼쪽 아래 빈칸과 2) 오른쪽 아래 빈칸에 들어가도 이기게 되니까요 (대각선으로 XXX을 완성시킴) 이기는 조건: 가로 or 세로 or 대각선으로 XXX가 되면 X의 승, OOO가 되면 O의 승
1.1K
1
0