Re: URL is "null" and HTTP 404 error when using FROM authentication

2008-06-16 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Assaf,

exkor wrote:
| The problem im having right now (which i believe is relatively simple)
| is that my app doesn't connect to the DB. I configured server.xml back
| to use MemoryRealm because i want only the app to use the DB. Then
| I've changed my apps context.xml to this:
|
| 
|
|  is being
correctly placed within META-INF/context.xml in your web application.

| 

Don't use 'autoReconnect=true'... use validationQuery='SELECT 1'.

|   username="root"
|   password="skywalker"
| digest="MD5"
| userTable="users"
| userNameCol="uid"
|   userCredCol="password"
|   userRoleTable="users"
| roleNameCol="role"
|   logAbandoned="true"
|   removeAbandoned="true"
|   removeAbandonedTimeout="10"
|   maxActive="20"
|   maxIdle="10"
|   maxWait="-1"/>

I think you have some stuff confused...  sets up a database
connection (JNDI DataSource), while a  should include the
information about userCredCol and all that stuff. You seem to be missing
the  element in your .

Note that s using local s need to have
localDataSource="true" in your  element.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhWufgACgkQ9CaO5/Lv0PDWEgCgqyXDPirLcgFYGpfAzmm6NtkN
kpkAnRTCNgeq8dYpT7HxM6cFIEVTOVSf
=CvDU
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: URL is "null" and HTTP 404 error when using FROM authentication

2008-06-14 Thread exkor
Hi Chuck

Thanks alot for this last bit about the query for the roles, it
actually made me realize what was wrong. The digest algorithm i used
to initialize my users table was different from the digest algorithm
used by tomcat. This is very surprising I've never seen encountered
something like that in the past. The algorith I used was from
www.md5oogle.com, so apperently they are using some different
encoding...

So I've changed the global sever.xml config and i see this in MySQL logs:
080614  9:57:35 118 Connect [EMAIL PROTECTED] on hamula
118 Query   /* mysql-connector-java-5.1.6 ( Revision:
${svn.Revision} ) */SHOW VARIABLES WHERE Variable_name ='language' OR
Variable_name = 'net_write_timeout' OR Variable_name =
'interactive_timeout' OR Variable_name = 'wait_timeout' OR
Variable_name = 'character_set_client' OR Variable_name =
'character_set_connection' OR Variable_name = 'character_set' OR
Variable_name = 'character_set_server' OR Variable_name =
'tx_isolation' OR Variable_name = 'transaction_isolation' OR
Variable_name = 'character_set_results' OR Variable_name = 'timezone'
OR Variable_name = 'time_zone' OR Variable_name = 'system_time_zone'
OR Variable_name = 'lower_case_table_names' OR Variable_name =
'max_allowed_packet' OR Variable_name = 'net_buffer_length' OR
Variable_name = 'sql_mode' OR Variable_name = 'query_cache_type' OR
Variable_name = 'query_cache_size' OR Variable_name = 'init_connect'
080614  9:57:54 118 Query   SELECT password FROM users WHERE
uid = '[EMAIL PROTECTED]'
118 Query   commit
118 Query   SELECT role FROM users WHERE uid = '[EMAIL 
PROTECTED]'
118 Query   commit

And it actually lets me through when i try to login into the manager.

The problem im having right now (which i beleave is relatively simple)
is that my app doesn't connect to the DB. I configured server.xml back
to use MemoryRealm because i want only the app to use the DB. Then
I've changed my apps context.xml to this:





  username="root"
  password="skywalker"
  digest="MD5"
  userTable="users"
  userNameCol="uid"
  userCredCol="password"
  userRoleTable="users"
  roleNameCol="role"
  logAbandoned="true"
  removeAbandoned="true"
  removeAbandonedTimeout="10"
  maxActive="20"
  maxIdle="10"
  maxWait="-1"/>



And my web.xml to this:

Hamula




  home.jsp





DB Connection
jdbc/hamula
javax.sql.DataSource
Container




Hamula
Pages accessible by registered users


/home.jsp
/events.jsp
/profile.jsp
/community.jsp



GET
POST


admin
manager




FORM

/index.jsp
/index.jsp





The role that is required to access registered user functions and
    pages

    admin
manager



I don't see any attempt for a connection in the mysql logs... very weird...
Do I need to define some global naming for the DB connection?


Thanks
-Assaf

On Sat, Jun 14, 2008 at 7:55 AM, Caldarale, Charles R
<[EMAIL PROTECTED]> wrote:
>> From: exkor [mailto:[EMAIL PROTECTED]
>> Subject: Re: URL is "null" and HTTP 404 error when using FROM
>> authentication
>
> It's good that you're starting from a clean install.
>
>> MySQL logs indicate the the connector has connected to the database
>> and quering the right table + fields:
>
> Except there's no query for the role, indicating that either the uid is not 
> found or the password check fails.  The MySQL logs should show the responses 
> to the queries; do those look correct?
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
> MATERIAL and is thus for use only by the intended recipient. If you received 
> this in error, please contact the sender and delete the e-mail and its 
> attachments from all computers.
>
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: URL is "null" and HTTP 404 error when using FROM authentication

2008-06-14 Thread Caldarale, Charles R
> From: exkor [mailto:[EMAIL PROTECTED]
> Subject: Re: URL is "null" and HTTP 404 error when using FROM
> authentication

It's good that you're starting from a clean install.

> MySQL logs indicate the the connector has connected to the database
> and quering the right table + fields:

Except there's no query for the role, indicating that either the uid is not 
found or the password check fails.  The MySQL logs should show the responses to 
the queries; do those look correct?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: URL is "null" and HTTP 404 error when using FROM authentication

2008-06-13 Thread exkor
 404 1051
> "http://127.0.0.1:8080/hamula/style.css"; "Mozilla/5.0 (Windows; U;
> Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
> 127.0.0.1 - - [13/Jun/2008:16:18:18 -0400] "POST
> /hamula/j_security_check HTTP/1.1" 200 2250
> "http://127.0.0.1:8080/hamula/home.jsp"; "Mozilla/5.0 (Windows; U;
> Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
> 127.0.0.1 - - [13/Jun/2008:16:18:18 -0400] "GET
> /hamula/images/kubrickbgcolor.jpg HTTP/1.1" 404 1051
> "http://127.0.0.1:8080/hamula/style.css"; "Mozilla/5.0 (Windows; U;
> Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
>
> The kubrik.jpg was actually removed so I can understand tomcat
> compaining with error 404 about it.
>
> this is what I currently have:
>
> myapps/WEB-INF/web.xml:
> 
>
>  Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
> 
>Hamula
>
>
>
>
>  home.jsp
>
>
>
>
>
>DB Connection
>jdbc/hamula
>javax.sql.DataSource
>Container
>
>
>
>
>Hamula
>Pages accessible by registered users
>
>
>/home.jsp
>/events.jsp
>/profile.jsp
>/community.jsp
>
>
>
>
>DELETE
>GET
>POST
>PUT
>
>
>admin
>manager
>
>
>
>
>FORM
>
>/index.jsp
>/index.jsp
>
>
>
>
>
>The role that is required to access registered user functions and
>pages
>
>admin
>manager
>
> 
>
> myapp/META-INF/context.xml:
> 
> 
>
>
>
> 
>
> $CATALINA_HOME/conf/server.xml:
> 
> 
> 
> 
>
>  
>   SSLEngine="on" />
>  
>  
>  
>  
>   className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
> />
>
>  
>  
>
>  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" />
>  
>
>  
>  
>
>
>
>
>
>
>   connectionTimeout="2"
>   redirectPort="8443" />
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  
>  
>
>  
>  
>
>  
>
>   resourceName="UserDatabase" />
>
>
>
>  
>  unpackWARs="true" autoDeploy="true"
>xmlValidation="false" xmlNamespaceAware="false">
>
>
>
>
>
>
> directory="logs"
>   prefix="localhost_access_log." suffix=".txt"
> pattern="combined" resolveHosts="false"/>
>
>
>  
>
>  
> 
>
>
> On Fri, Jun 13, 2008 at 1:32 AM, Caldarale, Charles R
> <[EMAIL PROTECTED]> wrote:
>>> From: exkor [mailto:[EMAIL PROTECTED]
>>> Subject: URL is "null" and HTTP 404 error when using FROM
>>> authentication
>>
>> You have some weirdness in your web.xml and context.xml that should be 
>> straightened out before attempting any further analysis.
>>
>>>
>>>
>>>
>>>
>>>0
>>>
>>
>> I have no idea what should be done with an empty  declaration, and 
>> it's possible Tomcat doesn't either; get rid of it.
>>
>>>
>>>admin
>>>manager
>>>
>> ...
>>>
>>>admin
>>>
>>
>> Either you have an extra role listed in , or you're missing 
>> one under ; get them in synch.
>>
>>> My context.xml:
>>
>> Where is your context.xml file?  It should be in your webapp's META-INF 
>> directory.  If you've changed the global one in Tomcat's conf directory, put 
>> it back the way it was and put your  element in the proper location.
>>
>>> >> debug="99"&

Re: URL is "null" and HTTP 404 error when using FROM authentication

2008-06-13 Thread exkor
Hi Thanks for the feedback Chuck.
I've done the changes you've suggested and I still experience the same problem.
The after I login I am brought back to the login page. Basiclly this
indicated that the login failed, since my error and login pages are
the same -> index.jsp. I get the following in the access log:
127.0.0.1 - - [13/Jun/2008:16:18:00 -0400] "GET /hamula/ HTTP/1.1" 200
2250 "http://127.0.0.1:8080/manager/html/start?path=/hamula";
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14)
Gecko/20080404 Firefox/2.0.0.14"
127.0.0.1 - - [13/Jun/2008:16:18:00 -0400] "GET
/hamula/images/kubrickbgcolor.jpg HTTP/1.1" 404 1051
"http://127.0.0.1:8080/hamula/style.css"; "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
127.0.0.1 - - [13/Jun/2008:16:18:04 -0400] "POST
/hamula/j_security_check HTTP/1.1" 200 2250
"http://127.0.0.1:8080/hamula/"; "Mozilla/5.0 (Windows; U; Windows NT
5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
127.0.0.1 - - [13/Jun/2008:16:18:04 -0400] "GET
/hamula/images/kubrickbgcolor.jpg HTTP/1.1" 404 1051
"http://127.0.0.1:8080/hamula/style.css"; "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
127.0.0.1 - - [13/Jun/2008:16:18:07 -0400] "POST
/hamula/j_security_check HTTP/1.1" 200 2250
"http://127.0.0.1:8080/hamula/j_security_check"; "Mozilla/5.0 (Windows;
U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404
Firefox/2.0.0.14"
127.0.0.1 - - [13/Jun/2008:16:18:07 -0400] "GET
/hamula/images/kubrickbgcolor.jpg HTTP/1.1" 404 1051
"http://127.0.0.1:8080/hamula/style.css"; "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
127.0.0.1 - - [13/Jun/2008:16:18:15 -0400] "GET /hamula/home.jsp
HTTP/1.1" 200 2250 "null" "Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
127.0.0.1 - - [13/Jun/2008:16:18:15 -0400] "GET
/hamula/images/kubrickbgcolor.jpg HTTP/1.1" 404 1051
"http://127.0.0.1:8080/hamula/style.css"; "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
127.0.0.1 - - [13/Jun/2008:16:18:18 -0400] "POST
/hamula/j_security_check HTTP/1.1" 200 2250
"http://127.0.0.1:8080/hamula/home.jsp"; "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
127.0.0.1 - - [13/Jun/2008:16:18:18 -0400] "GET
/hamula/images/kubrickbgcolor.jpg HTTP/1.1" 404 1051
"http://127.0.0.1:8080/hamula/style.css"; "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"

The kubrik.jpg was actually removed so I can understand tomcat
compaining with error 404 about it.

this is what I currently have:

myapps/WEB-INF/web.xml:


http://java.sun.com/dtd/web-app_2_3.dtd";>

Hamula




  home.jsp





DB Connection
jdbc/hamula
javax.sql.DataSource
Container




Hamula
Pages accessible by registered users


/home.jsp
/events.jsp
/profile.jsp
/community.jsp




DELETE
GET
POST
PUT


admin
manager




FORM

/index.jsp
/index.jsp





The role that is required to access registered user functions and
pages

admin
manager



myapp/META-INF/context.xml:







$CATALINA_HOME/conf/server.xml:





  
  
  
  
  
  
  

  
  


  

  
  


    


    
    
    
    
    
    

    
    







  
  

  
  

  

   



  
  









  

  



On Fri, Jun 13, 2008 at 1:32 AM, Caldarale, Charles R
<[EMAIL PROTECTED]> wrote:
>> From: exkor [mailto:[EMAIL PROTECTED]
>> Subject: URL is "null" and HTTP 404 error when using FROM
>> authentication
>
> You have some weirdness in your web.xml and context.xml that should be 
> straightened out before attempting any further analysis.
>
>>
>>
>>
>>
>>0
>>
>
> I have no idea what should be done with an empty  declaration, and 
> it's possible Tomcat doesn't either; get rid of it.
>
>>
>>admin
>>manager
>>
> ...
>>
>>   

RE: URL is "null" and HTTP 404 error when using FROM authentication

2008-06-12 Thread Caldarale, Charles R
> From: exkor [mailto:[EMAIL PROTECTED]
> Subject: URL is "null" and HTTP 404 error when using FROM
> authentication

You have some weirdness in your web.xml and context.xml that should be 
straightened out before attempting any further analysis.

>
>
>
>
>0
>

I have no idea what should be done with an empty  declaration, and 
it's possible Tomcat doesn't either; get rid of it.

>
>admin
>manager
>
...
>
>admin
>

Either you have an extra role listed in , or you're missing 
one under ; get them in synch.

> My context.xml:

Where is your context.xml file?  It should be in your webapp's META-INF 
directory.  If you've changed the global one in Tomcat's conf directory, put it 
back the way it was and put your  element in the proper location.

>  debug="99">

The path attribute is not allowed in a  element in context.xml; remove 
it.

> prefix="localhost_hamula_log." suffix=".txt"
> timestamp="true"/>

There is no  element in Tomcat 6; remove it.

>  auth="Container"
>  type="javax.sql.DataSource"
>  driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/hamula?autoReconnect=true"/>
>  username="root"
>  password="skywalker"
>  digest="MD5"
>  logAbandoned="true"
>  removeAbandoned="true"
>  removeAbandonedTimeout="10"
>  maxActive="20"
>  maxIdle="10"
>  maxWait="-1"/>

The above is obviously broken, since you have terminated the  element 
twice.  Regardless, it seems odd for the  and the application  
to be using the exact same data base; is that what you really want?

> back to the MemoryRealm for testing with FORM login; once 
you get that working, then move on to the JDBCRealm.  One step at a time.

You say you have httpd 2.0 in the mix; don't use it for testing, go straight to 
Tomcat's http port.  Only after that works should you introduce any further 
complications.

All of the above may not to fix your problem, but it will remove some confusion 
from your situation.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



URL is "null" and HTTP 404 error when using FROM authentication

2008-06-12 Thread exkor
Hi

I have this wierd problem i am trying to sovle for a week now, and i
already have gray hair from this mess.
My setup is Apache 2.0, Tomcat 6.0, MySQL 5.0.

I am requesting a protected page in my application:
http://127.0.0.1/myapp/home.jsp

and it takes me to the login page:
http://127.0.0.1/myapp/index.jsp

I type in my username + password and hit login, and brought back to
the login page.
I tried filtering the problem by using BASIC authentication + using
tomcat-users.xml which worked out fine.
FORM + tomcat-users.xml did not work out.

I am totally lost and begining to think that this is some kind of a
bug in j_security_check.
I saw somebody had a very very similar problem but I did not catche
the solution:
http://mail-archives.apache.org/mod_mbox/tomcat-users/200705.mbox/[EMAIL 
PROTECTED]

In addition I enabled "combined" logging and this is what I see:
127.0.0.1 - - [13/Jun/2008:00:32:45 -0400] "GET /hamula/home.jsp
HTTP/1.1" 200 2250 "null" "Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR
3.0.04506.30; InfoPath.1)"
127.0.0.1 - - [13/Jun/2008:00:32:45 -0400] "GET
/hamula/images/kubrickbgcolor.jpg HTTP/1.1" 404 1051
"http://127.0.0.1:8080/hamula/home.jsp"; "Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET
CLR 3.0.04506.30; InfoPath.1)"
127.0.0.1 - - [13/Jun/2008:00:32:49 -0400] "POST
/hamula/j_security_check HTTP/1.1" 200 2250
"http://127.0.0.1:8080/hamula/home.jsp"; "Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET
CLR 3.0.04506.30; InfoPath.1)"
127.0.0.1 - - [13/Jun/2008:00:32:49 -0400] "GET
/hamula/images/kubrickbgcolor.jpg HTTP/1.1" 404 1051
"http://127.0.0.1:8080/hamula/j_security_check"; "Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET
CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1)"


you can see that in the first entry i get "null" and then 404.
Why is it doing this??

My web.xml is:


http://java.sun.com/dtd/web-app_2_3.dtd";>

   Hamula
   
   
   
   
   
   0
   

   
   
 home.jsp
   
   


   
   DB Connection
   jdbc/hamula
   javax.sql.DataSource
   Container
   

   
   
   Hamula
   Pages accessible by registered users

   
   /home.jsp
   /events.jsp
   /profile.jsp
   /community.jsp
   
   


   DELETE
   GET
   POST
   PUT
   
   
   admin
   manager
   
   

   
   FORM
   
   /index.jsp
   /index.jsp
   
   

   
   
   The role that is required to access registered user functions and
   pages
   
   admin
   




My context.xml:



   

   
 username="root"
 password="skywalker"
 digest="MD5"
 logAbandoned="true"
 removeAbandoned="true"
 removeAbandonedTimeout="10"
 maxActive="20"
 maxIdle="10"
 maxWait="-1"/>


   


Thank you!
-Assaf

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]