-
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-01005: null password given; logon denied) 에러web 프로그래밍/eclipse 에러 2018. 7. 28. 16:00
JDBC 연습중에 에러가 출력 되었습니다.
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-01005: null password given; logon denied
분명히 context.xml에 정보 넣고 연습하는 프로젝트의 dao에서 잘 연결 한거 같은데 에러가 났네요.
<Resource auth="Container"
driverClassName = "oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:xe"
name="jdbc/Oracle11g"
username="scott"
passwrod="tiger"
type="javax.sql.DataSource"
maxActive = "50"
maxWait = "1000"
/>(context.xml)
public class JdbcDAO {
DataSource dataSource;
private String sql = "select * from member";
public JdbcDAO() {
try {
Context context = new InitialContext();
dataSource = (DataSource) context.lookup("java:comp/env/jdbc/Oracle11g");
} catch (Exception e) {
e.printStackTrace();
}
}
public ArrayList<JdbcDTO> memberSelect(){
ArrayList<JdbcDTO> dtos = new ArrayList<>();
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
conn = dataSource.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
while(rs.next()) {
String name = rs.getString("name");
String id = rs.getString("id");
String pw = rs.getString("pw");
String phone = rs.getString("phone");
String gender = rs.getString("gender");
JdbcDTO dto = new JdbcDTO(name,id,pw,phone,gender);
dtos.add(dto);
}
} catch(Exception e) {
e.printStackTrace();
}
return dtos;
}
}(JdbcDAO.java)
혹시 비번이 틀린건가 싶어서 cmd에서 직접 id와 pw 입력해서 들어가봤는데
이상없이 잘 접속됩니다.
그래도 혹시 몰라 context.xml에서 일부러 비번을 틀리게 해봤습니다.
java.sql.SQLException: ORA-01017: invalid username/password; logon denied
진짜로 비번이 틀리면 이렇게 나오네요.
음...... 뭐가 문제인가 짜증과 흥분되는 마음을 다시 가다듬고 에러가 찍힌 콘솔을 천천히 살펴보았습니다.
<에러 로그 전체>
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-01005: null password given; logon denied
)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at kr.cis.ex.JdbcDAO.memberSelect(JdbcDAO.java:35)
at org.apache.jsp.jdbc_jsp._jspService(jdbc_jsp.java:99)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: ORA-01005: null password given; logon deniedat oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:452)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:392)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:384)
at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:657)
at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:433)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:471)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:199)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:365)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:812)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:547)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:225)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:556)
at org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 30 more
ORA-01005: null password given; logon denied 이부분을 잘 보니까 비번이 null 이라고 되어있네요?
뭐지 싶어서 context.xml에서 입력한 내용을 다시 천천히 살펴봅니다.
<Resource auth="Container"
driverClassName = "oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:xe"
name="jdbc/Oracle11g"
username="scott"
passwrod="tiger"
type="javax.sql.DataSource"
maxActive = "50"
maxWait = "1000"
/>다시 보니까 비번을 입력한곳에 오타가 있네요... ㅡ_ㅡ; 이런 $%$ㅆ%$%!!!!
흥분한 마음을 가라앉히고 오타를 수정합니다.
<Resource auth="Container"
driverClassName = "oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:xe"
name="jdbc/Oracle11g"
username="scott"
password="tiger"
type="javax.sql.DataSource"
maxActive = "50"
maxWait = "1000"
/>그리고 다시 서버를 구동시켜서 결과를 확인해보니 잘나오네요 ㅜ.ㅜ
오타 하나땜에 엄청 헤매었습니다.
혹시 비슷한 에러때문에 헤매고 계신분이 있지 않을까 싶어서 남겨봅니다.
'web 프로그래밍 > eclipse 에러' 카테고리의 다른 글
Ambiguous mapping found.Cannot map xxController ~~~~ 에러 (0) 2018.08.07 org.apache.tomcat.dbcp.dbcp.BasicDataSource cannot be cast to ~~ 에러 (0) 2018.07.28 이클립스 프로젝트 익스플로러에서 패키지 묶음으로 나타나게 하기 (0) 2018.07.10