5

我正在配置Tomcat 6DatasourceRealm中的所有内容。似乎配置正确,因为出现了登录提示。META-INF/context.xmlweb.xml

有人可以帮忙吗?

上下文.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>

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

4

2 回答 2

1

我弄清楚了这个问题。在 $CATALINA_BASE\conf\Catalina\localhost 下,还有另一个较旧的 [App Name].xml 文件(它没有 localDatasource="true" 标志)并且没有我发布的相同配置。我删除了那个文件并重新部署了我的战争。在那之后它起作用了。

于 2013-05-24T16:41:52.373 回答
-1

While doing the deployment we encountered the issue as seen below. We presumed at first it was an issue with setenv.sh and conpass file (this is where the properties files and passwords are consolidated), however, after redeploying each file one at a time we isolated the problem to MasterFile that was causing the issue. More specifically, the issue in itself was a false indicator because there was nothing actually wrong with coding or deployment in itself. The issue was thrown because we had backup MasterFile directories within the Tomcat webapps directory. In doing so, it created the following SEVERE error:

SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in ServletContext resource [/WEB-INF/beans.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/CRIDB] is not bound in this Context. Unable to find [jdbc].
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338).

The error was thrown was because we had multiple directories in place and when bringing up the server tomcat was trying to read each one. Once we removed the backup MasterFile directories the issue was resolved

于 2014-11-08T19:36:52.753 回答