Context envCtx = (Context) initCtx.lookup("java:comp/env");
修改成
Context envCtx = (Context) initCtx.lookup("java:/comp/env");
修改成
Context envCtx = (Context) initCtx.lookup("java:/comp/env");
解决方案 »
- 多线程访问数据库问题
- 端口重复,使用http://localhost:8080/xxx能访问,使用http://ip:8080/xxx不能访问,二者区别是啥?
- 一个简单而又奇怪的模拟HTTP POST问题,望伸出援助之手~~
- 打印功能
- hibernate级联删除
- java连接SQL SERVER 数据库??
- 用dom4j里面Document.selectNodes()不好用呢![求助]
- 我用的WEBLOGIC7,其自带SQLSERVER的jdbc driver不支持jdbc2.0的方法,请问谁有 JDBC2.0 driver
- weblogic services和web services有什么区别啊?
- 有状态的会话BEAN的状态体现在哪一方面?
- 请帮忙修改简单的Schema
- 求救!!为什么在struts中删除记录老是删除到最后一个
谢谢大家的帮助
一般来说TOMCAT配连接池要分成两步。
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
<!-- Global JNDI resources -->
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams> </GlobalNamingResources>
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Catalina"> <Connector
port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
<Connector port="8009"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3" />
<Engine name="Catalina" defaultHost="localhost" debug="0">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
</Host>
</Engine>
</Service>
</Server>
谢谢了。
server.xml中的 <GlobalNamingResources>节点中增加了
<Resource name="jdbc/gc" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/gc">
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@192.100.10.245:1521:gcrc</value>
</parameter>
....... 使用http://localhost:8080/manager/resources?type=javax.sql.DataSource 命令得到了Resource 中有jdbc/gc.
但是仍然是同样的报错。
2005-03-30 17:37:22 NamingContextListener[/Catalina/localhost/car]: Resource parameters for jdbc/gc = ResourceParams[name=jdbc/gc, parameters={url=jdbc:oracle:thin:@192.168.10.245:1521:gcrc, validationQuery=select * from login, maxIdle=30, maxActive=10, driverClassName=oracle.jdbc.driver.OracleDriver, maxWait=10000, username=gc, factory=org.apache.commons.dbcp.BasicDataSourceFactory, password=gc}]
2005-03-30 17:37:22 NamingContextListener[/Catalina/localhost/car]: Adding resource ref jdbc/gc
2005-03-30 17:37:22 NamingContextListener[/Catalina/localhost/car]: ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shareable},{type=url,content=jdbc:oracle:thin:@192.168.10.245:1521:gcrc},{type=validationQuery,content=select * from login},{type=maxIdle,content=30},{type=maxActive,content=10},{type=driverClassName,content=oracle.jdbc.driver.OracleDriver},{type=maxWait,content=10000},{type=username,content=gc},{type=factory,content=org.apache.commons.dbcp.BasicDataSourceFactory},{type=password,content=gc}]
2005-03-30 17:37:22 NamingContextListener[/Catalina/localhost/car]: Resource parameters for UserTransaction = null
2005-03-30 17:37:22 StandardContext[/car]action: Loading application resources from resource ApplicationResources
2005-03-30 17:37:22 StandardContext[/car]action: Initializing configuration from resource path /WEB-INF/struts-config.xml
factoryClassLocation=null 是说明我的oracle jdbc驱动文件不正确吗?我已经将在$TOMCAT_HOME/common/lib. 下copy Oracle9的jdbc驱动程序classes12.jar classes111.jar谢谢!各位高手指点。
不过谢谢大家的帮助