The DB is : MSSQL 2008 R2 OS= Windows Server 2008 R2
Global Resource in server.xml is:
<Resource name="data source name" auth="Container" type="javax.sql.DataSource" username="myuser" password="abc@xyz" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://host:1433;databaseName=test1;selectMethod=cursor" maxWait="30000" maxActive="32" maxIdle="4" initialSize="4" timeBetweenEvictionRunsMillis="600000" minEvictableIdleTimeMilllis="600000" />
</GlobalNamingResources>
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
Are the resource values conflicting or is there any other issue ? I have also tried adding tomcat user file in Resource name tag but won't work either. I have also defined data source name in context.xml file.
The error log is:
Mar 12, 2014 5:19:53 PM org.apache.catalina.realm.UserDatabaseRealm startInternal SEVERE: Exception looking up UserDatabase under key UserDatabase javax.naming.NameNotFoundException: Name [UserDatabase] is not bound in this Context. Unable to find [UserDatabase]. at org.apache.naming.NamingContext.lookup(NamingContext.java:819) at org.apache.naming.NamingContext.lookup(NamingContext.java:167) at org.apache.catalina.realm.UserDatabaseRealm.startInternal(UserDatabaseRealm.java:253) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.realm.CombinedRealm.startInternal(CombinedRealm.java:201) at org.apache.catalina.realm.LockOutRealm.startInternal(LockOutRealm.java:120) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1109) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.startup.Catalina.start(Catalina.java:689) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Mar 12, 2014 5:19:53 PM org.apache.catalina.realm.CombinedRealm startInternal SEVERE: Failed to start "org.apache.catalina.realm.UserDatabaseRealm/1.0" realm org.apache.catalina.LifecycleException: Failed to start component [Realm[UserDatabaseRealm]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.realm.CombinedRealm.startInternal(CombinedRealm.java:201) at org.apache.catalina.realm.LockOutRealm.startInternal(LockOutRealm.java:120) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1109) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.startup.Catalina.start(Catalina.java:689) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455) Caused by: org.apache.catalina.LifecycleException: No UserDatabase component found under key UserDatabase at org.apache.catalina.realm.UserDatabaseRealm.startInternal(UserDatabaseRealm.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 17 more