首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

用jsp 在tomcat5上访问oracle10g?该怎么处理

2013-09-11 
用jsp 在tomcat5上访问oracle10g?我的XML文件内容ResourceParamsname jdbc/tipmis_ods parametern

用jsp 在tomcat5上访问oracle10g?
我的XML文件内容
<ResourceParams   name= "jdbc/tipmis_ods ">
        <parameter>
            <name> validationQuery </name>
            <value> select   *   from   t_salequantity </value>
        </parameter>
        <parameter>
            <name> password </name>
            <value> trade_view </value>
        </parameter>
        <parameter>
            <name> url </name>
            <value> jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.232.1.203)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ods))) </value>
        </parameter>
        <parameter>
            <name> maxActive </name>
            <value> 4 </value>
        </parameter>
        <parameter>
            <name> maxWait </name>
            <value> 5000 </value>
        </parameter>
        <parameter>
            <name> driverClassName </name>
            <value> oracle.jdbc.driver.OracleDriver </value>
        </parameter>
        <parameter>
            <name> username </name>
            <value> usr_trade </value>
        </parameter>
        <parameter>
            <name> maxIdle </name>
            <value> 2 </value>
        </parameter>
    </ResourceParams>
JSP这么写的
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "
"http://www.w3.org/TR/html4/loose.dtd ">
<%@   page   contentType= "text/html;   charset=gb2312 "   %>
<%@   page   import= "tipmis.module.GFunction.DivElementBO "%>  
<%@   page   import= "java.util.Date "%>  
<%@   page   import= "com.sict.util.DateTime "%>  
<%@   page   import= "javax.naming.InitialContext "%>  
<%@   page   import= "javax.naming.Context "%>  
<%@   page   import= "javax.sql.DataSource "%>  
<%@   page   import= "java.sql.Connection "%>  

<%

      Context   ctx   =   new   InitialContext();            
      String   strLookup   =   "java:comp/env/jdbc/tipmis_ods ";  
      DataSource   ds   =(DataSource)   ctx.lookup(strLookup);


      System.out.println( "ds= "+ds);
      System.out.println( "ds= "+ds.toString());
      Connection   con   =   ds.getConnection();
        if   (con   !=   null){
                System.out.println( "success ");
        }else{
                System.out.println( "failure ");
        }              

System.out.println( "*************************************** ");
/*
String   cell_id   =   "hn-001 ";
DivElementBO   bean   =   new   DivElementBO(cell_id,   "0 ",   1);
String   title   =   bean.getCellName();
StringBuffer   str   =   bean.getGenerateDivElement();
*/
%>

<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=GBK ">
<link   href= "css/bigscreen1.css "   rel= "stylesheet "   type= "text/css ">
<script   language= "JavaScript "   src= "js/CalendarForComm.js "> </script>
</head>

<body>


-------------------
<form   method= "post "   name= "frm "   id= "frm "   action= "a.jsp ">
    <div>
<div   id= "page_system_title ">
<!--   title   start-->

<!--   title   end-->
</div>
<div   id= "page_system_content ">
<!--   content   start-->
<%//=str%>
<!--   content   end-->
</div>
    </div>
</form>
</body>
</html>
报的错误如下:
HTTP   Status   500   -  

--------------------------------------------

type   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

javax.servlet.ServletException:   Cannot   create   PoolableConnectionFactory   (Listener   refused   the   connection   with   the   following   error:
ORA-12514,   TNS:listener   does   not   currently   know   of   service   requested   in   connect   descriptor
The   Connection   descriptor   used   by   the   client   was:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.232.1.203)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ods)))
)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.a_jsp._jspService(a_jsp.java:125)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)


javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:50)


root   cause  

org.apache.commons.dbcp.SQLNestedException:   Cannot   create   PoolableConnectionFactory   (Listener   refused   the   connection   with   the   following   error:
ORA-12514,   TNS:listener   does   not   currently   know   of   service   requested   in   connect   descriptor
The   Connection   descriptor   used   by   the   client   was:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.232.1.203)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ods)))
)
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
org.apache.jsp.a_jsp._jspService(a_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:50)

我用的是classes12。jar     ojdbc14。jar   都拷贝到tomcat\common\lib下了

[解决办法]
急迫等待解决办法中
[解决办法]
<value> jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.232.1.203)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ods))) </value>

--->

<value> jdbc:oracle:thin:@(yourhostname):1521:(your sid) </value>
[解决办法]
Oracle数据库的TNSListener服务开了没?在控制面板--〉服务
[解决办法]
出现这样的错误在有的时候,你重新启动一下服务器和是重新装下tomcat有的时候问题也可以得到解决的

[解决办法]
还是不好用,改称 <value> jdbc:oracle:thin:@(yourhostname):1521:(your sid) </value> 之后
报的错误是
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot create PoolableConnectionFactory (Io 异常: NL Exception was generated)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.a_jsp._jspService(a_jsp.java:125)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:50)


root cause

org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: NL Exception was generated)
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)


org.apache.jsp.a_jsp._jspService(a_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:50)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


--------------------------------------------


我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行