вторник, 13 апреля 2010 г.

Lack of documentation or "Name jdbc is not bound in this Context"

If you get the "Name jdbc is not bound in this Context" exception with Realm configured in your context.xml you have configure Realm with localDataSource="true" to achive the desirable result

<Context path="/webshopwicket" docBase="/npa/jewelry" crossContext="true">

<Resource auth="Container" name="mail/Session" type="javax.mail.Session"/>

<Resource name="jdbc/npajndi"

auth="Container"
scope="Shareable"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"

maxWait="10000"
removeAbandoned="true"
username="root"
password=""
driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://localhost/npa?AutoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8"
/>



<Realm className="org.apache.catalina.realm.DataSourceRealm" debug="4"

localDataSource="true"
dataSourceName="jdbc/npajndi"
userTable="TMANAGER"
userNameCol="email"
userCredCol="password"

userRoleTable="TMANAGERROLE"
roleNameCol="code"/>



</Context>