I believe you have to move your jdbc/pmcm to global JNDI resource. Regards, Daniel
-----Original Message----- From: Dani [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 1:01 PM To: Tomcat Users List Subject: Re: DataSourceReal with tomcat These are my step. The problem is that now I can't access my application when I type login and password (I've tried whith 'dani' user, 'guille' user and 'tomcat' user. what is happening??. Thanks *** I've created role and users tables in mysql: create table users ( user_name varchar(15) not null primary key, user_pass varchar(15) not null ) Type=InnoDB; and the data for this table: user_name,role_name dani,administrador guille,usuario tomcat,admin tomcat,administrator tomcat,tomcat create table user_roles ( user_name varchar(15) not null, role_name varchar(15) not null, primary key (user_name, role_name) ) Type=InnoDB; and the data for this table: user_name,user_pass dani,dani guille,guille tomcat,tomcat *** This is my loging.jsp page into /pmcm application directory: <html> <head> <title>Login Page for Examples</title> <body bgcolor="white"> <form method="POST" action='<%= response.encodeURL("j_security_check") %>' > <table border="0" cellspacing="5"> <tr> <th align="right">Username:</th> <td align="left"><input type="text" name="j_username"></td> </tr> <tr> <th align="right">Password:</th> <td align="left"><input type="password" name="j_password"></td> </tr> <tr> <td align="right"><input type="submit" value="Log In"></td> <td align="left"><input type="reset"></td> </tr> </table> </form> </body> </html> *** This is my error.jsp into /pmcm application directory: <html> <head> <title>Error Page For Examples</title> </head> <body bgcolor="white"> Invalid username and/or password, please try <a href='<%= response.encodeURL("login.jsp") %>'>again</a>. </body> </html> *** This is my /pmcm/WEB-INF/web.xml: .... <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/pmcm</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <security-constraint> <display-name>Example Security Constraint</display-name> <web-resource-collection> <web-resource-name>Protected Area</web-resource-name> <!-- Define the context-relative URL(s) to be protected --> <url-pattern>/*</url-pattern> <!-- If you list http methods, only those methods are protected --> <http-method>DELETE</http-method> <http-method>GET</http-method> <http-method>POST</http-method> <http-method>PUT</http-method> </web-resource-collection> <auth-constraint> <!-- Anyone with one of the listed roles may access this area --> <role-name>usuario</role-name> <role-name>tomcat</role-name> <role-name>administrador</role-name> </auth-constraint> </security-constraint> <!-- Default login configuration uses form-based authentication --> <login-config> <auth-method>FORM</auth-method> <realm-name>Example Form-Based Authentication Area</realm-name> <form-login-config> <form-login-page>/login.jsp</form-login-page> <form-error-page>/error.jsp</form-error-page> </form-login-config> </login-config> </web-app> *** This is my tomcat/conf/server.xml: ....... <!-- Define the Tomcat Stand-Alone Service --> <Service name="Tomcat-Standalone"> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" useURIValidationHack="false" disableUploadTimeout="true" /> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8009" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="0" useURIValidationHack="false" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/> <Engine name="Standalone" defaultHost="localhost" debug="0"> <!-- Global logger unless overridden at lower levels --> <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/> .............. <Realm className="org.apache.catalina.realm.DataSourceRealm" debug="99" dataSourceName="java:/comp/env/jdbc/pmcmdb:3306" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name"/> .... <Context path="/pmcm" docBase="pmcm" debug="5" reloadable="true" crossContext="true"> <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_pmcm_log." suffix=".txt" timestamp="true"/> <Resource name="jdbc/pmcm" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/pmcm"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <!-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. --> <parameter> <name>maxActive</name> <value>100</value> </parameter> <!-- Maximum number of idle dB connections to retain in pool. Set to 0 for no limit. --> <parameter> <name>maxIdle</name> <value>30</value> </parameter> <!-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. --> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <!-- MySQL dB username and password for dB connections --> <parameter> <name>username</name> <value></value> </parameter> <parameter> <name>password</name> <value></value> </parameter> <!-- Class name for mm.mysql JDBC driver --> <parameter> <name>driverClassName</name> <value>org.gjt.mm.mysql.Driver</value> </parameter> <!-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. --> <parameter> <name>url</name> <value>jdbc:mysql://localhost:3306/pmcmdb?autoReconnect=true</value> </parameter> </ResourceParams> </Context> ..... -------------------------------------- -------------------------------------- -------------------------------------- -------------------------------------- ----- Original Message ----- From: "Shapira, Yoav" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Thursday, April 01, 2004 7:58 PM Subject: RE: DataSourceReal with tomcat Hi, See http://jakarta.apache.org/tomcat/tomcat-5.0-doc/realm-howto.html#DataSou rceRealm. If you want anyone to help more, be specific about your problems. Yoav Shapira Millennium Research Informatics >-----Original Message----- >From: Dani [mailto:[EMAIL PROTECTED] >Sent: Thursday, April 01, 2004 2:46 PM >To: Tomcat Users List >Subject: DataSourceReal with tomcat > >Is it possible making a datasourceRealm with tomcat?? How can I do it? I've >tried but i couldn't > >thanks > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
