Re: Some errors when using tomcat database connection pool

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Some errors when using tomcat database connection pool

Brian Demers
It looks like you are trying to use a JNDI lookup an explicit configuration.
Try something like this: https://gist.github.com/dominicfarr/9637357

On Sat, Jun 3, 2017 at 9:04 AM, yuwei <[hidden email]> wrote:
Hi guys,
I tried to configure shiro.ini to make shiro using tomcat database
connection pool.
The configuration is as below,
datasrc = org.apache.shiro.jndi.JndiObjectFactory
datasrc.requiredType = javax.sql.DataSource
datasrc.resourceName = mysql/ustudy
datasrc.resourceRef = true
datasrc.user = root
datasrc.password = mysql
datasrc.url =
jdbc:mysql://192.168.0.107:13306/ustudy?characterEncoding=UTF-8
datasrc.driverClassName = com.mysql.jdbc.Driver

realm = org.apache.shiro.realm.jdbc.JdbcRealm
realm.permissionsLookupEnabled = true
realm.dataSource = $datasrc
realm.authenticationQuery = select usr_passwd from sec_users where loginname
= ?
realm.credentialsMatcher = $pwMatcher

securityManager.realms = $realm

tomcat failed to enable shiro  and I got following errors:
03-Jun-2017 11:41:52.930 INFO [main]
org.apache.catalina.core.ApplicationContext.log Initializing Shiro
environment
03-Jun-2017 11:41:53.130 SEVERE [main]
org.apache.catalina.core.StandardContext.listenerStart Exception sending
context initialized event to listener instance of class
[org.apache.shiro.web.env.EnvironmentLoaderListener]
 org.apache.shiro.config.ConfigurationException: Property 'user' does not
exist for object of type org.apache.shiro.jndi.JndiObjectFactory.
        at
org.apache.shiro.config.ReflectionBuilder.isTypedProperty(ReflectionBuilder.java:255)
        at
org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:544)
        at
org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:206)
        at
org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:167)
        at
org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:124)
        at
org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:161)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:124)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:102)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:88)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:46)
        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.env.IniWebEnvironment.createWebSecurityManager(IniWebEnvironment.java:203)
        at
org.apache.shiro.web.env.IniWebEnvironment.configure(IniWebEnvironment.java:99)
        at
org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:92)
        at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
        at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
        at
org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
        at
org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:133)
        at
org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
        at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4734)

Maybe this is only configuration problem.
Could you please help to have a look?
Thx.



--
View this message in context: http://shiro-user.582556.n2.nabble.com/Some-errors-when-using-tomcat-database-connection-pool-tp7581595.html
Sent from the Shiro User mailing list archive at Nabble.com.