root-context.xml 
  • 로그인 시도 할 때 로그인 정보가 틀리면 리다이렉트 되야하는데,
    어느날 갑자기 그렇게 되지 않고 public key retrieval is not allowed 에러 페이지가 나옴.
  • 해결하려면 url의 value에 아래 코드를 추가한다.

useSSL=false&allowPublicKeyRetrieval=true

<property name="url"
    value="jdbc:mysql://localhost:3306/bakingdom?useSSL=false&amp;allowPublicKeyRetrieval=true&amp;serverTimezone=Asia/Seoul">
</property>

 

 

에러내용 : 이메일주소를 넣고, 임시비밀번호를 메일로 발급받는 기능을 구현하던 중에 발생한 에러.
org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate). Failed messages: javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate); message exceptions (1) are: Failed message 1: javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

 

해결방법 : root-context.xml에 다음 prop을 추가한다.
<prop key="mail.smtp.ssl.trust">smtp.gmail.com</prop> 
<prop key="mail.smtp.ssl.protocols">TLSv1.2</prop>
  • 나같은 경우, <prop key="mail.smtp.ssl.trust">smtp.gmail.com</prop> 는 생략해도 정상적으로 구동되었다.

 

적용한 코드

  <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
    <property name="host" value="smtp.gmail.com" />
    <property name="port" value="587" />
    <property name="username" value="발송메일주소" />
    <property name="password" value="비밀번호" />
    <property name="javaMailProperties">
        <props>
            <prop key="mail.transport.protocol">smtp</prop>
            <prop key="mail.smtp.auth">true</prop>
            <prop key="mail.smtp.starttls.enable">true</prop>
            <prop key="mail.debug">true</prop>
            <!-- <prop key="mail.smtp.ssl.trust">smtp.gmail.com</prop> -->
            <prop key="mail.smtp.ssl.protocols">TLSv1.2</prop>
        </props>
    </property>
  </bean>

json 이용을 위해 pom.xml에 의존성 주입하면 나타나는 에러

NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException

 

해결
1
2
3
4
5
6
7
8
9
10
    <dependency>
    <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-xml</artifactId>
        <version>2.9.9</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.9.9</version>
    </dependency>
cs

버전 2.9.6 -> 2.9.9 로 변경

에러 내용
MyBatisSystemException Could not set parameters for mapping: ParameterMapping{property='gender', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #4 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #4 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (4 > number of parameters, which is 3).

Mapper 코드에 공백이 있어서 발생한 에러. 공백 제거해주자 정상작동 함!

gmail 서버를 이용해 아이디/비밀번호 찾기 기능 구현 중, 

 

Could not convert socket to TLS 에러 발생.

 

root-context.xml에 아래 코드 추가해주면 해결 완료!

1
2
<prop key="mail.smtp.ssl.trust">smtp.gmail.com</prop>
<prop key="mail.smtp.ssl.protocols">TLSv1.2</prop>
cs

 

별의 별 시도를 다 해보고, 버전도 낮춰보고, 다시 설치해보고

오만가지 방법으로 namespace를 만들어보려고 했지만 모두 실패했다.

 

결국 직접 코드를 붙여 넣는 것으로 해결했다..

원시적이군..

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
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
        http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsd
        http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
    <bean id="dataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
        <property name="url"
                  value="jdbc:mysql://localhost:3306/테이블명?useSSL=false&amp;serverTimezone=Asia/Seoul">
        </property>
        <property name="username" value="DB계정명"></property>
        <property name="password" value="암호"></property>
    </bean>  
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="mapperLocations" value="classpath:mappers/**/*Mapper.xml"></property>
    </bean>
    <mybatis-spring:scan base-package="dao패키지명"/>
</beans>
cs

'SPRING > 나의 고통(Error)' 카테고리의 다른 글

Could not set parameters for mapping  (0) 2021.07.28
Could not convert socket to TLS  (0) 2021.07.26
@GetMapping import 불가  (0) 2021.07.22
Build path entry is missing:  (0) 2021.07.21
Could not get JDBC Connection;  (0) 2021.07.11

Controller에서 @GetMapping 어노테이션이 import되지 않을 때,

pom.xml 에서 아래와 같이 프레임워크 버전을 바꿔준다. 

스프링 4.3 버전부터 사용 가능해진 어노테이션이라는데, 꼭 5.0.7이 아니라 그 상위 버전이어도 상관없을 듯 싶다.

 

1
<org.springframework-version>5.0.7.RELEASE</org.springframework-version>
cs

 

Open projects from file System 으로 프로젝트를 가져오면, Build Path Problems라고 해서 다닷다닷 에러가 발생하게 된다.

문제가 발생하는 프로젝트에서 우클릭 - Build Path - Configure Build path... 를 해보면 해당 프로젝트에 빨간불이 들어와 있는 걸 볼 수 있다.

해당 프로젝트 로컬 폴더로 가서 src - test 폴더에 아마 resources 정도만 있을텐데,

새 폴더로 java를 하나 만들어주고 이클립스에서 해당 프로젝트를 Refresh해주면 에러가 사라진다...

'SPRING > 나의 고통(Error)' 카테고리의 다른 글

Could not convert socket to TLS  (0) 2021.07.26
servlet.xml에 namespace탭이 안보일 때  (0) 2021.07.22
@GetMapping import 불가  (0) 2021.07.22
Could not get JDBC Connection;  (0) 2021.07.11
Spring - db 등록시 한글 깨짐  (0) 2021.07.11

에러메세지

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection;

위와 같은 에러가 났다.

 

분명히 저녁먹기 전에는 잘 됐는데, 밥먹고 재실행을 하니 안되는 어이없는 상황 ㅠㅠ

뭐지.. 왜 잘되다가 안되는거지? ㅠㅠㅠ

한시간 가량 구글링을 거쳐

xml 파일들에 오타 난 것 있는지, mysql설정을 내가 뭘 잘못한건지 웬만한 시도를 다 해보다가 

 

 

 

MyBatis error: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.Type - Programmer Sought

 

MyBatis error: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.Type - Programmer Sought

Cause: java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1). This is a magical bug. When my MyBatis statement: select u.roleId, r.roleName from role r, user u where u.roleId = r.roleId and u.userAccount = The following

www.programmersought.com

위 사이트를 접하게 됐는데,  슥 보고 엥?? 설마 이것때문에? 싶어서 나도 적용해보았는데

너무너무너무너무너무  간단한 방법으로 해결이 되었다.

 

그 간단한 방법...

root-context.xml 상단에 주석이 하나 달려 있었는데, 이걸 지우니까 실행이 된다. 하...

 

한시간동안의 스트레스에서 탈출하게 해줬으니

이 블로거한테 좋아요라도 눌러주고 싶었는데,

외국 블로그는 좋아요 시스템이 없는건지 막아놓은건지 나의 감사함을 표할 길이 없다 ㅠㅠ

 

 

주석이 문제였다면 아깐 왜 잘 됐는지,

왜 주석이 실행에 영향을 미치는건지 아직 내 배움의 수준에서는 알 길이 없지만...

 

그냥 너무 어이없었던 에러 해결 순간이었따...

'SPRING > 나의 고통(Error)' 카테고리의 다른 글

Could not convert socket to TLS  (0) 2021.07.26
servlet.xml에 namespace탭이 안보일 때  (0) 2021.07.22
@GetMapping import 불가  (0) 2021.07.22
Build path entry is missing:  (0) 2021.07.21
Spring - db 등록시 한글 깨짐  (0) 2021.07.11

root-context.xml에서 아래와 같이 수정한다.

characterEncoding=UTF-8 추가

 

1
2
3
4
    <property name="url"
              value="jdbc:mysql://localhost:3306/spring?characterEncoding=UTF-8;
                     serverTimezone=Asia/Seoul&amp;useSSL=false&amp;">
 
cs

'SPRING > 나의 고통(Error)' 카테고리의 다른 글

Could not convert socket to TLS  (0) 2021.07.26
servlet.xml에 namespace탭이 안보일 때  (0) 2021.07.22
@GetMapping import 불가  (0) 2021.07.22
Build path entry is missing:  (0) 2021.07.21
Could not get JDBC Connection;  (0) 2021.07.11