Quantcast

Shiro Jdbc Realm Mysql.

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Shiro Jdbc Realm Mysql.

ipas
Hi,
I am trying to use Shiro JdbcRealm, configured web.xml as below :

<filter>
               <filter-name>ShiroFilter</
filter-name>
               <filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
               <init-param>
<param-name>config</param-name>
<param-value>
[main]
 jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm

               jdbcRealm.permissionsLookupEnabled = true

               jdbcRealm.authenticationQuery = "SELECT password FROM users
WHERE user_name = ?"

               jdbcRealm.userRolesQuery = "SELECT role_name FROM user_roles
WHERE user_name = ?"

               jdbcRealm.permissionsQuery = "SELECT permission FROM
roles_permissions WHERE role_name = ?"

               ds = com.mysql.jdbc.Driver
               ds.serverName = localhost
               ds.user = root
               ds.password = 12345
               ds.databaseName = iaau
               coreFreightRealm.dataSource = $ds
</param-value>
</init-param>
       </filter>

But my server is giving me following stack trace :

SEVERE: Exception starting filter ShiroFilter
javax.servlet.ServletException:
org.apache.shiro.config.ConfigurationException: Property 'serverName' does
not exist for object of type com.mysql.jdbc.Driver.
       at
org.apache.shiro.web.servlet.AbstractFilter.init(AbstractFilter.java:105)
       at
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
       at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
       at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
       at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
       at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4542)
       at
org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5220)
       at
org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5215)
       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
       at java.util.concurrent.FutureTask.run(FutureTask.java:138)
       at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
       at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
       at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.shiro.config.ConfigurationException: Property
'serverName' does not exist for object of type com.mysql.jdbc.Driver.
       at
org.apache.shiro.config.ReflectionBuilder.isTypedProperty(ReflectionBuilder.java:243)
       at
org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:347)
       at
org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:198)
       at
org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:159)
       at
org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:119)
       at
org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:170)
       at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:119)
       at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:97)
       at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:83)
       at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:41)
       at
org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
       at
org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
       at
org.apache.shiro.web.servlet.IniShiroFilter.applySecurityManager(IniShiroFilter.java:260)
       at
org.apache.shiro.web.servlet.IniShiroFilter.configure(IniShiroFilter.java:228)
       at
org.apache.shiro.web.servlet.IniShiroFilter.init(IniShiroFilter.java:190)
       at
org.apache.shiro.web.servlet.AbstractShiroFilter.onFilterConfigSet(AbstractShiroFilter.java:152)
       at org.apache.shiro.web.servlet.AbstractFilter.init(AbstractFilter.java:97)
       ... 12 more

Do you have any ideas regarding this error.

PS: I am resending it because i have accidentally deleted post form nabble.com .

Thank you.
Mirlan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

ipas
Hi, the problem above is resolved by changing following lines in web.xml :

ds = com.mysql.jdbc.Driver
to
ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource

and i forget changing line coreFreightRealm.dataSource = $ds to jdbcRealm.dataSource = $ds


Now my application is working but giving me "here was a SQL error while authenticating user [admin] ", But i can not understand exactly in which SQL query i have an error.

my tables are :
users(user_name varchar,user_pass varchar, status int),
user_roles (user_name varchar,role_name varchar),
roles_permissions(role_name varchar, permission varchar)

Am i missing something?

Thanking you,
Mirlan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

Jared Bunting
In reply to this post by ipas
Well, on first glance your password field is different in your tables and your query.  That being said, it would probably be a bit easier to assist if you pasted the full stacktrace.

ipas <[hidden email]> wrote:


Hi, the problem above is resolved by changing following lines in web.xml :

ds = com.mysql.jdbc.Driver
to
ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource

and i forget changing line coreFreightRealm.dataSource = $ds to
jdbcRealm.dataSource = $ds


Now my application is working but giving me *"here was a SQL error while
authenticating user [admin]* ", But i can not understand exactly in which
SQL query i have an error.

my tables are :
users(user_name varchar,user_pass varchar, status int),
user_roles (user_name varchar,role_name varchar),
roles_permissions(role_name varchar, permission varchar)

Am i missing something?

Thanking you,
Mirlan



--
View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-Jdbc-Realm-Mysql-tp6519616p6519975.html
Sent from the Shiro User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

Les Hazlewood-2
Also, I wouldn't use the DataSource directly - use a connection pool
like BoneCPDataSource that uses the MySQL driver internally:

http://jolbox.com/

I've been using it for a while with good results.

HTH,

Les

On Mon, Jun 27, 2011 at 4:17 AM, Jared Bunting
<[hidden email]> wrote:

> Well, on first glance your password field is different in your tables and your query.  That being said, it would probably be a bit easier to assist if you pasted the full stacktrace.
>
> ipas <[hidden email]> wrote:
>
>
> Hi, the problem above is resolved by changing following lines in web.xml :
>
> ds = com.mysql.jdbc.Driver
> to
> ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
>
> and i forget changing line coreFreightRealm.dataSource = $ds to
> jdbcRealm.dataSource = $ds
>
>
> Now my application is working but giving me *"here was a SQL error while
> authenticating user [admin]* ", But i can not understand exactly in which
> SQL query i have an error.
>
> my tables are :
> users(user_name varchar,user_pass varchar, status int),
> user_roles (user_name varchar,role_name varchar),
> roles_permissions(role_name varchar, permission varchar)
>
> Am i missing something?
>
> Thanking you,
> Mirlan
>
>
>
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-Jdbc-Realm-Mysql-tp6519616p6519975.html
> Sent from the Shiro User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

ipas
Hi, Thank you for your replies.
The thing is my server is not showing any Stack trace but only following exception .

There was a SQL error while authenticating user [admin]

I am using Eclipse Helios with tomcat7 is there anyway to see detailed stack trace?

About using data source could you show me some example of using it with shiro? I searched it but no luck.

Thanking you,
Mirlan




On Tue, Jun 28, 2011 at 9:39 AM, Les Hazlewood <[hidden email]> wrote:
Also, I wouldn't use the DataSource directly - use a connection pool
like BoneCPDataSource that uses the MySQL driver internally:

http://jolbox.com/

I've been using it for a while with good results.

HTH,

Les

On Mon, Jun 27, 2011 at 4:17 AM, Jared Bunting
<[hidden email]> wrote:
> Well, on first glance your password field is different in your tables and your query.  That being said, it would probably be a bit easier to assist if you pasted the full stacktrace.
>
> ipas <[hidden email]> wrote:
>
>
> Hi, the problem above is resolved by changing following lines in web.xml :
>
> ds = com.mysql.jdbc.Driver
> to
> ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
>
> and i forget changing line coreFreightRealm.dataSource = $ds to
> jdbcRealm.dataSource = $ds
>
>
> Now my application is working but giving me *"here was a SQL error while
> authenticating user [admin]* ", But i can not understand exactly in which
> SQL query i have an error.
>
> my tables are :
> users(user_name varchar,user_pass varchar, status int),
> user_roles (user_name varchar,role_name varchar),
> roles_permissions(role_name varchar, permission varchar)
>
> Am i missing something?
>
> Thanking you,
> Mirlan
>
>
>
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-Jdbc-Realm-Mysql-tp6519616p6519975.html
> Sent from the Shiro User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

Phil Steitz
On 6/28/11 3:23 AM, Mirlan Ipasov wrote:
> Hi, Thank you for your replies.
> The thing is my server is not showing any Stack trace but only following
> exception .
>
> There was a SQL error while authenticating user [admin]
>
> I am using Eclipse Helios with tomcat7 is there anyway to see detailed stack
> trace?

Catch the AuthenticationException and dump its stack trace.  See [1].
> About using data source could you show me some example of using it with
> shiro? I searched it but no luck.

I have not tested this, but it looks to me like as long as the pool
has a bean interface for configuration, you should be able to just
specify the pooling datasource class name as the datasource property
and then specify its properties as dotted extensions.  For example,
using Apache Commons DBCP (for other pools, consult the datasource
javadoc for property names):

jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.permissionsLookupEnabled = true
jdbcRealm.authenticationQuery = your query
jdbcRealm.userRolesQuery = your query
jdbcRealm.permissionsQuery = your query

ds = org.apache.commoms.dbcp.BasicDataSource
ds.driverClassName = com.mysql.jdbc.Driver
ds.username = user name
ds.password = password
ds.url = connect URL
ds.maxActive = maximum number of connections
other properties, as documented in setter javadocs [2]
...
jdbcRealm.datasource = ds

If you choose to use Commons DBCP, make sure to download the latest releases of Commons Pool and DBCP and add these jars to your application's classpath.

Phil

[1] http://shiro.apache.org/10-minute-tutorial.html
[2] http://s.apache.org/Q8m


> Thanking you,
> Mirlan
>
>
>
>
> On Tue, Jun 28, 2011 at 9:39 AM, Les Hazlewood <[hidden email]>wrote:
>
>> Also, I wouldn't use the DataSource directly - use a connection pool
>> like BoneCPDataSource that uses the MySQL driver internally:
>>
>> http://jolbox.com/
>>
>> I've been using it for a while with good results.
>>
>> HTH,
>>
>> Les
>>
>> On Mon, Jun 27, 2011 at 4:17 AM, Jared Bunting
>> <[hidden email]> wrote:
>>> Well, on first glance your password field is different in your tables and
>> your query.  That being said, it would probably be a bit easier to assist if
>> you pasted the full stacktrace.
>>> ipas <[hidden email]> wrote:
>>>
>>>
>>> Hi, the problem above is resolved by changing following lines in web.xml
>> :
>>> ds = com.mysql.jdbc.Driver
>>> to
>>> ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
>>>
>>> and i forget changing line coreFreightRealm.dataSource = $ds to
>>> jdbcRealm.dataSource = $ds
>>>
>>>
>>> Now my application is working but giving me *"here was a SQL error while
>>> authenticating user [admin]* ", But i can not understand exactly in which
>>> SQL query i have an error.
>>>
>>> my tables are :
>>> users(user_name varchar,user_pass varchar, status int),
>>> user_roles (user_name varchar,role_name varchar),
>>> roles_permissions(role_name varchar, permission varchar)
>>>
>>> Am i missing something?
>>>
>>> Thanking you,
>>> Mirlan
>>>
>>>
>>>
>>> --
>>> View this message in context:
>> http://shiro-user.582556.n2.nabble.com/Shiro-Jdbc-Realm-Mysql-tp6519616p6519975.html
>>> Sent from the Shiro User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

Phil Steitz
On 6/28/11 11:28 AM, Phil Steitz wrote:

> On 6/28/11 3:23 AM, Mirlan Ipasov wrote:
>> Hi, Thank you for your replies.
>> The thing is my server is not showing any Stack trace but only following
>> exception .
>>
>> There was a SQL error while authenticating user [admin]
>>
>> I am using Eclipse Helios with tomcat7 is there anyway to see detailed stack
>> trace?
> Catch the AuthenticationException and dump its stack trace.  See [1].
>> About using data source could you show me some example of using it with
>> shiro? I searched it but no luck.
> I have not tested this, but it looks to me like as long as the pool
> has a bean interface for configuration, you should be able to just
> specify the pooling datasource class name as the datasource property
> and then specify its properties as dotted extensions.  For example,
> using Apache Commons DBCP (for other pools, consult the datasource
> javadoc for property names):
>
> jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
> jdbcRealm.permissionsLookupEnabled = true
> jdbcRealm.authenticationQuery = your query
> jdbcRealm.userRolesQuery = your query
> jdbcRealm.permissionsQuery = your query
>
> ds = org.apache.commoms.dbcp.BasicDataSource
> ds.driverClassName = com.mysql.jdbc.Driver
> ds.username = user name
> ds.password = password
> ds.url = connect URL
> ds.maxActive = maximum number of connections
> other properties, as documented in setter javadocs [2]
> ...
> jdbcRealm.datasource = ds

Sorry, above line should be jdbcRealm.dataSource = $ds

Phil

> If you choose to use Commons DBCP, make sure to download the latest releases of Commons Pool and DBCP and add these jars to your application's classpath.
>
> Phil
>
> [1] http://shiro.apache.org/10-minute-tutorial.html
> [2] http://s.apache.org/Q8m
>
>
>> Thanking you,
>> Mirlan
>>
>>
>>
>>
>> On Tue, Jun 28, 2011 at 9:39 AM, Les Hazlewood <[hidden email]>wrote:
>>
>>> Also, I wouldn't use the DataSource directly - use a connection pool
>>> like BoneCPDataSource that uses the MySQL driver internally:
>>>
>>> http://jolbox.com/
>>>
>>> I've been using it for a while with good results.
>>>
>>> HTH,
>>>
>>> Les
>>>
>>> On Mon, Jun 27, 2011 at 4:17 AM, Jared Bunting
>>> <[hidden email]> wrote:
>>>> Well, on first glance your password field is different in your tables and
>>> your query.  That being said, it would probably be a bit easier to assist if
>>> you pasted the full stacktrace.
>>>> ipas <[hidden email]> wrote:
>>>>
>>>>
>>>> Hi, the problem above is resolved by changing following lines in web.xml
>>> :
>>>> ds = com.mysql.jdbc.Driver
>>>> to
>>>> ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
>>>>
>>>> and i forget changing line coreFreightRealm.dataSource = $ds to
>>>> jdbcRealm.dataSource = $ds
>>>>
>>>>
>>>> Now my application is working but giving me *"here was a SQL error while
>>>> authenticating user [admin]* ", But i can not understand exactly in which
>>>> SQL query i have an error.
>>>>
>>>> my tables are :
>>>> users(user_name varchar,user_pass varchar, status int),
>>>> user_roles (user_name varchar,role_name varchar),
>>>> roles_permissions(role_name varchar, permission varchar)
>>>>
>>>> Am i missing something?
>>>>
>>>> Thanking you,
>>>> Mirlan
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>> http://shiro-user.582556.n2.nabble.com/Shiro-Jdbc-Realm-Mysql-tp6519616p6519975.html
>>>> Sent from the Shiro User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

ipas
Hi,
Here are my DataSpurce configurations . And i think there is no problem in connection.

jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
                jdbcRealm.permissionsLookupEnabled = true
                jdbcRealm.authenticationQuery = "SELECT user_pass FROM users WHERE user_name = ?"
                jdbcRealm.userRolesQuery = "SELECT role_name FROM user_roles WHERE user_name = ?"
                jdbcRealm.permissionsQuery = "SELECT permission FROM roles_permissions WHERE role_name = ?"
                                ds = org.apache.commons.dbcp.BasicDataSource
                                ds.driverClassName = com.mysql.jdbc.Driver
                                ds.username = user
                                ds.password = pass
                                ds.url = jdbc:mysql://localhost:3306/iaau
                                ds.maxActive = 10
                jdbcRealm.dataSource = $ds

But still it is giving me exception There was a SQL error while authenticating user [admin] .
How to see if the sql query is correct?

Thank you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

Jared Bunting
Nothing jumps out at me.

However, all that error tells us is that there was a SQL exception.    
The JdbcRealm class logs this entire exception.  It also throws an
AuthenticationException with the cause set as the SQLException.  Do you
have a full stack trace for this error?  That would likely be very telling.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

ipas
Hi, Thanks for reply.
The thing is i can not find full stack trace. It is not showing me on eclipse and i tried to find it on apache tomcat server logs too but without luck.

In Eclipse it is giving only one line of exception which i wrote above.

Thank you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

Phil Steitz
On 7/6/11 4:17 AM, ipas wrote:
> Hi, Thanks for reply.
> The thing is i can not find full stack trace. It is not showing me on
> eclipse and i tried to find it on apache tomcat server logs too but without
> luck.
>
> In Eclipse it is giving only one line of exception which i wrote above.

Your code that does the login must be swallowing the
AuthenticationException.  In your code that does the authentication,
try catching the AuthenticationException and dumping its stack trace
(like the quickstart example):

try {
    currentUser.login( token );
    //if no exception, that's it, we're done!
} catch ( UnknownAccountException uae ) {
    //username wasn't in the system, show them an error message?
} catch ( IncorrectCredentialsException ice ) {
    //password didn't match, try again?
} catch ( LockedAccountException lae ) {
    //account for that username is locked - can't login.  Show them a message?
}
    ... more types exceptions to check if you want ...
} catch ( AuthenticationException ae ) {
    ae.printStackTrace();
}

Phil


> Thank you.
>
>
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-Jdbc-Realm-Mysql-tp6519616p6553999.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

younis15
This post has NOT been accepted by the mailing list yet.
In reply to this post by ipas
ipas

I think it will work if you remove the quotation '"' from your query.

Thanks
Younis Alomoush
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

ipas
Ok this issue is resolved. It is up and running now.
I just used vaadin-shiro-simple as a background and made changes to use Shiro jdbcRealm. It is obvious that there is no need to make changes in Java code. So changes made only in shiro.ini and in particular MySql database.

Content of shiro.ini is :
[main]
jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.permissionsLookupEnabled = true
jdbcRealm.authenticationQuery = SELECT password FROM users WHERE username = ?
jdbcRealm.userRolesQuery = SELECT role_name FROM user_roles WHERE username = ?
jdbcRealm.permissionsQuery = SELECT roleper FROM roles_permissions WHERE role_name = ?
ds = com.jolbox.bonecp.BoneCPDataSource
ds.driverClass=com.mysql.jdbc.Driver
ds.jdbcUrl=jdbc:mysql://localhost:3306/dbname
ds.username = username
ds.password = password
jdbcRealm.dataSource=$ds

database:
CREATE TABLE IF NOT EXISTS `roles_permissions` (
 `roleper` char(50) NOT NULL,
 `role_name` char(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `users` (
 `username` char(50) NOT NULL,
 `password` char(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `user_roles` (
 `role_name` char(50) NOT NULL,
 `username` char(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

For maven users pom.xml dependencies:

<repository>
                  <releases>
                                  <enabled>true</enabled>
                  </releases>
    <id>bonecp-repo</id>
  <name>BoneCP Repository</name>
                 <url>http://jolbox.com/bonecp/downloads/maven</url>
</repository>

                <dependency>
                        <groupId>org.apache.shiro</groupId>
                        <artifactId>shiro-core</artifactId>
                        <version>1.1.0</version>
                </dependency>

                <dependency>
                        <groupId>org.apache.shiro</groupId>
                        <artifactId>shiro-web</artifactId>
                        <version>1.1.0</version>
                </dependency>

                <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                        <version>1.6.1</version>
                </dependency>
                <dependency>
                        <groupId>com.jolbox</groupId>
                        <artifactId>bonecp</artifactId>
                        <version>0.6.5</version>
                        <scope>compile</scope>
                </dependency>
                <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>5.1.18</version>
                </dependency>
                <dependency>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                        <version>1.1.1</version>
                </dependency>

Thats it , it is working just like shiro-vaadin-simple.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm Mysql.

swetha
This post has NOT been accepted by the mailing list yet.
Hi,

   I have an issue in shiro.ini. My code is below

jdbcRealm=org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.permissionsLookupEnabled = true
jdbcRealm.authenticationQuery = select user_pass from users where user_name = ?
jdbcRealm.userRolesQuery = select role_name from user_roles where user_name = ?

ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
ds.serverName = 192.168.10.105
ds.port  = 3306
ds.user = root
ds.password = atri
ds.databaseName = shiro
jdbcRealm.dataSource = $ds

It is not giving stack trace but while login I'm getting the following errors

ERROR org.apache.shiro.realm.jdbc.JdbcRealm - There was a SQL error while authenticating user [admin]

and
Connection refused

Could anyone please help me in that.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shiro Jdbc Realm SQLite.

apatel
This post has NOT been accepted by the mailing list yet.
In reply to this post by Jared Bunting
I am facing same problem with SQLite database.

My Shiro.ini contains::

ds = org.sqlite.JDBC
ds.databaseName = jdbc:sqlite:getClass().getClassLoader().getResourceAsStream(usersRoles.db)


and Error shows::

Property 'databaseName' does not exist for object of type org.sqlite.JDBC.
Loading...