1 package jeemin.home.bean;
2
3 import java.sql.*;
4
5 import javax.sql.*;
6 import javax.naming.*;
7 import javax.servlet.http.*;
8
9 import org.apache.commons.dbcp.DelegatingPreparedStatement;
10
11 import cubrid.sql.CUBRIDOID;
12 import cubrid.jdbc.driver.CUBRIDPreparedStatement;
13
14 import jeemin.home.core.*;
15
16 public class IndexBean {
17
18 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(IndexBean.class);
19
20 public boolean init(HttpServletRequest request){
21
22 LOG.debug("시작");
23
24 try{
25 Connection conn = ((DataSource)((Context)new InitialContext()).lookup("java:/comp/env/jdbc/cubrid")).getConnection();
26 LOG.debug(conn.toString());
27 PreparedStatement ps = conn.prepareStatement("INSERT INTO HM_IP(IP_IP) VALUES(?)");
28 LOG.debug(ps.toString());
29 Statement dps1 = ((DelegatingPreparedStatement)ps).getDelegate();
30 LOG.debug(dps1.toString());
31 Statement dps2 = ((DelegatingPreparedStatement)dps1).getDelegate();
32 LOG.debug(dps2.toString());
33
34 try{
35 CUBRIDPreparedStatement cps = (CUBRIDPreparedStatement)dps2;
36 }catch(Exception e){
37 LOG.debug("말도 안되는 오류 발생.", e);
38 }
39
40
41 ps.close();
42 conn.close();
43 }catch(Exception e){
44 LOG.debug("여기선 오류가 발생하지 않음.", e);
45 }
46
47 return false;
48 }
49 }
--------------------------------------------------------------------------------------
2011.11.18 14:10:58.318 DEBUG jeemin.home.bean.IndexBean.init:22 시작
2011.11.18 14:10:58.320 DEBUG jeemin.home.bean.IndexBean.init:26 org.apache.commons.dbcp.PoolableConnection@6d581e80
2011.11.18 14:10:58.321 DEBUG jeemin.home.bean.IndexBean.init:28 org.apache.commons.dbcp.DelegatingPreparedStatement@343a9d95
2011.11.18 14:10:58.322 DEBUG jeemin.home.bean.IndexBean.init:30 org.apache.commons.dbcp.PoolablePreparedStatement@343a9d95
2011.11.18 14:10:58.322 DEBUG jeemin.home.bean.IndexBean.init:32 cubrid.jdbc.driver.CUBRIDPreparedStatement@343a9d95
2011.11.18 14:10:58.325 DEBUG jeemin.home.bean.IndexBean.init:37 말도 안되는 오류 발생.
java.lang.ClassCastException: cubrid.jdbc.driver.CUBRIDPreparedStatement cannot be cast to cubrid.jdbc.driver.CUBRIDPreparedStatement
at jeemin.home.bean.IndexBean.init(IndexBean.java:35)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:775)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:704)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:897)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:636)
--------------------------------------------------------------------------------------------------------------
동일한 클래스끼리 cast가 안되는경우는 대체 뭔가요;;
상식적으로 말이 안되는 상황 아닌가요;;;
버전은 rel 8.3 입니다.
CentOS release 5.4 (Final)
Linux jeemin 2.6.18-164.el5xen #1 SMP Thu Sep 3 04:03:03 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
java-1.6.0-openjdk-1.6.0.0-1.16.b17.el5
httpd-2.2.3-53.el5.centos.3
tomcat5-5.5.23-0jpp.19.el5_6
다른 환경은 바로 아랫글 http://cubrid.com/zbxe/218719 와 동일합니다.