tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 东志 陈 <grape...@hotmail.com>
Subject Problem about jini datasourec.
Date Thu, 15 Jan 2004 03:03:41 GMT

I want to use jini datasource,the old code as follow work normally:

=======work normally 
code============================================================================================

               
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); //注册数据库
驱动
               conn = DriverManager.getConnection(
               
"jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=travelsky;selectMethod=cursor;",

               "sa", "mypassword");
 
===================================================================================================

 
    
 but after i config the server.xml and web.xml,change the code,the web 
application crash,
 the "work unnormally code" , the "exception",the "server.xml" and the 
"web.xml" as follow:  
              
 ======work unnormally 
code=============================================================================================

             
               Context initContext = new InitialContext();
               Context envContext  = 
(Context)initContext.lookup("java:/comp/env");
               DataSource ds = 
(DataSource)envContext.lookup("jdbc/tomcat_sqlServer");
               conn = ds.getConnection();
===================================================================================================


=====exception=======================================================================================

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:194)
	at travelsky.db.DataBean.setConnection(DataBean.java:68)
	at travelsky.db.DataBean.executeQueryCount(DataBean.java:342)
	at org.apache.jsp.login$jsp._jspService(login$jsp.java:107)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)

	at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)

	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)

	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

	at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)

	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

	at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)

	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)

	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)

	at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)

	at java.lang.Thread.run(Thread.java:536)
javax.naming.NamingException: Exception creating DataSource: 
tyrex/jdbc/xa/EnabledDataSource
===================================================================================================


=====server.xml==============================================================================

<?xml version="1.0" encoding="UTF-8"?>
<Server debug="0" port="8081" shutdown="SHUTDOWN">
  <Service name="Tomcat-Standalone">
    <Connector acceptCount="10" 
className="org.apache.catalina.connector.http.HttpConnector" 
connectionTimeout="60000" debug="0" maxProcessors="75" minProcessors="5" 
port="8080"/>
    <Engine debug="0" defaultHost="localhost" name="Standalone">
      <Host appBase="D:\cdz_prj_OA\1112\travelsky\Tomcat\webapps" debug="0" 
name="localhost" unpackWARs="true">
        <Context debug="0" 
docBase="D:\cdz_prj_OA\1112\travelsky\defaultroot" path="" 
reloadable="true" workDir="D:\cdz_prj_OA\1112\travelsky\Tomcat\work"/>
        
        <Context debug="0" 
docBase="D:\cdz_prj_OA\1112\travelsky\travelskyApp" path="/travelskyApp" 
reloadable="true" 
workDir="D:\cdz_prj_OA\1112\travelsky\Tomcat\work\travelskyApp">
         <Resource name="jdbc/tomcat_sqlServer" auth="Container"
              type="javax.sql.DataSource"/>
			<ResourceParams name="jdbc/tomcat_sqlServer">
				  <parameter>
				    <name>factory</name>
				    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
				  </parameter>
				  <parameter>
				    <name>driverClassName</name>
				    <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
				  </parameter>
				  <parameter>
				    <name>url</name>
				    
<value>jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=travelsky;selectMethod=cursor;</value>

				  </parameter>
				  <parameter>
				    <name>username</name>
				    <value>www_user</value>
				  </parameter>
				  <parameter>
				    <name>password</name>
				    <value>www_user</value>
				  </parameter>
				  <parameter>
				    <name>maxActive</name>
				    <value>200</value>
				  </parameter>
				  <parameter>
				    <name>maxIdle</name>
				    <value>60</value>
				  </parameter>
				  <parameter>
				    <name>maxWait</name>
				    <value>-1</value>
				  </parameter>
			</ResourceParams>
		</Context>
      </Host>
    </Engine>
  </Service>
</Server>
===================================================================================================


=====web.xml=======================================================================================

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <servlet>
    <servlet-name>debugjsp</servlet-name>
    <description>Added to compile JSPs with debug info</description>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
      <param-name>classdebuginfo</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>debugjsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
  </servlet-mapping>
  <resource-ref>
    <description>travelskyApp sqlServer DataResource</description>
    <res-ref-name>jdbc/tomcat_sqlServer</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
</web-app>
===================================================================================================


I thank you for your guidance. thanks much and sorry for the trouble.

cdzerg

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com  


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message