File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes LifeCycleException & SQLException - connecting to mysql from tomcat with basic auth Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "LifeCycleException & SQLException - connecting to mysql from tomcat with basic auth" Watch "LifeCycleException & SQLException - connecting to mysql from tomcat with basic auth" New topic
Author

LifeCycleException & SQLException - connecting to mysql from tomcat with basic auth

John Belden
Greenhorn

Joined: May 02, 2005
Posts: 2
Hi, I am having trouble accessing my mysql database for basic authentication (see error message below), and I'm not sure where the problem is. When I uncomment the MemoryRealm line in server.xml I can access all the files in my .../webapps/murach folder (though I still can't make a database connection). When I comment out the MemoryRealm line, and instead uncomment the JDBCRealm block I cannot access any of my files or my database connection.

Below is the error message I'm getting, along with my server.xml, web.xml, and mysql script.

I appreciate any help you can provide. Please let me know if you'd like me to post additional files or complete copies of my web.xml or server.xml files. Thank you in advance for your assistance.


FILE: /usr/local/jakarta-tomcat-4.0.1/logs/catalina.out


IMPORTANT FILE PATHS:


FILE: jakarta-tomcat-4.0.1/server.xml


FILE: /usr/local/jakarta-tomcat-4.0.1/webapps/murach/WEB-INF/web.xml


FILE: uploaded script for "users" - mysql database

[CODE]
DROP DATABASE IF EXISTS users;

CREATE DATABASE users;

USE users;

CREATE TABLE UserList (
user_name VARCHAR(50) NOT NULL,
user_pass VARCHAR(50) NOT NULL,

PRIMARY KEY (user_name)
);

CREATE TABLE Roles (
user_name VARCHAR(50) NOT NULL,
role_name VARCHAR(50) NOT NULL,

PRIMARY KEY (user_name)
);

INSERT INTO UserList VALUES
('john', 'smith'),
('karl', 'johnson'),
('kevin', 'berman'),
('stu', 'mendel');

INSERT INTO Roles VALUES
('john', 'admin'),
('karl', 'student'),
('kevin', 'student'),
('stu', 'guest');

[/CODE/
[ May 02, 2005: Message edited by: John Belden ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
135

John,
Welcome to JavaRanch!

Are you able to access the database from the command line?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
John Belden
Greenhorn

Joined: May 02, 2005
Posts: 2
Yes. Typing...

/usr/local/mysql/bin$ mysql -u root

lets me access the database.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LifeCycleException & SQLException - connecting to mysql from tomcat with basic auth
 
Similar Threads
Authentication problems with MySQL and Tomcat 6.0
access control with realm db
css includes unrecognized in protected realm
JDBCRealm and the security-constraint Element in the web.xml File
form based login example