Goes to the company not want to work overtime to do so took them back home to do a demo project, put a good SQLSERVER2005, import the project, with the company's existing connection pool configuration xml files you renamed in change ready to start, did not think Tomcat startup actually reported wrong:
Cannot create JDBC driver of class''for connect URL 'null'
xml configuration files used in the company's Haohao De ah, online to find a solution, there is said to change server.xml, there are said to change references in the web.xml inside Canada, there are said to be in the META-INF folder Construction context.xml, and all tried again, still reported the same error. Later, according to an article that, in Tomcat's Admin page in with the data source, then modify the server.xml, in the localhost folder, press articles added to the sample project xml file, also web.xml Riga reference, start Tomcat, actually become. Carefully checked and found examples of the localhost folder of xml and xml using different company:
<Context docBase="Y:\MyEclipse 6.6\workspace\aaaaaaa\docroot" path="/aaaaaaa" reloadable="false"> <Resource name="com.dayang.datasource.imam" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="com.dayang.datasource.imam"> <parameter> <name>username</name> <value>sa</value> </parameter> <parameter> <name>password</name> <value>aaaa</value> </parameter> <parameter> <name>driverClassName</name> <value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:sqlserver://127.0.0.1:1433;DatabaseName=bbbbb;SelectMethod=cursor</value> </parameter> </ResourceParams> </Context>
<?xml version="1.0" encoding="UTF-8"?> <Context docBase="Y:\MyEclipse 6.6\workspace\aaaaaaa\docroot" path="/aaaaaaa" reloadable="false"> <Resource name="com.dayang.datasource.dyusermanager" type="javax.sql.DataSource" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=bbbbb;SelectMethod=cursor" password="aaaa" username="sa"/> </Context>
The difference is that the company's data source configuration properties written in <ResourceParams>, the sample was directly as <Resource> properties.
Server.xml file and then tried to <GlobalNamingResources> deleted in the data source configuration, web.xml in the data source reference to be deleted, META-INF context.xml inside also deleted, as the company's environment on did these things, restart Tomcat, actually can be used normally. It seems the data source only works in localhost established under the corresponding xml file on the line, but must pay attention to the data source property should be written in the Resource element.
Do not know why the company's xml file at home, not take, it may be that the local Mo configuration on it, and now the method may not Guifan, regardless of the first, Neng up Jiu-line at home Pao:)