๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

java8

[Java] Unsupported major.minor version 52.0 Error ํ”„๋กœ์ ํŠธ ์„ธํŒ… ๋„์ค‘ java.lang.UnsupportedClassVersionError: org/springframework/util/StopWatch : Unsupported major.minor version 52.0 (unable to load class org.springframework.util.StopWatch) ๋ผ๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€์Šต๋‹ˆ๋‹ค. version 52.0์€ jar ํŒŒ์ผ์˜ ๋นŒ๋“œ jdk ๋ฒ„์ „์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. ์ˆซ์ž ๋ณ„ ์ž๋ฐ” ๋ฒ„์ „ Java SE 13 = 57 (0x39hex) Java SE 12 = 56 (0x38 hex) Java SE 11 = 55 (0x37 hex) Java SE 10 = 54 (0x36 hex) Java SE 9 = 53 (0x35 hex) Java SE 8 = 52 .. 2022. 6. 10.
[Spring] project ".." is missing required annotation processor library Error ๋ฌธ์ œ์  svn์—์„œ check out ๋ฐ›์€ ํ”„๋กœ์ ํŠธ์—์„œ ๋ฐœ์ƒํ•œ ์˜ค๋ฅ˜ project ".." is missing required annotation processor library ์˜ค๋ฅ˜๊ฐ€ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ํŒŒ์ผ์—์„œ ๋ฐœ์ƒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ํ•ด๊ฒฐ๋ฒ• Package ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ ํด๋ฆญ > properties > Java Compiler > Annotation Processing > Factory Path > Enable project specific setting ์ฒดํฌ ํ•ด์ œ Apply and Close ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ์ž๋™์œผ๋กœ ํ•ด๋‹น ์—๋Ÿฌ๊ฐ€ ์‚ฌ๋ผ์ง‘๋‹ˆ๋‹ค. ์ฐธ๊ณ  : https://stackoverflow.com/questions/69214655/project-is-missing-required-annotation-processing-li.. 2022. 5. 19.
[Java] ์›น ์ทจ์•ฝ์„ฑ XSS ํฌ๋กœ์Šค ์‚ฌ์ดํŠธ ์Šคํฌ๋ฆฝํŠธ(XSS : cross-site scripting) ๊ฒ€์ฆ๋˜์ง€ ์•Š์€ ์™ธ๋ถ€ ์ž…๋ ฅ๊ฐ’์„ ์‘๋‹ต์˜ ์ผ๋ถ€๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ์‚ฌ์šฉ์ž ๋ธŒ๋ผ์šฐ์ €์—์„œ ์•…์˜์ ์ธ ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์‹คํ–‰๋  ์ˆ˜ ์žˆ๋Š” ๋ณด์•ˆ ์•ฝ์  .... Message ์œ„์˜ ์ฝ”๋“œ์™€ ๊ฐ™์ด request.getParameter("errmsg") ์„ ํ†ตํ•ด ๊ฐ€์ ธ์˜จ parameter ๊ฐ’์„ jsp ํŒŒ์ผ์˜ ๋กœ ๋ฐ”๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ XSS ๋ณด์•ˆ ์ด์Šˆ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•ด๊ฒฐ๋ฐฉ์•ˆ 1. XSS ๋ฐฉ์ง€ ํ•„ํ„ฐ ์‚ฌ์šฉ .... Message errmsg = errmsg.replaceAll("]*)?(\\s)*(/)?>","").replaceAll("\r|\n| ",""); parameter ์ •๋ณด replaceAllํ•˜๋Š” ์ฝ”๋“œ ์ถ”๊ฐ€ 2. JSTL ํƒœ๊ทธ ์‚ฌ์šฉ .... Message.. 2022. 4. 12.
[Java] javax.net.ssl.SSLHandshakeException: connection during handshake ์˜ค๋ฅ˜ ๋‚ด์šฉ javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake ์›์ธ ์„œ๋ฒ„์™€ ํด๋ผ์ด์–ธํŠธ์˜ SSL/TLS ๋ฒ„์ „์ด ๋งž์ง€ ์•Š์•„ ๋ฐœ์ƒ ๊ณผ๊ฑฐ Tomcat jdk 1.6๋ฒ„์ „ ์‚ฌ์šฉํ–ˆ์„๋•Œ ์„œ๋ฒ„ arguments์— '-Dhttps.protocols=TLSv1'๋ฅผ ์ถ”๊ฐ€ํ–ˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฐฉ์•ˆ System.setProperty("https.protocols", "TLSv1.2"); ์ฝ”๋“œ์— ์ถ”๊ฐ€ ํ˜„์žฌ๋Š” Tomcat jdk 1.8์„ ์‚ฌ์šฉํ•˜์—ฌ '-Dhttps.protocols=TLSv1'๋ฅผ ์‚ญ์ œํ•ด์ฃผ์—ˆ๋”๋‹ˆ ์ •์ƒ ๋™์ž‘ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ์ฐธ๊ณ : https://sagittariusof85s.tistory.com/158 2022. 3. 23.
[Java] Reflection์„ ์ด์šฉํ•œ private ์ ‘๊ทผํ•˜๊ธฐ class ๋ฐ–์—์„œ private ํ•จ์ˆ˜๋ฅผ ํ™œ์šฉํ•ด ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. public์œผ๋กœ ๋ณ€๊ฒฝํ•˜์ง€ ์•Š๊ณ  Java Reflection์„ ์ด์šฉํ•ด private ํ•จ์ˆ˜์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์„ ๊ตฌํ˜„ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. - Reflection ๊ตฌ์ฒด์ ์ธ ํด๋ž˜์Šค ํƒ€์ž…์„ ์•Œ์ง€ ๋ชปํ•ด๋„, ์—ญ์œผ๋กœ ํด๋ž˜์Šค๋ฅผ ๋™์  ๋กœ๋”ฉํ•˜์—ฌ ํด๋ž˜์Šค์˜ ๊ตฌ์กฐ๋ฅผ ํ™•์ธํ•˜๊ฑฐ๋‚˜ ์ธํ„ฐํŽ˜์ด์Šค, ๋ฉ”์†Œ๋“œ ๋“ฑ์˜ ์ •๋ณด๋ฅผ ์•Œ์•„๋‚ด์–ด ํ•ด๋‹น ํด๋ž˜์Šค๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋ฒ•์ž…๋‹ˆ๋‹ค. 1. import import java.lang.reflect.Method; 2. Class ๊ฐ์ฒด ์„ ์–ธ ์‚ฌ์šฉํ•  private ํ•จ์ˆ˜๊ฐ€ ์„ ์–ธ๋œ Class ๊ฐ์ฒด๋ฅผ ์„ ์–ธํ•ฉ๋‹ˆ๋‹ค. TestConfig testConfig = new TestConfig(); 3. getDeclaredMethod ์‚ฌ์šฉ ์„ ์–ธํ•œ.. 2021. 12. 23.
[Java] jar ํŒŒ์ผ ์ƒ์„ฑํ•˜๊ธฐ (Eclipse / bat ํŒŒ์ผ) Java jar ํŒŒ์ผ ์ƒ์„ฑํ•˜๋Š” ๋‘๊ฐ€์ง€ ๋ฐฉ๋ฒ•์„ ์†Œ๊ฐœํ•˜๋ คํ•ฉ๋‹ˆ๋‹ค. 1. Eclipse Export ํ™œ์šฉ 2. bat ํŒŒ์ผ ์ƒ์„ฑ 1. Eclipse Export ํ™œ์šฉ Eclipse Export ๊ธฐ๋Šฅ์„ ํ™œ์šฉํ•ด jar ํŒŒ์ผ์„ ์ƒ์„ฑํ•ด๋ด…์‹œ๋‹ค. 1) Eclipse - File - Export 2) 'jar' ๊ฒ€์ƒ‰ - 'JAR file' ์„ ํƒ - Next 3) complie ํ•  ํŒŒ์ผ ์„ ํƒ - ์ƒ์„ฑํ•  jar ํŒŒ์ผ ์ด๋ฆ„ ์ž…๋ ฅ - Finish 4) Eclipse Workspace์— jar ํŒŒ์ผ ์ƒ์„ฑ ์™„๋ฃŒ! 2. bat ํŒŒ์ผ ์ƒ์„ฑ ๋ฉ”๋ชจ์žฅ์—์„œ java ํŒŒ์ผ compile ๋ฐ jar ํŒŒ์ผ ์ƒ์„ฑํ•˜๋Š” bat ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด๋ด…์‹œ๋‹ค 1) ์ƒˆ๋กœ์šด ๋ฉ”๋ชจ์žฅ ์—ด๊ณ  ์ฐฝ ์ฒซ๋ฒˆ์งธ ์ค„ :Compile ์ž…๋ ฅ :Compile 2) ๋‘๋ฒˆ์งธ ์ค„ "" ์•ˆ์— Jav.. 2021. 12. 16.
[Java] ๊ฐ™์€ ๋„๋ฉ”์ธ ์‚ฌ์šฉ์‹œ session๊ฐ’ null๋กœ ๋ณ€๊ฒฝ๋˜๋Š” ํ˜„์ƒ Tomcat์— ๊ฐ™์€ ๋„๋ฉ”์ธ ๋‹ค๋ฅธ ํฌํŠธ๋กœ ์ปจํ…Œ์ด๋„ˆ๋ฅผ a, b๋กœ ๋ถ„๋ฆฌํ•œ ์ƒํƒœ์—์„œ a ์ปจํ…Œ์ด๋„ˆ์—์„œ setAttribute์œผ๋กœ ์ƒ์„ฑํ•˜๊ณ  ์ €์žฅํ•œ session ๊ฐ’์ด b ์ปจํ…Œ์ด๋„ˆ์˜ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•˜๋ฉด์„œ null๋กœ ๋ณ€๊ฒฝ๋˜๋Š” ํ˜„์ƒ์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ตฌ๊ธ€๋ง ๊ฒฐ๊ณผ, ๊ฐ™์€ ๋„๋ฉ”์ธ(๋˜๋Š” ์•„์ดํ”ผ) ๋‹ค๋ฅธ ํฌํŠธ์—์„œ๋Š” ํŽ˜์ด์ง€ ์ด๋™ ์‹œ ํ†ฐ์บฃ์—์„œ ์ €์žฅํ•˜๋Š” JSESSIONID ๋ผ๋Š” HTTP ์„ธ์…˜ID ๊ฐ’์ด ๊ฐฑ์‹ ๋œ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ๊ฐ€์ง€ ํ•ด๊ฒฐ๋ฐฉ์•ˆ์ด ์žˆ์—ˆ์ง€๋งŒ ๋‚˜์˜ ๊ฒฝ์šฐ ์•„๋ž˜์™€ ๊ฐ™์ด ํ•ด๊ฒฐํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๋‘ ์ปจํ…Œ์ด๋„ˆ์˜ context path๊ฐ€ ๊ฐ™์•„ ์„ธ์…˜ ์ •๋ณด๋ฅผ ๋ฎ์–ด์“ฐ๊ฒŒ ๋˜์—ˆ๊ธฐ ๋•Œ๋ฌธ์—, ๋‘ ์ปจํ…Œ์ด๋„ˆ์˜ context path ๋ฅผ ๋‹ค๋ฅด๊ฒŒ ๋ณ€๊ฒฝ. Tomcat์˜ server.xml ํŒŒ์ผ path ๋‹ค๋ฅด๊ฒŒ ์ˆ˜์ • ํŒŒ์ผ ๊ฒฝ๋กœ : apache-tomcat-7.0.96/con.. 2021. 12. 10.
[Java] JSON ํŒŒ์‹ฑํ•˜๊ธฐ - JAVA์—์„œ JSON ํŒŒ์‹ฑํ•˜๊ธฐ JSONParser : https://javaee.github.io/javaee-spec/javadocs/javax/json/stream/JsonParser.html JSONObject : https://docs.oracle.com/javaee/7/api/javax/json/JsonObject.html JsonObject (Java(TM) EE 7 Specification APIs) JsonObject class represents an immutable JSON object value (an unordered collection of zero or more name/value pairs). It also provides unmodifiable map view to th.. 2021. 12. 7.
๋ฐ˜์‘ํ˜•