2017-11-01 11 views
0

Apache Isisのシンプルなアプリのアーキタイプ1.15.0をダウンロードしました。そして、私はApache Shiroとこれをdocumentationの後に統合したいと思います。しかし、私はこのようないくつかのエラーを得た:JNDI Shiro PostgreSQL - Apache Isisでjndi name 'jdbc/postgres'を持つjavax.sql.DataSourceを検索できません

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 

アム:

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の私を見てください私は何かが欠けている?

答えて

0

これはコンテナによって異なります。 Apache-Isisのドキュメントには、Tomcatでこれを設定する方法へのリンクがあります。

上記の設定を使用すると、DataSourceも設定する必要があります。詳細はサーブレットコンテナによって異なります。たとえば、how to do the setup on Tomcat 8.0です。

関連する問題