Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DatasourceRealm Tomcat 6 configuration: Name jdbc is not bound in this Context

I'm configuring a DatasourceRealm in Tomcat 6 configuring everything in META-INF/context.xml. web.xml seems to be configured correctly since login prompt is showing up.

Can someone help?

context.xml

<Context >
    <Resource name="jdbc/auth" description="authentication" type="javax.sql.DataSource"
        auth="Container" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
        maxActive="25" maxIdle="10" maxWait="10000"
        url="jdbc:sqlserver://SQLSERVER;databaseName=db;integratedSecurity=true"
        validationQuery="select 1" />
    <Realm className="org.apache.catalina.realm.DataSourceRealm"
        dataSourceName="jdbc/auth" userTable="WebUsers" userNameCol="username"
        userCredCol="password" userRoleTable="WebUserRoles" roleNameCol="role" 
        localDataSource="true"/>
</Context>

Stack

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

like image 774
J T Avatar asked Nov 24 '22 22:11

J T


1 Answers

I figured out the issue. Under $CATALINA_BASE\conf\Catalina\localhost, there was another [App Name].xml file that was older (it did not have the localDatasource="true" flag) and did not have the same configuration I posted. I removed that file and redeployed my war. It worked after that.

like image 168
J T Avatar answered Nov 26 '22 12:11

J T