配置tomcat JNDI datasource的问题 [问题点数:20分,结帖人michaellufhl]

Bbs5
本版专家分:3860
结帖率 85.29%
Bbs7
本版专家分:17920
关于在tomcat中实现JNDI与dataSource的问题
书上说,要想用dataSource,必须用JNDI,举例:rn rn HashTable env=new HashTable();rn env.put(Context.INITIAL_CONTEXT_FACTORY,一个工厂类[比如com.ora.jsp.sql.DataSourceFactory]);rn env.put(Context.PROVIDER_URL,"C:/datase/<em>jndi</em>/");rn Context context=new InitialContext(env);rn dataSource ed=new dataSource();rn ed.setXXX()rn ......rn context.bind("<em>jndi</em>/example",ed);rnrn对于,客户端来说,需要:rnrn HashTable env=new HashTable();rn env.put(Context.INITIAL_CONTEXT_FACTORY,一个工厂类[比如com.ora.jsp.sql.DataSourceFactory]);rn env.put(Context.PROVIDER_URL,"C:/datase/<em>jndi</em>/");rn Context context=new InitialContext(env);rn dataseSource ed=context.lookup("<em>jndi</em>/example");rn Connection connection=ed.getContection();rn ......rnrnrn而对于<em>tomcat</em>而言,该如何<em>配置</em>?rn书上说,在conf/server.xml中注册JNDI资源。将元素放入。而我看了元素以后,rn发现其中并没有有关Context.PROVIDER_URL,C:/datase/<em>jndi</em>/的设置内容。rn而设置环境的时候,如下:rnContext context=new InitialContext();rndataSource fg=context.lookup(...);rnrn请问,环境是如何初始化的?new InitialContext(),未包含任何信息?Context.PROVIDER_URL属性的值是?
jndi Datasource 问题
现在使用 <em>jndi</em> 连接池 创建<em>datasource</em> web程序访问没有<em>问题</em> ,rn现在 是写一个application程序 完成 一定的任务 ,这个应用程序 除了自己在重新创建<em>datasource</em> 外rn能否 通过某种方式 访问 web DataSource?n[b]<em>问题</em>补充:[/b]n是 还是从新整一套 数据库连接池就使用 apache 的dbcp 来整吧 !
Tomcat 配置JNDI数据源问题
我自JSP页面里通过JNDI读取<em>tomcat</em>的服务器<em>配置</em>,但是运行报错如下:rnHTTP Status 500 - An exception occurred processing JSP page /First.jsp at line 44rnrntype Exception reportrnrnmessage An exception occurred processing JSP page /First.jsp at line 44rnrndescription The server encountered an internal error that prevented it from fulfilling this request.rnrnexceptionrnrnorg.apache.jasper.JasperException: An exception occurred processing JSP page /First.jsp at line 44rnrn41: Context ctx = new InitialContext();rn42: DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/testdb");rn43: if (ds == null) return;rn44: Connection conn = ds.getConnection();rn45: Statement stmt = conn.createStatement();rn46: ResultSet rs = stmt.executeQuery("select * from news_inf");rn47: while (rs.next()) rnrn我的<em>tomcat</em>服务器conf目录下context.xml<em>配置</em>如下:rnrnrn rn WEB-INF/web.xmlrnrn rn rnrn rn rnrn rnrn项目中WEB-INF目录下web.xml<em>配置</em>如下:rnrnrn MySQLJSPrn rn index.htmlrn index.htmrn index.jsprn default.htmlrn default.htmrn default.jsprn rn rn MySQL DataSourcern jdbc/testdbrn javax.sql.DataSourcern Containerrn rnrn仔细看了也不知道哪里写错了,请高手指点!
tomcat配置jndi问题
我在<em>tomcat</em>的配了个<em>jndi</em> <em>datasource</em>,连接到mysqlrn其中url是dbc:mysql:///test?useUnicode=true&characterEncoding=UTF8rn报错了,说:characterEncoding should end with ";",但是我加了“;”也没有用!rnrn后来改成dbc:mysql:///test?useUnicode=true 就可以了。rnrn这是为什么?rnrn-----------------------------------rnrnrn rn rn rn factoryrn org.apache.commons.dbcp.BasicDataSourceFactoryrn rnrn rn rn urlrn jdbc:mysql:///test?useUnicode=true&characterEncoding=UTF8rn rn rn driverClassNamecom.mysql.jdbc.Driverrn rn rn usernamern rootrn rn rn passwordrn rn rnrn rn rn maxWaitrn 5000rn rn rn maxIdlern 2rn rn rn maxActivern 4rn rnrn rnrn
tomcat;里面配置datasource
<em>配置</em>时后一直有错误rn服务器端发生错误:Cannot create JDBC driver of class '' for connect URL 'null' rnrn错误原因为:org.apache.<em>tomcat</em>.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.<em>tomcat</em>.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780) at org.apache.<em>tomcat</em>.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) at mypack.BookDB.getConnection(BookDB.java:24) at mypack.BookDB.getBookDetails(BookDB.java:110) at org.apache.jsp.bookdetails_jsp._jspService(org.apache.jsp.bookdetails_jsp:92) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.<em>tomcat</em>.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.<em>tomcat</em>.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.<em>tomcat</em>.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.<em>tomcat</em>.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) ... 24 more rn
tomcat架构分析 (JNDI配置)
[b][size=medium]出处:[url=http://gearever.iteye.com]http://gearever.iteye.com[/url][/size][/b] JNDI(Java Naming and Directory Interface,Java命名和目录接口)是一组在Java应用中访问命名和目录服务的API。命名服务将名称和对象联系起来,使得我们可以用名称访问...
Tomcat下JNDI的局部配置
1、在项目的META-INFO下面新建context.xml。加入: &amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt; &amp;lt;Context&amp;gt; &amp;lt;Resource name=&quot;<em>jndi</em>/test&quot; auth=&quot;Container&quot; type=&quot;javax.sql.DataSource&quot;
Tomcat JNDI简单配置
server.xml: ............. Spring: java:/comp/env/PortalONEServiceDB
配置Tomcat JNDI数据源
以下示例基于Spring: 1、在Mysql中建立Spring数据库,数据库中建立user表 2、在<em>tomcat</em>目录下conf\context.xml中的&amp;lt;Context&amp;gt;标签中加入   &amp;lt;Resource name=&quot;<em>jndi</em>&quot; auth=&quot;Container&quot; type=&quot;javax.sql.DataSource&quot; ...
Tomcat JNDI配置
Tomcat JNDI<em>配置</em>说明
tomcat配置Jndi数据源
<em>配置</em>Jndi数据源1.在Tomcat中conf文件夹下的server.xml文件增加数据源<em>配置</em>&amp;lt;Resource name=&quot;myJndiName&quot; auth=&quot;Container&quot; driverClassName=&quot;oracle.jdbc.driver.OracleDriver&quot; maxTotal=&quot;50&quot; initialSize=&quot;5&quot; maxIdle=&quot;10&quot;
Tomcat 配置JNDI服务
Generic JavaBean Resources   【通过/WEB-INF/context.xml<em>配置</em>】 第一步,新建一个Bean   package model; public class Foo { private String ip; private int port; private String signSequence; public S...
TOMCAT JNDI配置
TOMCAT JNDI<em>配置</em>
tomcat jndi数据库连接池配置
<em>tomcat</em> <em>配置</em>文件conf/content.xml 里加入 [code=&quot;java&quot;][/code] 项目<em>配置</em>文件WEB-INF/web.xml [code=&quot;java&quot;] DB Connection jdbc/testdb com.microsoft.sqlserver.jdbc.SQLServerDriver Container [/code] ...
Tomcat Jndi 数据库连接池配置
Tomcat Jndi 数据库连接池<em>配置</em>rn在这里以mysql为例,根据自己的摸索。简单介绍一下:rnTomcat 版本:5.0,把mysql的jdbc驱动.jar包放到<em>tomcat</em>的common/lib下去,也可以放到WEB-INF/lib下。rn我的web module名字是test,在它的<em>配置</em>文件web.xml中加上:rnrn jdbc/myJndiName_johnrn javax.sql.DataSourcern Containerrn rn在C:\jakarta-<em>tomcat</em>-5.0.30\conf\Catalina\localhost中建立一个<em>配置</em>xml文件,rn我起名为:test.xml,文件名是任意的。rn内容如下:rn rn debug="5" reloadable="true" crossContext="true">rnrn rnrn rnrn rn rn factoryrn org.apache.commons.dbcp.BasicDataSourceFactoryrn rnrn rn rn maxActivern 100rn rnrn rn rn maxIdlern 30rn rnrn rn rn maxWaitrn 10000rn rnrn rn rn usernamern rootrn rn rn passwordrn johnrn rnrn rn rn rn rn driverClassNamern com.mysql.jdbc.Driverrn rn rn rn rn urlrn jdbc:mysql://localhost:3306/testrn rn rnrnrn在class中用以下代码即可得到数据库连接池中的数据库连接:rnprivate void test()rn try rn Context ctx = new InitialContext();rnrn DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/myJndiName_john");rnrn Connection con = ds.getConnection(); //来连接数据库连接池rn System.out.println("test success...");rn catch (NamingException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rnrnrn官方网站相关详细介绍,http://<em>tomcat</em>.apache.org/<em>tomcat</em>-5.0-doc/<em>jndi</em>-<em>datasource</em>-examples-howto.htmlrnrn以下是<em>tomcat</em>5.5的<em>配置</em>方法:rn在Tomcat 5.5\conf\Catalina\localhost\xxxxx.xml(xxxxx.xml为你自己的web的<em>配置</em>xml文件) 中添加resourcernrn rnrnrn欢迎访问我的blog:rnhttp://blog.sina.com.cn/u/1250048172
读取tomcat jndi配置
具体看代码的resolveJNDIProps方法。首先在<em>tomcat</em>d的config/context.xml里添加代码 &amp;lt;?xml version='1.0' encoding='utf-8'?&amp;gt;&amp;lt;!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor lice...
tomcat 如何配jndidatasource,(最简单!!!)
如题,看了好多贴子,试了好多回,还是不成功
急!高分求教,关于Tomcat和Jndi的DataSource的配置!!!!!!
server.xml中rn rn rn rn rn factoryrn org.apache.commons.dbcp.BasicDataSourceFactoryrn rn rn urlrn jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubsrn rn rn driverClassNamern com.microsoft.jdbc.sqlserver.SQLServerDriverrn rn rn usernamern sarn rn rn passwordrn sarn rn rn maxWaitrn -1rn rn rn maxIdlern 10rn rn rn maxActivern 50rn rn rn rnrnweb.xml中rn rn MSSQL Datasource examplern jdbc/mssqldbrn javax.sql.DataSourcern Containerrn rnrn程序中rnContext initContext = new InitialContext();rnContext envContext = (Context)initContext.lookup("java:/comp/env");rnDataSource ds = (DataSource)envContext.lookup("jdbc/mssqldb");rnConnection conn = ds.getConnection();rn// Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");rn// Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://10.10.10.13:1433;DatabaseName=pubs;","sa","sa" ) ;rnStatement stmt = conn.createStatement();rnResultSet rst = stmt.executeQuery("select * from employee");rnif(rst.next()) rn foo=rst.getString(1);rn bar=rst.getString(2);rnrnconn.close();rnrn其中注释部分在Tomcat下面可以直接执行,说明驱动已经在路径里了。rnrn通过<em>jndi</em>得到错误rnorg.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause:rnjava.sql.SQLException: No suitable driverrn at java.sql.DriverManager.getDriver(DriverManager.java:243)rn at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:743)rn at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)rn at <em>tomcat</em><em>jndi</em>.Test.init(Test.java:43)rn at org.apache.jsp.jsp1_jsp._jspService(jsp1_jsp.java:55)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.coyote.<em>tomcat</em>4.CoyoteAdapter.service(CoyoteAdapter.java:193)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)rn at org.apache.<em>tomcat</em>.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)rn at org.apache.<em>tomcat</em>.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)rn at java.lang.Thread.run(Thread.java:536)rnrnrn它为什么还说驱动为“”呢?在线等待。rnrn
JNDI 中的 DataSource 和 context 问题
Context cntxt = new InitialContext(); rnrnrnrnrn  DataSource ds = (DataSource) cntxt.lookup("jdbc/dpt"); rnrn 这句话到底什么意思? 目的是什么rnrn<em>jndi</em>有什么用 = =rn
有关jndi和DataSource菜鸟问题
import com.microsoft.jdbcx.sqlserver.SQLServerDataSource;rnimport javax.sql.*;rnimport java.sql.*;rnimport javax.naming.*;rnimport java.util.Hashtable;rnrnpublic class Test rnrn public static void main(String[] args) rnrn try rnrn Test t = new Test();rn t.bindDataSource ();rn Connection con = t.getConnection ();rn rn catch(NamingException e) rn System.out.println("namingException:"+e.getMessage ());rnrn rn catch(SQLException e) rn System.out.println ("sqlException:"+e.getMessage ());rn rnrn rnrn public Connection getConnection() throws NamingException,SQLExceptionrnrn Hashtable env = new Hashtable();rn env.put (Context.INITIAL_CONTEXT_FACTORY,"com.sun.<em>jndi</em>.ldap.LdapCtxFactory");rn env.put (Context.PROVIDER_URL,"ldap://zhouyu:389");rn Context ctx = new InitialContext(env);rn DataSource dataSource = (DataSource)ctx.lookup ("jdbc/TestDB");rnrn return dataSource.getConnection ("zydgyy","19831009");rn rnrn public void bindDataSource() throws NamingException,SQLExceptionrnrn SQLServerDataSource dataSource = new SQLServerDataSource();rn dataSource.setServerName ("ZHOUYU");rn dataSource.setDatabaseName("jiAnMobile");rn dataSource.setPortNumber(1433);rn //dataSource.setUser("zydgyy");rn //dataSource.setPassword("19831009");rn Hashtable env = new Hashtable();rn env.put (Context.INITIAL_CONTEXT_FACTORY,"com.sun.<em>jndi</em>.ldap.LdapCtxFactory");rn env.put (Context.PROVIDER_URL,"ldap://zhouyu:389");rn Context ctx = new InitialContext(env);rnrn ctx.bind ("jdbc/TestDB",dataSource);rn rn
关于在jbuilder9中使用jndi配置datasource
我的程序使用<em>jndi</em>来连接数据库,在网上查了很多文章,发现jb里面启动<em>tomcat</em>不会调用server.xml,而是在工程目录下的<em>tomcat</em>/conf/ 产生server808X.xml临时文件,<em>配置</em>要写在这里,rn文章上面说删除了那段这样就不自动产生了,也不会删除这个临时文件了。rn 我照着做了,但server808X.xml文件还是会被删除,还有其他方法<em>配置</em>吗???rnrn
用JNDI绑定DataSource
概念:JNDI(Java Namespace Diretory Interface)是Java中命名空间和目录协议,有很多的服务器都实现了这个接口,如我们机器上的FileSystem文件系统服务器,还有LDAP(Lightweight Diretory Access Protocol轻量级的目录访问协议)服务器也实现了这个接口.还有很多.可以在网上搜索一下.
jndidatasource有什么关系
<em>jndi</em>和<em>datasource</em>有什么关系
关于ejb的datasourcejndi
创建ejb项目时添加jpa框架,在<em>jndi</em> dara source中命名数据源为myejb,生成<em>配置</em>文件如下rnpersistence.xmlrnrnrn rn rn mytextrn rn rnrn启动jboss后在rnjboss.jcarnname='jboss-ha-local-jdbc.rar',service=RARDeployment rnname='jboss-ha-xa-jdbc.rar',service=RARDeployment rnname='jboss-local-jdbc.rar',service=RARDeployment rnname='jboss-xa-jdbc.rar',service=RARDeployment rnname='jms-ra.rar',service=RARDeployment rnname='mail-ra.rar',service=RARDeployment rnname='quartz-ra.rar',service=RARDeployment rnname=DefaultDS,service=DataSourceBinding rnname=DefaultDS,service=LocalTxCM rnname=DefaultDS,service=ManagedConnectionFactory rnname=DefaultDS,service=ManagedConnectionPool rnrnrn点开rnname=DefaultDS,service=DataSourceBinding 看不到名为myejb的数据源,不知道为什么rn
请教:tomcat datasource 配置出错
我在<em>tomcat</em>5下为我的应用<em>配置</em>了数据源rnrn rnrn叫jdbc/sqlserver的<em>datasource</em>是我在<em>tomcat</em>控制台界面上创建的数据源,但是当我在程序中查找数据源时却报错rnds=(DataSource)ctx.lookup("java:comp/env/jdbc/sqlserver");rnrnerror:rn javax.naming.NameNotFoundException: Name java:comp is not bound in this Contextrnrn请问java:comp的名称没有绑定是怎么回事,难道这还需要手工的<em>配置</em>吗
关于Tomcat下配置DataSource的小问题
各位,我目前在的一个Java Web项目,因为需要涉及到大量的数据库连接,所以,想运用数据源来做,rn我之前没用个那玩意,上网查了查发现那玩意还要在在<em>tomcat</em>_home/conf/Context.xml加入资源映射,rn我有个疑问,如果是在本机上的做个映射也就算了,可是,我这个项目做好要移植到公司服务器上的,rn我没有办法对那个服务器<em>配置</em>映射,那我原来用了“数据源”的项目放在公司服务器上会不会因为,rn这种<em>配置</em><em>问题</em>而不能运行呢?rn
配置tomcat的全局JNDI数据源
1. 2添加数据库驱动文件 把数据库驱动jar文件,加入到Tomcat的lib中 3.<em>配置</em>应用程序的web.xml文件 在web.xml中<em>配置</em> 4.判断是否访问成功
Tomcat jndi 配置数据源过程
Tomcat <em>jndi</em> <em>配置</em>数据源过程 Tomcat <em>jndi</em> <em>配置</em>数据源过程 Tomcat <em>jndi</em> <em>配置</em>数据源过程 Tomcat <em>jndi</em> <em>配置</em>数据源过程
tomcat 7 如何配置 jndi
我用的是oracle 全局数据库名为:aktestrn账号为akakak 密码为bkbkbkrnoracle数据库在本机上rnrn想用如下代码来访问数据库中内容:rnString <em>jndi</em>DS="java:/testDS";rnInitialContext ic = new InitialContext();rnDataSource ds = null;rnds = (DataSource) ic.lookup(<em>jndi</em>DS);rnrn请问该如何<em>配置</em>呢?
tomcat下通过JNDI配置数据库连接池
<em>tomcat</em>下通过JNDI<em>配置</em>数据库连接池按照访问范围分类共有两种,分别是全局数据库连接池和局部数据库连接池。前者是在一个tocmat部署下的应用都能使用该数据库连接池,后者是只有特定的应用才能使用的数据库连接池。<em>tomcat</em>默认的JDBC连接池实现是 apache下的DBCP连接池,我们也可以使用C3P0作为<em>tomcat</em>的数据库连接池,但是需要进行额外的<em>配置</em>,本篇博客只介绍DBCP连接池的两种配
tomcat jndi配置例子图
用j2ee版本的eclipse新建一个web动态工程。然后在web.xml里增加<em>jndi</em>的<em>配置</em> JNDI DataSource <em>jndi</em>/mybatis javax.sql.DataSource
JNDI Datasource HOW-TO(Tomcat 9)
jsp数据源的<em>配置</em>步骤: 1、MySql 2、Oracle
tomcatjndi的三种配置方式
参考文章: [url]http://www.cnblogs.com/springmvc3/archive/2011/08/23/2224397.html[/url] <em>tomcat</em>下<em>jndi</em>的三种<em>配置</em>方式 <em>jndi</em>(Java Naming and Directory Interface,Java命名和目录接口)是一组在Java应用中访问命名和目录服务...
Tomcat中配置数据源JNDI
详细介绍了在Tomcat中<em>配置</em>数据源JNDI的三种方法,其中第一种方法最好用,附带一部分源代码
tomcat配置数据源 JNDI
在server.xml 中 WEB-INF/web.xml
Tomcat 配置jndi 连接数据库方法
我在网上搜了好多资料,也照着做了很多次都没有成功,请大家帮助小弟解决这个<em>问题</em>rnrn
tomcat配置jndi 数据源
<em>tomcat</em>中<em>配置</em><em>jndi</em> 数据源!!!
Tomcat 配置JNDI数据源总结
JNDI是J2EE中一个很重要的标准,通常我们是在J2EE编程中用到,Tomcat中提供了在JSP和Servelt中直接使用JNDI的方法, 主要是通过dbcp连接池,下面谈一下我在Tomcat5.5中<em>配置</em>和使用JNDI的方法。 在<em>tomcat</em>目录下的conf\Catalina\localhost\工程名字.xml <em>配置</em>如下: Tomcat5.5.9中数据库JNDI的名字 ...
tomcat 4.1.3+strtus+mysql JNDI的配置,求救!!
  原来用JDBC可以成功连接数据库,但是速度极慢,查询数据几乎需要近5分钟。所以要改成JNDI<em>配置</em>数据库连接池,解决速度<em>问题</em>。rn   Hashtable env = new Hashtable();rn env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.commons.dbcp.BasicDataSourceFactory" );rn javax.naming.Context ctx = new javax.naming.InitialContext();rn DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/inventory");rn return ds.getConnection();rnrn 在<em>tomcat</em>的conf/server.xml中定义了数据源,在项目的web.xml中也定义了数据源。rn 可是每次运行都不成功,无法连接数据库,错误为:rn javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initialrn 各位兄弟姐妹帮忙啊,已经焦头烂额了!!rn google了无数页面,试用了各种连接都不行!rnrnrn
Maven项目配置Tomcat下的JNDI数据源
1,在src/main/webapp/WEB-INF/下,创建context.xml文件 WEB-INF/web.xml oracle.j
Tomcat使用JNDI配置数据源
1.创建web项目 2.在MEAT-INF创建context.xml &amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt; &amp;lt;Context&amp;gt; &amp;lt;Resource auth=&quot;Container&quot; driverClassName=&quot;com.mysql.jdbc.Driver&quot; maxIdle=&qu
Tomcat连接池配置与实现/JNDI
路径: http://javabaike.iteye.com/blog/550180
JNDI 配置TOMCAT的数据库连接池配置问题
问个TOMCAT 连接池的<em>问题</em>rnMETA-INF/CONTEXT.XMLrnconf/CONTEXT.XMLrnlocalhost/test.xmlrn三个<em>配置</em>的覆盖关系rn还有conf/web.xmlrnweb-inf/web.xml到底哪个会被哪个覆盖啊rnrn我在项目中的WEB-INF/WEB.XML中添加了rn[code=XML]rn rn MySQL Connection Pool rn jdbc/mysql rn javax.sql.DataSource rn Container rn rn[/code]rn在META-INF/CONTEXT.XMLrn中添加了这段rn[code=XML]rnrnWEB-INF/web.xmlrnrnrn[/code]rnrn在SERVER.XML中添加了rn[code=XML]rnrn[/code]rnconf\Catalina\localhost\下面是 项目名.XMLrn[code=XML]rnrnrnrn[/code]rnrn结果老报这个异常,是有什么<em>问题</em>啊rn还有conf/context.xml 内容是我原来<em>配置</em>的数据连接池,rn[code=XML]rnrnrn rn[/code]rnrn我只是想换种方式rn原来的没<em>问题</em>只是把原来的<em>配置</em>在conf/web.xml里的这段rn rn MySQL Connection Pool rn jdbc/mysql rn javax.sql.DataSource rn Container rn rn我把他用在项目里面的web-inf/web.xml里了,还有原来的conf/context.xml里面的那段数据源我也把他改在了server.xml里rn然后meta-inf/context.xml里面<em>配置</em>的那段是对应资源的连接,错误出在哪里啊rnrn请各位前辈支招
Tomcat 5.0.25 中配置JNDI
我看了好多都配不通 今天终于配通了,又在一些高手的基础上总结了一次,有什么<em>问题</em>可以找我rnMSN:cnyqiao@hotmail.comrnrnTomcat 5.0.25 中<em>配置</em>JNDIrn rn 2005-08-29rn rn 本文主要介绍Tomcat5.0.25 这个版本下数据库连接池的<em>配置</em>,及程序对连接池的JNDI查找,并提供相应测试代码。本人经历了痛苦的调试过程.现将综合一些高人贴子,以最简单的形式给大家说明,希望大家不要骂我呀^_^rn rn 一 准备工作rn 1 .该文的<em>配置</em>环境:Tomcat5.0.25 + jdk1.4.2+ MySql 4.1 + mysql-connector-java-3.0.16-ga-bin.jar + Win2000 server.rn 2 .将mysql-connector-java-3.0.16-ga-bin.jar文件COPY到D:\<em>tomcat</em>5\common\lib目录下.可以在这里下载rnhttp://dev.mysql.com/downloads/connector/j/3.0.html(3.0.17)rn 3.建表rn# Host: localhostrn# Database: testrn# Table: 'test'rn# rnCREATE TABLE `test` (rn `userid` int(11) NOT NULL auto_increment,rn `name` varchar(100) NOT NULL default '',rn `birthday` datetime NOT NULL default '0000-00-00 00:00:00',rn `email` varchar(100) NOT NULL default '',rn PRIMARY KEY (`userid`)rn) ENGINE=MyISAM DEFAULT CHARSET=latin1; rn rn 二 <em>配置</em>工作rn 1 .在D:\<em>tomcat</em>5\conf\<em>tomcat</em>-users.xml中加入以下内容:rn rn rn rn 2 .启动Tomcat,打开IE在地址栏内输入http://localhost:8080/admin 输入用户名/密码:admin/admin,进入Tomcat的管理界面;点击右边的Data Sources 在右上角的下拉菜单中选择Create New Data Source 在下边的输入框中输入需要的<em>配置</em>信息。rnrnJNDI Name:jdbc/XXX(XXX为自己所命的名字)rnrnData Source URL:jdbc:mysql://localhost:3306/test(连接的数据名)rnrnJDBC Driver Class: org.gjt.mm.mysql.DriverrnrnUser Name:root连接数据库的用户名 rnrnPassword: xx 数据库密码rnrnMax. Active Connections: 100 最大连接数rnrnMax. Idle Connections: 30 是最大的空闲连接数rnrnMax. Wait for Connection: 5000 最大等待连接数rnrn 3 .修改 web.xmlrn打开webapps/ROOT/WEB-INF下web.xml,加入如下内容: rnrn MySql Datasource examplern jdbc/XXX //注意这里的一定要与JNDI NAME相同rn javax.sql.DataSourcern Containerrn rnrn 4 . 我们这里用JSP页面进行测试,以下两段代码放在TOMCAT_HOME/webapps/ROOT/DBTest下边,同时还须修改TOMCAT_HOME/conf/Catalina/localhost/下的ROOT.xml文件,在rn下边加入:rnrn来引用所<em>配置</em>的JNDI数据源。同时将注释掉rnrn 三 测试代码:rn 1 .UserHanDleDB.jsprn rn rn rn rn rnrn rn"); rnfor(int j=0;j"+col+""); rn rnout.print(""); rn rn%> rn rn<% rnfor(int i=0;i rn rn rnrn 3.我的测试结果rn User ID Name Birth day EMail rn 1 xxxxxx 0000-00-00 00:00:00 xxxxxxxxxxxxxx rn 2 test 0000-00-00 00:00:00 xxx@aaa.bb rn 3 test1 0000-00-00 00:00:00 xxx@aaa.bb rn
关于在tomcat中dataSource配置描述符的问题
有三个,,rnrn是什麽意思?连接池客提供的最大连接数(包括正在使用的和空闲的)?rnrn那呢?最大的空闲连接数?不懂!达到最大连接数后会如何?强制使用?rnrn那呢?rnrn看了<em>tomcat</em>的文档,不太懂!
tomcat中javax.transaction.UserTransaction的jndi配置问题
在高级dao编程关于jta的内容,其中使用了到了这样的代码:rnrnObject obj = lookup("java:comp/UserTransaction");rnUserTransaction tx = (UserTransaction) narrow(obj, UserTransaction.class);rn结果lookup("java:comp/UserTransaction")时出错: rn2004-08-18 10:13:52 -- lookup java:comp/UserTransaction is failed!rnCannot create resource instance.rn应该是context中没有叫做java:comp/UserTransaction的<em>jndi</em>,那么在<em>tomcat</em>和jboss的服务器中怎么样<em>配置</em>这么一个<em>jndi</em>呢?rnrnrn
tomcat通过admin配置JNDI问题,oracle数据库。
使用admin登录之后,Resources->Data Sources中<em>配置</em>如下:rn-------------------------------------------------rnJNDI Name: jdbc/ORACLE rnData Source URL: jdbc:oracle:thin:@127.0.0.1:1521:ora92 rnJDBC Driver Class: oracle.jdbc.driver.OracleDriver rnUser Name:ln114 rnPassword: ln114 rnMax. Active Connections: 4 rnMax. Idle Connections: 2 rnMax. Wait for Connection: 5000 rnValidation Query: rn-------------------------------------------------rn请高手帮忙看一下<em>配置</em>,如有错误的地方请帮忙指出,多谢。echoiori@126.com
spring jndi tomcat 配置数据源问题
1 开发环境:eclipse3.6+jdk1.6+mysql5.1+<em>tomcat</em>6.0.18rn2 把mysql的驱动包mysql-connector-java-5.0.8-bin.jar放在rist-apache-<em>tomcat</em>-6.0.18\common\lib下面。rn3 rist-apache-<em>tomcat</em>-6.0.18\conf\context.xmlrn 在节点里面添加rn rn4 我项目的web.xml里面添加rn rn MySQLDBConnection Poolrn jdbc/Ristrn javax.sql.DataSourcern Containerrn Shareablern rn5 spring中的<em>配置</em>rn rn rn rnrn以上是我所有的<em>配置</em>及环境了但是还是报如下的错误。rnrn[code="java"]Cannot create JDBC driver of class '' for connect URL 'null'rnjava.lang.NullPointerExceptionrn at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)rn at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)rn at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)rn at java.sql.DriverManager.getDriver(DriverManager.java:253)rn at org.apache.<em>tomcat</em>.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1143)rn at org.apache.<em>tomcat</em>.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)rn at org.springframework.jdbc.<em>datasource</em>.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:200)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn at $Proxy5.logon(Unknown Source)rn at com.cmsz.rist.system.action.UsersAction.logon(UsersAction.java:492)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)rn at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)rn at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)rn at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)rn at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)rn at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.cmsz.rist.common.util.SessionAuthFilter.doFilter(SessionAuthFilter.java:33)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.cmsz.rist.init.SessionAuthFilter.doFilter(SessionAuthFilter.java:45)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.<em>tomcat</em>.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)[/code]rn<em>问题</em>:1 请问是何种原因导致的?rn 2 我的驱动包放得可对?
jndi配置tomcat连接mysql问题
<em>jndi</em><em>配置</em><em>tomcat</em>连接mysql<em>问题</em> rn错误提示:rn at org.apache.<em>tomcat</em>.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1203)rn at java.lang.Thread.run(Unknown Source)rnCaused by: java.sql.SQLException: No suitable driverrn at java.sql.DriverManager.getDriver(Unknown Source)rn at org.apache.<em>tomcat</em>.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)rn ... 20 morern我其他<em>配置</em>都按照网上资料<em>配置</em>正确了,郁闷中....
Myeclipse配置Tomcat Jndi数据源问题
我做了一个非常简单的Hiernate的程序,用普通的jdbc是没<em>问题</em>的,但是如果用<em>tomcat</em>的JNDI数据源就有<em>问题</em>了,出现错误:rnxception in thread "main" org.hibernate.HibernateException: Could not find <em>datasource</em>rn at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)rn at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)rn at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)rn at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)rn at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)rn at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)rn at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)rn at hinernate.HiberOperator.(HiberOperator.java:21)rn at hinernate.Test.main(Test.java:14)rnCaused by: javax.naming.NoInitialContextException: Cannot instantiate class: [Root exception is java.lang.ClassNotFoundException: ]rn at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)rn at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)rn at javax.naming.InitialContext.init(Unknown Source)rn at javax.naming.InitialContext.(Unknown Source)rn at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:28)rn at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)rn ... 8 morernCaused by: java.lang.ClassNotFoundException: rn at java.lang.Class.forName0(Native Method)rn at java.lang.Class.forName(Unknown Source)rn at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)rn ... 14 morernrn但是我的数据源是存在并且可用的,我的hibernat.cfg.xml是:rnrnrnrnrnrnrnrn java:comp/env/jdbc/MyJndirn rn rootrn rootrn rn org.hibernate.dialect.MySQLDialectrn rn jdbc:mysql://localhsot:3306/FishDBrn rn rn rn rnrnrnrnrn请问高手是什么原因呢?谢谢
Tomcat jndi 数据库怎么配置 连接池配置
Tomcat <em>jndi</em> 数据库怎么<em>配置</em> 连接池<em>配置</em>
Tomcat datasource问题
我使用<em>tomcat</em> <em>datasource</em>连接DB2,查询语句执行的都没有<em>问题</em>,但是更新就无法成功.rn同样的更新语句,用JDBC就可以顺利的操作数据库,但是用DATASOURCE创建的STATEMENT就不行,有人知道是怎么回事吗?
tomcat 下的DataSource 问题
写了一个servlet ,用DataSourc 方式访问数据库,编译时提示rncan not resolve symbolrnsymbol:DataSourcrnrn已经import java.sql.*;了rn请问大虾,<em>问题</em>在哪里,是一定要启动j2ee么
tomcat jdbc datasource问题
已经按<em>tomcat</em>文档中的示例<em>配置</em>成功,但以下这几个数值各位高手可否指示一下配成多少可以rn使访问效率提高rn有没有什么讲究rnrn maxActivern 100rn rnrn rn rn maxIdlern 30rn rnrn rn rn maxWaitrn 10000rn rn
JNDI配置数据源(tomcat配置
JNDI全称Java Naming and Directory Interface,即Java命名和目录接口,目前我只知道它可以用来<em>配置</em>数据源,至于其它用法和意义可以百度。 JNDI<em>配置</em>数据源的意义: 我感觉它主要意义是降低了数据源与项目的耦合度,数据源在服务器(比如<em>tomcat</em>)上<em>配置</em>,应用程序引用数据源就行。这样多个项目用同一个数据源时就不用一个一个地给项目复制粘贴相同的数据源,也
TOMCAT jdbc jndi问题
rn rn rn出现rn2008-5-5 9:30:38 org.apache.<em>tomcat</em>.util.digester.Digester fatalErrorrn严重: Parse Fatal Error at line 57 column 96: The reference to entity "characterEncoding" must end with the ';' delimiter.rnorg.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.rn at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)rn at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)rn at org.apache.<em>tomcat</em>.util.digester.Digester.parse(Digester.java:1562)rn at org.apache.catalina.startup.Catalina.load(Catalina.java:490)rn at org.apache.catalina.startup.Catalina.load(Catalina.java:524)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:267)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)rn请问 怎么解决?
jndi hibernate tomcat问题
今天弄了hibernate和<em>jndi</em>绑定弄了一天都没出来...大致要做点什么我是知道了rn首先在<em>tomcat</em> server.xml里加上rn rnrnrn rn factoryrn org.hibernate.SessionFactoryrn rnrn rn maxActivern 100rn rnrn rn maxIdlern 30rn rnrn rn maxWaitrn 1000rn rnrn rn usernamern rootrn rnrn rn passwordrn rn rnrn rn driverClassNamern com.mysql.jdbc.Driverrn rnrn rn urlrn jdbc:mysql://localhost:3306/sampledbrn rn rn rn我的项目名就是JNDI然后我对hibernate.cfg.xml<em>配置</em>如下rnrnrnrn rn org.hibernate.dialect.MySQLDialectrn rn rn java:/comp/env/jdbc/freedomrn rn truern rn rn rnrn rnrnrnrnrn在web.xml中加入了rn rn DB Connection rn jdbc/freedom rn javax.sql.DataSource rn Container rn rn然后表和持久化类都弄好了然后编了一个操作数据的类里面我创建sessionFactory是这样的rnContext ctx = new InitialContext();rnString <em>jndi</em>Name = "java:comp/env/jdbc/freedom";rnSessionFactory sessionFactory = (SessionFactory)ctx.lookup(<em>jndi</em>Name);this.session = sessionFactory.openSession(); rn然后下面编了个insertpublic void insert(Freedom f)rnTransaction tran = this.session.beginTransaction();rnthis.session.save(f);rntran.commit();rnthis.session.close();rn然后建了个servlet想测试一下然后它报错了错误如下java.lang.ClassCastException:org.apache.<em>tomcat</em>.dbcp.dbcp.BasicDataSource cannot be cast to org.hibernate.SessionFactory于是我想是不是type="javax.sql.DataSource"的原因然后我把它改成了type="org.hibernate.SessionFactory"结果报错如下javax.naming.NamingException: Cannot create resource instanceat org.apache.naming.factory.ResourceFactory.getObjectInstance如果我绕开hibernate是可以插入的所以我想<em>问题</em>应该就在sessionFactory上伐rn请哪位好心人帮我解答一下啊我太笨了rn
tomcat中的JNDI问题
在Tomcat 5.0\conf\Catalina\localhost下建立了gouwu.xml:rnrnrnrn rn rn rn urlrn jdbc:microsoft:sqlserver://localhost:1433;databasename=gouwurn rn rn passwordrn ysrn rn rn maxWaitrn 3000rn rn rn maxActivern 10rn rn rn driverClassNamern com.microsoft.jdbc.sqlserver.SQLServerDriverrn rn rn usernamern sarn rn rn maxIdlern 100rn rn rnrnrn并相应修改了WEB-INF下的web.xmlrn但测试时却显示:rnrnrnHTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnjavax.servlet.ServletException: Cannot create PoolableConnectionFactory, cause: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.rn org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)rn org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)rn org.apache.jsp.test_jsp._jspService(test_jsp.java:84)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rnrnrnroot cause rnrnorg.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory, cause: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.rn org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:825)rn org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)rn org.apache.jsp.test_jsp._jspService(test_jsp.java:57)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rnrnrnnote The full stack trace of the root cause is available in the Tomcat logs.
请教tomcatjndi问题
在google上搜索了很多网页,也没有发现一个详细的说明,大都是关于<em>datasource</em>的<em>jndi</em>rn介绍,但是关于其它资源(比如自己写的javabean)的<em>jndi</em>的介绍很少。<em>配置</em><em>datasource</em>的<em>jndi</em>没<em>问题</em>,但按照<em>tomcat</em>的文档里的介绍<em>配置</em>javabean的<em>jndi</em>,结果总是报Cannot create resource instance。rn哪位有这方面的经验,请指定一下!thanks
JNDI的问题[TOMCAT]
一般,要用数据库连接池,要不就在tomvat中的server.xml<em>配置</em>,加上一下<em>配置</em>信息,现在,我把这<em>配置</em>写了一个类,但是不知道要在web.xml中怎么<em>配置</em>了,能说说吗。rn下面是这个类:rn/*rn * 创建日期 2004-12-3rn *rn * TODO 要更改此生成的文件的模板,请转至rn * 窗口 - 首选项 - Java - 代码样式 - 代码模板rn */rnpackage com.sangchina;rnimport javax.servlet.*;rnimport javax.servlet.http.*;rnimport javax.naming.*;rnimport org.apache.commons.dbcp.*;rnrnrn/**rn rn *rn * TODO 要更改此生成的类型注释的模板,请转至rn * 窗口 - 首选项 - Java - 代码样式 - 代码模板rn */rnpublic class JndiDataSourceServlet extends HttpServletrn public void init(ServletConfig config) throws ServletExceptionrn rn String DBUrl = config.getInitParameter("DBUrl");rn if(DBUrl == null) DBUrl = "jdbc:mysql://localhost/jive";rn rn String Username = config.getInitParameter("Username");rn if(Username == null) Username = "root";rn rn String Password = config.getInitParameter("Password");rn if(Password == null) Password = "root";rn rn String DriverClassName = config.getInitParameter("DriverClassName");rn if(DriverClassName == null) DriverClassName = "org.gjt.mm.mysql.Driver";rn rn String MaxWaitStr = config.getInitParameter("MaxWait");rn if(MaxWaitStr == null) MaxWaitStr = "3000";rn long MaxWait = (new Long(MaxWaitStr)).longValue();rn rn String MaxIdleStr = config.getInitParameter("MaxIdle");rn if(MaxIdleStr == null) MaxIdleStr = "10";rn int MaxIdle = (new Integer(MaxIdleStr)).intValue();rn rn String MaxActiveStr = config.getInitParameter("MaxActive");rn if(MaxActiveStr == null) MaxActiveStr = "100";rn int MaxActive = (new Integer(MaxActiveStr)).intValue();rn rn String JndiName = config.getInitParameter("JndiName");rn if(JndiName == null) JndiName = "my_<em>datasource</em>";rn rn tryrn Context initCtx = (Context)new InitialContext();rn BasicDataSource bds = new BasicDataSource();rn rn bds.setUrl(DBUrl);rn bds.setUsername(Username);rn bds.setPassword(Password);rn bds.setDriverClassName(DriverClassName);rn bds.setMaxWait(MaxWait);rn bds.setMaxIdle(MaxIdle);rn bds.setMaxActive(MaxActive);rn initCtx.rebind(JndiName,bds);rn rn catch(Exception e)rn e.printStackTrace();rn rn rn //end init(ServletConfig config)rnrnrn环境是<em>tomcat</em>+hibernate+struts
tomcat JNDI 问题
在Servlet初始化方法中写下如下代码: rnContext ctx = (javax.naming.Context) new InitialContext().lookup("java:comp/env"); rnctx.rebind("mail/session", mailSession); rn//ctx.rebind("mail.session", mailSession); rnTOMCAT启动时出现的异常是“javax.naming.NamingException: Context is read only”,请问是为什么? rn如果TOMCAT的JNDI是只读的那么我要给mailSession加入Authenticator应该怎样<em>配置</em>?
JNDI tomcat
NULL 博文链接:https://cai-bird.iteye.com/blog/1958729
tomcat and jndi
请教各位:rn 由于<em>tomcat</em>4实现了<em>jndi</em>服务,缺省情况下为打开的,如何在启动TOMCAT4时关闭其JNDI服务。
数据源查找问题(DataSource ds = (DataSource) ctx.lookup(JNDI))?
我在容器里配了数据原JNDI,为什么查出来是Reference类型?请指教!!!
使用jndi和DataSource建立数据库连接?
运行出现下列异常rnNamingException caught in getConnected: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initialrnjava.lang.NullPointerExceptionrn at chapter15.ObjectExample1.main(ObjectExample1.java:59)rnException in main: nullrnrn//下面是获得DataSourcernInitialContext ctx = new InitialContext( );rnDataSource ds = (DataSource) ctx.lookup("objects");rnrn<em>jndi</em>.properties的内容: rnjava.naming.factory.initial=com.sun.<em>jndi</em>.rmi.registry.RegistryContextFactoryrnjava.provider.url=rmi://localhost:1099rn这个<em>jndi</em>.properties应该放在哪里啊rn
eclipse下面jndidatasource的调试
请问<em>tomcat</em>下用<em>jndi</em>的<em>datasource</em>连接方法,在ie上浏览是没有<em>问题</em>的rn但是在eclipse下面的main函数进行debug就不行,会出错,请问有什么办法解决,谢谢!
关于用jndi连接datasource问题
Hashtable env = new Hashtable (5);rnenv.put (Context.INITIAL_CONTEXT_FACTORY,rn"com.sun.<em>jndi</em>.fscontext.RefFSContextFactory");rnContext ctx = new InitialContext(env);rnDataSource ds = (DataSource)ic.lookup("jdbc/OracleDS");rnConnection con = ds.getConnection(username, password);rnrn问一下这里的"com.sun.<em>jndi</em>.fscontext.RefFSContextFactory"是做什么用的,rn另外就是lookup()里面应该写什么。rnrn这样写是不是就可以连接数据库了,还需要写些什么,最好能够提供例子。rnrn
关于jboss下mysql dataSource的JNDI命名问题……
在jboss创建了一个mysql数据源rnMySqlDSrn然后发现在启动jboss的时候rn这个数据源自动绑定成java:/MySqlDSrn而不是java:comp/env/jdbc/MySqlDSrn用java:comp/env/jdbc/MySqlDS也找不到……rn高手能不能告诉我如何才能用java:comp/env/jdbc/MySqlDS找到数据源?rn难道非要我把MySqlDSrn改成comp/env/jdbc/MySqlDS才行?rn感觉有点<em>问题</em>rn业务逻辑层和数据持久层的JNDI查找方式rn与rn业务逻辑层和表示层的JNDI查找方式rn似乎不太一样……
websphere上的jndi查找DataSource的问题
IBM WebSphere Application Server - Express 6.0.0.1rnDB2 8.1rnrntryrnrn Hashtable env = new Hashtable();rn env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");rn env.put(Context.PROVIDER_URL,"iiop://192.168.3.144:2809");rnrn Context ctx = new InitialContext(env);rn DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/db2test");rnrn c=ds.getConnection();rnrn-----------------------------------------------------------------rnjava.lang.NoClassDefFoundError: com/ibm/ejs/ras/Trrn at com.ibm.websphere.naming.WsnInitialContextFactory.(WsnInitialContextFactory.java:70)rn at java.lang.Class.forName0(Native Method)rn at java.lang.Class.forName(Class.java:219)rn at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)rn at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)rn at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)rn at javax.naming.InitialContext.init(InitialContext.java:219)rn at javax.naming.InitialContext.(InitialContext.java:195)rn at mypro.Dbtest2.main(Dbtest2.java:33)rnException in thread "main" rnrnrn我已经加进了,ecutils.jar\j2ee.jar\naming.jar\namingclient.jar 四个包了,是什么<em>问题</em>呢?rn是我加进jar出<em>问题</em>吗?rnrn请各位帮帮我吧,可以的话给我个例子也好,先谢了...rnmerlin8866@163.com
Struts 配置DataSource的问题
连的是MS sql 2000rn打了sp4补丁 rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnActionrn...rnrn DataSource ds=null;rn Connection con=null;rn tryrn rn System.out.println("开始执行 1");rn ds=getDataSource(request);rn con=ds.getConnection();rn System.out.println("成功");rn rn catch(Exception e)rn rn System.out.println("异常"+e);rn rn rnrn...rnrn结果是启动服务器就报一个错rnCaused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=HD;SelectMethod=cursor'rnrn运行的话是什么都没有 希望大家帮帮忙rn
spring 配置dataSource问题
今天练习了下spring2.5如何连接数据库增删改查的东东,但有个dataSource的坎一直过不去,望哪位兄台帮忙分析下。rnrn<em>配置</em>文件如下:rnrn...rnrnrn/WEB-INF/jdbc.propertiesrnrnrnrnrnrn$database.driverrnrnrn$database.urlrnrnrn$database.userrnrnrn$database.passwordrnrnrn...rnrnrn部署到<em>tomcat</em>e的时候报错:rnrn严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerrnorg.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in ServletContext resource [/WEB-INF/training-service.xml]: Could not resolve placeholder 'database.url'rn at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:268)rn at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)rn at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:553)rn at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:527)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:362)rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)rn at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)rn at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)rn at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)rn at java.lang.Thread.run(Thread.java:619)rnrn实在是不知道哪出错,是连接不到数据库吗?还是<em>配置</em>文件哪配错了? 谢啦!
struts配置datasource问题
小弟初学struts请大家多关照rn 我的应用在还没有<em>配置</em>struts中的<em>datasource</em>前还可以正常运行,但是我要<em>配置</em>了<em>datasource</em>元素后就出现Servlet action is not available错误,如果我将<em>datasource</em>注悉掉错误就消失。rn 事实上我在应用中根本没有使用<em>datasource</em>数据源,甚至连数据库都没有使用。但还是有同样的<em>问题</em>。
tomcat容器外怎样通过jndi调用datasource
Hi,rn我在<em>tomcat</em>5.5中已经<em>配置</em>好连接池,在jsp中调用ok;rn如果我想在容器外(一个普通的应用程序)调用,可以吗?rn如果可以:rnProperties pro = new Properties();rnpro.put(Context.INITIAL_CONTEXT_FACTORY,"类名");rnpro.put(Context.PROVIDER_URL,路径);rnContext ctx = new InitialContext(pro); rn上的类名和路径该怎样填?
tomcat是怎样将datasource添加到jndi的context中去的?
我们在webapps的和web.xml中做相应<em>配置</em>就可以在jsp或servlet中通过<em>jndi</em>得到DataSource从而得到数据库的Connection。但是<em>tomcat</em>在启动时是怎样将<em>datasource</em>添加到<em>jndi</em>的context中去的呢?rn 我们能通过lookup("java:comp/env/XXX")来得到DataSource,能不能通过rnlookup("ZZZ:GGG/YYYY/XXX")来得到DataSource?rn 我通过打印相关信息知道<em>tomcat</em>中通过jdni得到的DataSource是org.apache.commons.dbcp.BasicDataSource,它可以用在一般的java应用程序中,但怎样将它和<em>jndi</em>联合起来使用?rn 请大家帮忙解答,多谢!
配置jndi时的问题
当我进入<em>jndi</em>登陆页面时,我的<em>tomcat</em>的dos界面显示:严重invalid path was requested /loginrn请各位朋友告诉我这是怎么回事,我该怎么解决,谢谢。
Cannot obtain a DataSource through JNDI for internal TomCat
hi, rnrnI'm running a web application on JBuilder / Tomcat 4.1 / JDK1.3.1 / J2EE 1.3.1. rnrnI'm trying to obtain a DB connection from a DataSource, but I can't seem to JNDI-lookup the DataSource. I've tested obtaining a Connection using the "DriverManager way" and it works. rnrnThis is the code on my server8080.xml file: rnrn rn rn rn rn rn rn rn rn rn rn rn rnusername rn**** rn rn rnpassword rn**** rn rn rndriverClassName rnrnoracle.jdbc.driver.OracleDriver rn rn rnurl rnrn rnjdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS rn rn rn rn rn rn rn rn rnrnrnThis is the code in my web.xml file: rnrn rn rn rnTesting rn rndebugjsp rnAdded to compile JSPs with debug info rnorg.apache.jasper.servlet.JspServlet rn rnclassdebuginfo rntrue rn rn3 rn rn rndebugjsp rn*.jsp rn rn rnResource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. rnjdbc/SGC_CNID rnjavax.sql.DataSource rnContainer rn rn rnrnrnThis is the java code: rnrnrnContextWrapper ctxW = Globals.getContextWrapper();rnContext ctx = ctxW.getContext();rnrnString dsName = "jdbc/SGC_CNID";rnrntry rnDataSource ds = (DataSource) ctx.lookup(dsName);rnreturn ds.getConnection();rn catch (NamingException ne) rnthrow new UselessResourceException("No se puede recuperar el DataSource '"+dsName+"'.", ne);rn catch (SQLException sqle) rnthrow new UselessResourceException("ERROR: No se puede obtener una Connection del DataSource '"+dsName+"'.", sqle);rnrnrnrnctxW.getContext() (successfully finds and) returns the "java:comp/env" entry, restored by the following piece of code: rnrntry rnContext initCtx = new InitialContext();rnContext envCtx = (Context) initCtx.lookup("java:comp/env");rnthis.setContext(envCtx);rn catch (NamingException ne) rnthrow new LinkedRuntimeException("No se pudo construir el Context Wrapper.", ne);rnrnrnrnrnWHAT'S HAPPENING HERE???rnrnTHANKS EVERYBODY!rn
Web项目开发环境中运行在Tomcat时涉及到JNDI的Datasource的解决方法
通常在J2EE的开发中,需要用到在服务器上通过JNDI<em>配置</em>的Datasource,如最后的应用在Weblogic上运行,而在开发环境的本地机器中可能是Tomcat,这时候需要在Tomcat上<em>配置</em>一个Datasource,在网上看到很多人的解决办法都是改Tomcat运行环境的server.xml 或者context.xml,其实最简单的办法是在项目的META-INF目录里加入一个context.x...
JNDI学习总结(三)——Tomcat下使用Druid配置JNDI数据源
JNDI学习总结(三)——Tomcat下使用Druid<em>配置</em>JNDI数据源   com.alibaba.druid.pool.DruidDataSourceFactory实现了javax.naming.spi.ObjectFactory,可以作为JNDI数据源来<em>配置</em>。 一、下载Druid的jar包   下载地址:http://mvnrepository.com/artifact/com
jboss 配置jndi问题
我用的是jboss-4.0.2rn我在JBOSS_HOME\server\default\deploy 下建hello.jar\hello\ejb的目录,在hello.jar\hello\ejb下有若干class和目录META-INF,META-INF下有jboss.xml,ejb-jar.xmlrn其中jboss.xml:rnrnrnrnrnrnHellornHellornrntruernrnrnrnrnrnejb-jar.xml:rn rnrn rnThis is Hello EJB example rnhelloeEJB rn rn rnHello rnHello rnhello.ejb.HelloHome rnhello.ejb.Hello rnhello.ejb.HelloEjb rnStateless rnBean rn rn rn rn现在有两个<em>问题</em>:rn1.META-INF下的jboss.xml我看有的文档说是jboss-service.xml,不知到底应该是哪个文件名rn2.通过servlet调用ejb,http://127.0.0.1:8080/hello/HelloServletrn 出错:javax.servlet.ServletException: javax.naming.NameNotFoundException: Hello not boundrn 其中HelloServlet的代码如下,请问是什么原因,谢谢rnHelloServlet.javarnimport javax.servlet.http.*;rnimport javax.servlet.*;rnimport java.io.*;rnimport javax.ejb.*;rnimport javax.naming.InitialContext;rnimport javax.naming.Context;rnimport java.util.*;rnimport hello.ejb.*;rnrnpublic class HelloServlet extends HttpServletrn rn private HelloHome home;rn rn public void init() throws ServletExceptionrn rn try rn rn String initCtxFactory = getInitParameter(Context.INITIAL_CONTEXT_FACTORY);rn String providerURL = getInitParameter(Context.PROVIDER_URL);rn Properties env = new Properties();rnrn if(initCtxFactory!=null)rn rn env.put(Context.INITIAL_CONTEXT_FACTORY,initCtxFactory);rn rnrn if(providerURL!=null) rn rn env.put(Context.PROVIDER_URL,providerURL);rn rnrn Context ctx=new InitialContext(env);rn Object objRef = ctx.lookup("Hello");rn // 主接口 rn home=(HelloHome)javax.rmi.PortableRemoteObject.narrow(objRef,hello.ejb.HelloHome.class); rnrn catch(javax.naming.NamingException ne)rn rn System.out.println("Create Exception caught:"+ne);rn throw new ServletException(ne.toString());rn rn catch(Exception e)rn rn throw new ServletException(e.toString());rn rnrn rnrnpublic void service(HttpServletRequest req,HttpServletResponse res) throws IOException rn rn res.setContentType("text/html");rn PrintWriter out =res.getWriter();rn out.println(" the first EJB");rn rn tryrn rn Hello bean =home.create();rn out.println(bean.GetHello()+" ");rn out.println("your name is "+myname+" ");rn out.println("your sex is "+mysex+" ");rn rn catch(javax.ejb.CreateException ce)rn rn out.println("Create Exception caught:"+ce);rn ce.printStackTrace(out);rn rn catch(java.rmi.RemoteException re)rn rn out.println("Remote Exception caught:"+re);rn re.printStackTrace(out);rn rn out.println(""); rn out.close();rn rnrn rnrn
100分请帮忙解决tomcat配置datasourcejndi)mysql的问题
<em>tomcat</em>:server.xmlrn......rnrn rn rn rn rn factoryrn org.apache.commons.dbcp.BasicDataSourceFactoryrn rn rn rn urlrn jdbc:mysql://10.0.1.165:3306/quickstart?useUnicode=true&characterEncoding=GB2312;autoReconnect=truern rn rn driverClassNamern com.mysql.jdbc.Driverrn rn rn usernamern rootrn rn rn passwordrn 111222rn rn rn rn maxWaitrn 3000rn rn rn maxIdlern 100rn rn rn maxActivern 10rn rn rn rn.......rnJSP页面:testjdbc.jsprnrnrnrnrnrn是不是我的<em>配置</em>有<em>问题</em>啊?我看了很多文章都是这样的啊.
望指教tomcat 如何配置datasource???
望指教<em>tomcat</em> 如何<em>配置</em><em>datasource</em>???
请高手指点,配置Tomcat的DataSource错误
在jbuilder9自带的Tomcat4.1.24的config.xml中如下设置rn rn rnrn rn rn factory rnrn org.apache.commons.dbcp.BasicDataSourceFactoryrn rn rn driverClassName rncom.microsoft.jdbc.sqlserver.SQLServerDriverrn rnrn url jdbc:microsoft:sqlserver://localhost:1433;databaseName=pubsrn rn rn usernamern sarn rn rn passwordrn rn rn rn maxActivern 20rn rn rn maxIdlern 20rn rn rn maxWaitrn -1rn rn rn rnrn在Jbulder运行到rnds= (DataSource) ctx.lookup("java:comp/env/jdbc/SQLServer");停止rn提示如下错误:rnName jdbc is not bound in this Contextrn
tomcat里怎么配置DataSource?例如oracle?
as title
Datasource配置
Datasource<em>配置</em>介绍 word文档形式
tomcat 5.5 中 JNDI 配置(连oracle数据库)
[b]1,加驱动[/b] 把 [color=red]ojdbc14.jar [/color]复制到 <em>tomcat</em>下[color=red] /common/lib [/color]包中 [b]2,<em>tomcat</em>中配数据源[/b] 打开<em>tomcat</em>下 [color=red]/conf/context.xml [/color],贴入如下信息: [code=&quot;xml&quot;] [...
急~!多谢大侠~!TOMCAT中配置JNDI
大侠们,小弟现在正在探索WEBWORK,准备做个小例子,把一个表单中的数据存入数据库中(SQLServer2000),可惜才疏学浅,听高人指点说要在服务器中<em>配置</em>JNDI(ME 的服务器是TOMCAT),小弟对JNDI尚未了解,更不用说<em>配置</em>了。如果哪位大侠不太忙的话请给俺讲讲何为JNDI,如果没时间的话就请直接把TOMCAT中<em>配置</em>JNDI的方法告诉俺~!多谢各位大侠了~!~!小弟这乡有理了~!
关于Tomcat下配置Proxool连接池的JNDI
请问在Tomcat5下,怎么<em>配置</em>proxool的JNDI,使我可以通过Context.lookup 来查找rnrn默认的proxool要通过DriverManager.getConnection来得到连接。在网上找了很久也没找到好的解决方案,哪位知道的话请不吝指教。
tomcat及jboss下配置jndi连oracle数据库
一.jboss下 1.将驱动ojdbc14.jar拷贝到D:\jboss-4.0.5.GA\server\default\lib下。 2.在D:\jboss-4.0.5.GA\server\default\deploy下创建oracle-ds.xml文件,内容如下: jdbc/aaa jdbc:oracle:thin:@10.20.130.210:...
Resin和Tomcat的JNDI数据连接池配置
先说Resin的JNDI数据池连接<em>配置</em>(Resin版本3.1) 有两个地方可以共你设置 1, Resin 下的conf/resin.conf 里有这一部分 ,很明显告诉你在这设置: &amp;lt;!-- - Sample database pool configuration - - The JDBC name is java:comp/env/jdbc/test &amp;lt;database&amp;gt...
JAVA tomcat 配置jndi而且使用c3p0连接池
<em>配置</em>MYSQL 的JNDI采取的方式时再META-INF文件夹下创建context.xml<em>配置</em>应用的<em>jndi</em>。优点每个应用独立JNDI. <em>配置</em>文件及其步骤如下: 1、META-INF中创建 org.apache.naming.f
Tomcat 6.0配置数据源(DBCP)和JNDI使用
NULL 博文链接:https://sailinglee.iteye.com/blog/480715
tomcat 连接池配置整理 (JNDI C3P0)
   简单的归纳整理一下各种几种连接池的<em>配置</em>方式 以便查询     系统<em>配置</em>:spring2 , <em>tomcat</em>6 ,hibernate3,mysql   spring的版本比较低 各位看官不要笑话哦。 1.普通的JDBC连接方式 &amp;lt;bean id=&quot;dataSource&quot; class=&quot;org.springframework.jdbc.<em>datasource</em>.DriverM...
【中间件】Tomcat下配置JNDI数据库连接池并使用
[size=medium]本文转自:http://www.blogjava.net/liver/archive/2009/05/31/279309.html 一、<em>配置</em>JNDI数据源 这一步有几种<em>配置</em>方式,比如直接修改Tomcat/conf/server.xml文件,但这样修改是全局的,个人不太喜欢这样的方式,本着的原则是能不全局就不全局,以保证项目能够尽量少的影响到其他项目,尽量少的进行修改。...
用HIBENATE学生成绩管理系统下载
文本文档 HIBERNATE 学生成绩管理系统 相关下载链接:[url=//download.csdn.net/download/boldrita/2455417?utm_source=bbsseo]//download.csdn.net/download/boldrita/2455417?utm_source=bbsseo[/url]
联想A360 Root教程下载
联想A360 Root教程,适合联想A360手机的root权限的获得。 相关下载链接:[url=//download.csdn.net/download/u010002060/5172610?utm_source=bbsseo]//download.csdn.net/download/u010002060/5172610?utm_source=bbsseo[/url]
论文检测系统免费下载
专业的论文检测查重系统,小编整理发布提供大家免费下载。亲们多多支持哦 相关下载链接:[url=//download.csdn.net/download/qq512267704/5387073?utm_source=bbsseo]//download.csdn.net/download/qq512267704/5387073?utm_source=bbsseo[/url]
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数
我们是很有底线的