I'm unable to understand what's wrong with this configuration: in the server.xml file I defined that as a resource i want to use conf/tomcat-users.xml (this authentication is just for tomcat manager); While to authenticated user on my application i define in the context.xml file as a realm a database; In other words I don't want to modify server.xml file to make authentication on my app;
server.xml file: ======================================================================================== <?xml version='1.0' encoding='utf-8'?> <Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <Listener className="org.apache.catalina.core.JasperListener" /> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="localhost"> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine> </Service> </Server> ==================================================================================== context.xml file =============================================================================== <?xml version="1.0" encoding="UTF-8"?> <Context antiJARLocking="true" path="/SitoAziendale"> <Resource name="jdbc/PoolConnessioni" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="utentedb" password="utentedb" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/timesheet?zeroDateTimeBehavior=convertToNull"/> <Realm className="org.apache.catalina.realm.DataSourceRealm" dataSourceName="jdbc/PoolConnessioni" userTable="Dipendente" userNameCol="username" userCredCol="password" userRoleTable="ruoliUtente" roleNameCol="nomeRuolo"/> </Context> ======================================================================================== thanks;