我已经下载了 Apache Isis 的简单应用原型 1.15.0。我想按照这个文档将它与 Apache Shiro 集成。但我得到了一些这样的错误:
java.lang.IllegalStateException: Unable to look up javax.sql.DataSource with jndi name 'jdbc/postgres'.
看看我的web.xml
<resource-ref>
<description>db</description>
<res-ref-name>jdbc/postgres</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
和我的shiro.ini:
jdbcRealm=org.apache.shiro.realm.jdbc.JdbcRealm
jof = org.apache.shiro.jndi.JndiObjectFactory
jof.resourceName = jdbc/postgres
jof.requiredType = javax.sql.DataSource
jof.resourceRef = true
jdbcRealm.dataSource = $jof
jdbcRealm.authenticationQuery = \
select password \
from users \
where username = ?
jdbcRealm.userRolesQuery = \
select r.label \
from users_roles ur \
inner join roles r \
on ur.role_id = r.id \
where user_id = ( \
select id \
from users \
where username = ?); \
jdbcRealm.permissionsQuery= \
select p.permission \
from roles_permissions rp \
inner join permissions p \
on rp.permission_id = p.id \
where rp.role_id = ( \
select id \
from roles \
where label = ?);
jdbcRealm.permissionsLookupEnabled=true
dps = org.apache.shiro.authc.credential.DefaultPasswordService
pm = org.apache.shiro.authc.credential.PasswordMatcher
pm.passwordService = $dps
jdbcRealm.credentialsMatcher = $pm
securityManager.realms = $jdbcRealm
我错过了什么吗?