俺搜索了好多,好象都没有配置成功!请教大虾 问题在何出??

menghuanlang 2005-01-14 10:11:52
我用的是jbx.集成的tomcat是jakarta-tomcat-4.0.6-LE-jdk14.
现在我用tomcat自带的数据源配置了一个连接orcale的数据源,可是出现问题了,这个配置问题我基本上都是按网上说的配置的..可仍然不成功,有望大虾指教!

我的server.xml配置如下:
<!-- Tomcat Root Context -->
<!---->
<Context path="" docBase="ROOT" debug="0" />
<Resource name="jdbc/myDS" auth="Container"
type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/myDS">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>

<parameter>
<name>user</name>
<value>mhuangtest</value>
</parameter>

<parameter>
<name>password</name>
<value>mhuangtest</value>
</parameter>

<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>

<parameter>
<name>driverName</name>><!--url-->
<value>jdbc:oracle:thin:@192.168.20.145:1521:temp</value>
</parameter>

<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>

<parameter>
<name>maxIdle</name>
<value>20</value>
</parameter>

</ResourceParams>

</Context>

我的web.xml配置如下:
<resource-ref>
<res-ref-name>jdbc/myDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

我启动了tomcat,然后我的测试代码如下:
Context ctx = null;
DataSource source = null;
ctx = new InitialContext();
source = (DataSource) ctx.lookup("java:comp/env/jdbc/myDS");
Connection conn = source.getConnection();

报的异常如下:
TyrexDataSourceFactory: Cannot create DataSource, Exception
java.lang.NoClassDefFoundError: tyrex/jdbc/xa/EnabledDataSource
at org.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexDataSourceFactory.java:166)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:164)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at cn.com.netkiss.mhuang.test.ClassA.ByTomcatDataSource(ClassA.java:77)
at cn.com.netkiss.mhuang.test.ClassA.test(ClassA.java:142)
at myproject.ConfigServlet.init(ConfigServlet.java:22)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3279)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3421)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at org.apache.catalina.core.StandardService.start(StandardService.java:388)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)javax.naming.NamingException: Exception creating DataSource: tyrex/jdbc/xa/EnabledDataSource
at org.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexDataSourceFactory.java:233)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:164)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)

...全文
92 9 点赞 打赏 收藏 举报
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
vvfish119 2005-01-14
<Context docBase="D:\aa\web" path="/aa">
<Resource name="jdbc/Dspower" scope="Shareable" type="javax.sql.DataSource" auth="Container"/>
<ResourceParams name="jdbc/Dspower">
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<value>30</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@192.168.0.204:1521:main</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>4</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>200</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>3000</value>
</parameter>
<parameter>
<name>username</name>
<value>bisarea</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>password</name>
<value>bisarea</value>
</parameter>
</ResourceParams>
</Context>
  • 打赏
  • 举报
回复
menghuanlang 2005-01-14
晕哦...怎么还没有人解答啊?
  • 打赏
  • 举报
回复
menghuanlang 2005-01-14
什么类路径?
class12.jar ???
我这个驱动我在jb的配置libraries已经加过了啊,并且已经加到工程里了啊!
如果是这个没有加的话,应该报的是Cannot find Dirver的异常啊!
  • 打赏
  • 举报
回复
menghuanlang 2005-01-14
谢谢UP..

:( 可问题还没有解决啊!
  • 打赏
  • 举报
回复
nouveau 2005-01-14
有些类路径没有加进去吧
  • 打赏
  • 举报
回复
不徻写代码 2005-01-14
up
  • 打赏
  • 举报
回复
menghuanlang 2005-01-14
有人解答吗?
我在线等啊!!
  • 打赏
  • 举报
回复
menghuanlang 2005-01-14
晕哦...到现在还没有人帮我解决!!
  • 打赏
  • 举报
回复
以梦为马 2005-01-14
友情UP。
  • 打赏
  • 举报
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2005-01-14 10:11
社区公告
暂无公告