Configure Tomcat data source (DB2) in Linux)

Source: Internet
Author: User

When you configure the Tomcat data source (DB2) in Linux, the data source configuration is as follows:

Conf \ Server. xml:

<Globalnamingresources>

<! -- Test entry for demonstration purposes -->
<Environment name = "simplevalue" type = "Java. Lang. Integer" value = "30"/>

<! -- Editable user database that can also be used
Userdatabaserealm to authenticate users -->
<Resource Name = "userdatabase" auth = "Container"
Type = "org. Apache. Catalina. userdatabase"
Description = "user database that can be updated and saved"
Factory = "org. Apache. Catalina. Users. memoryuserdatabasefactory"
Pathname = "CONF/tomcat-users.xml"/>
<Resource driverclassname = "com. IBM. db2.jcc. db2driver "maxactive =" 4 "maxidle =" 2 "maxwait =" 5000 "name =" defaultdatasource "Password =" 123456 "type =" javax. SQL. datasource "url =" JDBC: DB2: // 127.0.0.1: 50000/zxdb "username =" db2admin "/>
</Globalnamingresources>

Conf \ context. xml:

<Context>

<! -- Default set of monitored resources -->
<Watchedresource> WEB-INF/Web. xml </watchedresource>
 
<! -- Uncomment this to disable session persistence resume SS Tomcat restarts -->
<! --
<Manager pathname = ""/>
-->
<Resourcelink global = "defaultdatasource" name = "defaultdatasource" type = "javax. SQL. datasource"/>
</Context>

The error message is as follows:

Message: No data source named ''{0}'' is found. (The datasource

Name 'default' cannot get connection !)
At

Com. primeton. Common. Connection. impl. datasource. Ext. unconfirmedd

Atasource. getdatasource (unconfirmeddatasource. Java: 83)
At

Com. primeton. Common. Connection. impl. datasource. Ext. unconfirmedd

Atasource. getconnection (unconfirmeddatasource. Java: 124)

Resolve db2jcc. jar, db2jcc_license_cisuz.jar, db2jcc_license_cu.jar, and JTA. Jar (Java. Lang. noclassdeffounderror: javax/transaction/usertransaction)
4 jar packages, put them in the common \ lib directory of Tomcat, and then restart the service.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.