Re: [SOLVED] Form Auth + xml users database

2005-02-08 Thread Omar Adobati
nobody can help me?


On Mon, 7 Feb 2005 09:57:32 +0100, Omar Adobati [EMAIL PROTECTED] wrote:
 Thx for ur answers, I have reied what you say about the second
 question, but it's do not work. This is how I have changed my
 context.xml file:
 ===
 ?xml version='1.0' encoding='utf-8'?
 Context privileged=true swallowOutput=true
 workDir=work\Catalina\photoalbum\ path=/ cacheTTL=0
 cachingAllowed=false displayName=bannerEmbedded beta docBase=.
 cacheMaxSize=0 reloadable=true
  Realm className=org.apache.catalina.realm.UserDatabaseRealm
 resourceName=PhotoAlbum/
  Valve className=org.apache.catalina.valves.AccessLogValve
 directory=logs/photoalbum/ fileDateFormat=-MM-dd suffix=.txt
 prefix=photoalbum_access_log./
  !--ResourceLink name=PhotoAlbum global=PhotoAlbum
 type=org.apache.catalina.UserDatabase/--
  Resource type=org.apache.catalina.UserDatabase description=User
 database that can be updated and saved auth=Container
 name=PhotoAlbum/
ResourceParams name=PhotoAlbum
parameter
  namefactory/name
  valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value
/parameter
parameter
  namepathname/name
  valueconf/Catalina/photoalbum.localhost/photoalbum-users.xml/value
/parameter
  /ResourceParams
 /Context
 ===
 
 I have removed the ResourceParams from the server.xml file and move it
 into the context.xml but in the log I can read this errors messages:
 1) javax.naming.NameNotFoundException: Name PhotoAlbum is not bound in
 this Context
 2) GRAVE: Catalina.start:
 LifecycleException:  No UserDatabase component found under key PhotoAlbum
 3) 2005-02-07 09:55:30 UserDatabaseRealm[photoalbum.localhost]:
 Exception looking up UserDatabase under key PhotoAlbum
 javax.naming.NameNotFoundException: Name PhotoAlbum is not bound in this 
 Context
 
 do u know why? I have I have give you all the elements you need to help me.
 
 On Sun, 06 Feb 2005 22:21:21 +0100, Mario Winterer
 [EMAIL PROTECTED] wrote:
  Hi!
 
  I'm happy you could solve your problem now! Seems the reason was the
  missing Realm-definition in your context.xml.
 
  To Question 1)
  Tomcat offers a separate JNDI-namespace for each web application (so if
  you have 4 web applications you will have 4 namespaces). These
  namespaces are configured in the context-elements of the corresponsing
  web-applications. To define resources, you have to nest a
  Resource-element in your context-element (which should be in
  context.xml).
  A resource that is defined in the namespace of a web application cannot
  be seen by other web applications (because the namespaces are separated
  from each other).
  Sometimes, a resource may be required by more than one web application.
  To avoid configuring this resource several times - once per context -
  tomcat offers another namespace that is global and exists only once per
  tomcat instance. If you define a resource there, you can use it in each
  web application, that is allowed to use it.
  So how can you allow a web application to use a global resource? Simply
  link the global resource into the local JNDI-namespace of the
  web-application! This can be done by nesting a ResourceLink element in
  the context element of the web-application that should be allowed to
  use the resource. When defining a ResourceLink-element, you must
  specify, which global resource you want to link into the namespace
  (attribut global), which type the resource is that you want to link
  (attribut type), and which name it should have in the local namespace
  (attribut name) - this name can be equal to the global name.
 
  So the server.xml and context.xml hierarchy could look like the
  following (sorry for the text-art - use a fixed width font for best
  results):
 
  +- Server
|
+- GlobalNamingResources
|  +- Resource GlobResA
|  +- Resource GlobResB
|
+- Service
   +- Engine
  +- Realm X
  +- Host www.A.org
  |  +- Context /A1 (defined in context.xml)
  |  |  +- ResourceLink to GlobResA, name: LocResA
  |  |
  |  +- Context /A2 (defined in context.xml)
  |  |  +- ResourceLink to GlobResA, name: LocResA
  |  |  +- ResourceLink to GlobResB, name: LocResB
  |  |
  |  +- Context /A3 (defined in context.xml)
  | +- Resource, name LocalResA
  |
  +- Host www.B.org
 +- Context /B1
 |  +- ResourceLink to GlobResA, name: LocResA
 |
 +- Context /B2
+- ResourceLink to GlobResB, name: LocResB
 
  Question 2) If you do not want to change server.xml (e.g. because you
  want to deploy your application to a foreign server and you cannot
  modify server.xml there), you could define a local JNDI-Resource in the
  context-element of your web-application instead of the
  GlobalNamingResource (simply move the resource-definition from
  GlobalNamingResource into your context-element). If you do this, of
  course you 

Re: [SOLVED] Form Auth + xml users database

2005-02-07 Thread Omar Adobati
Thx for ur answers, I have reied what you say about the second
question, but it's do not work. This is how I have changed my
context.xml file:
===
?xml version='1.0' encoding='utf-8'?
Context privileged=true swallowOutput=true
workDir=work\Catalina\photoalbum\ path=/ cacheTTL=0
cachingAllowed=false displayName=bannerEmbedded beta docBase=.
cacheMaxSize=0 reloadable=true
  Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=PhotoAlbum/
  Valve className=org.apache.catalina.valves.AccessLogValve
directory=logs/photoalbum/ fileDateFormat=-MM-dd suffix=.txt
prefix=photoalbum_access_log./
  !--ResourceLink name=PhotoAlbum global=PhotoAlbum
type=org.apache.catalina.UserDatabase/--
  Resource type=org.apache.catalina.UserDatabase description=User
database that can be updated and saved auth=Container
name=PhotoAlbum/
ResourceParams name=PhotoAlbum
parameter
  namefactory/name
  valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value
/parameter
parameter
  namepathname/name
  valueconf/Catalina/photoalbum.localhost/photoalbum-users.xml/value
/parameter
  /ResourceParams  
/Context
===

I have removed the ResourceParams from the server.xml file and move it
into the context.xml but in the log I can read this errors messages:
1) javax.naming.NameNotFoundException: Name PhotoAlbum is not bound in
this Context
2) GRAVE: Catalina.start: 
LifecycleException:  No UserDatabase component found under key PhotoAlbum
3) 2005-02-07 09:55:30 UserDatabaseRealm[photoalbum.localhost]:
Exception looking up UserDatabase under key PhotoAlbum
javax.naming.NameNotFoundException: Name PhotoAlbum is not bound in this Context

do u know why? I have I have give you all the elements you need to help me.


On Sun, 06 Feb 2005 22:21:21 +0100, Mario Winterer
[EMAIL PROTECTED] wrote:
 Hi!
 
 I'm happy you could solve your problem now! Seems the reason was the
 missing Realm-definition in your context.xml.
 
 To Question 1)
 Tomcat offers a separate JNDI-namespace for each web application (so if
 you have 4 web applications you will have 4 namespaces). These
 namespaces are configured in the context-elements of the corresponsing
 web-applications. To define resources, you have to nest a
 Resource-element in your context-element (which should be in
 context.xml).
 A resource that is defined in the namespace of a web application cannot
 be seen by other web applications (because the namespaces are separated
 from each other).
 Sometimes, a resource may be required by more than one web application.
 To avoid configuring this resource several times - once per context -
 tomcat offers another namespace that is global and exists only once per
 tomcat instance. If you define a resource there, you can use it in each
 web application, that is allowed to use it.
 So how can you allow a web application to use a global resource? Simply
 link the global resource into the local JNDI-namespace of the
 web-application! This can be done by nesting a ResourceLink element in
 the context element of the web-application that should be allowed to
 use the resource. When defining a ResourceLink-element, you must
 specify, which global resource you want to link into the namespace
 (attribut global), which type the resource is that you want to link
 (attribut type), and which name it should have in the local namespace
 (attribut name) - this name can be equal to the global name.
 
 So the server.xml and context.xml hierarchy could look like the
 following (sorry for the text-art - use a fixed width font for best
 results):
 
 +- Server
   |
   +- GlobalNamingResources
   |  +- Resource GlobResA
   |  +- Resource GlobResB
   |
   +- Service
  +- Engine
 +- Realm X
 +- Host www.A.org
 |  +- Context /A1 (defined in context.xml)
 |  |  +- ResourceLink to GlobResA, name: LocResA
 |  |
 |  +- Context /A2 (defined in context.xml)
 |  |  +- ResourceLink to GlobResA, name: LocResA
 |  |  +- ResourceLink to GlobResB, name: LocResB
 |  |
 |  +- Context /A3 (defined in context.xml)
 | +- Resource, name LocalResA
 |
 +- Host www.B.org
+- Context /B1
|  +- ResourceLink to GlobResA, name: LocResA
|
+- Context /B2
   +- ResourceLink to GlobResB, name: LocResB
 
 Question 2) If you do not want to change server.xml (e.g. because you
 want to deploy your application to a foreign server and you cannot
 modify server.xml there), you could define a local JNDI-Resource in the
 context-element of your web-application instead of the
 GlobalNamingResource (simply move the resource-definition from
 GlobalNamingResource into your context-element). If you do this, of
 course you do not need the ResourceLink any more!
 So you do not have to touch server.xml because all configurations can be
 done inside context.xml which is in the meta-inf directory of your web
 

Re: [SOLVED] Form Auth + xml users database

2005-02-06 Thread Omar Adobati
changes in server.xml:
===
GlobalNamingResources

  Resource type=org.apache.catalina.UserDatabase description=User
database that can be updated and saved auth=Container
name=PhotoAlbum/
ResourceParams name=PhotoAlbum
parameter
  namefactory/name
  valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value
/parameter
parameter
  namepathname/name
  valueconf/Catalina/photoalbum.localhost/photoalbum-users.xml/value
/parameter
  /ResourceParams  

/GlobalNamingResources
===

changes in [context].xml
===
?xml version='1.0' encoding='utf-8'?
Context privileged=true swallowOutput=true
workDir=work\Catalina\photoalbum\ path=/ cacheTTL=0
cachingAllowed=false displayName=bannerEmbedded beta docBase=.
cacheMaxSize=0 reloadable=true
  Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=PhotoAlbum/
  Valve className=org.apache.catalina.valves.AccessLogValve
directory=logs/photoalbum/ fileDateFormat=-MM-dd suffix=.txt
prefix=photoalbum_access_log./
  ResourceLink name=PhotoAlbum global=PhotoAlbum
type=org.apache.catalina.UserDatabase/
 /Context
===

Question 1)
Also if I've red the tomcat site docs I cant understand so good what
ResourceLink does. Does anyone can explain me?

Question 2)
Using this approach I have changed the server.xml manually. So, if I
need/want to deploy my own webapp using a war file, which approach I
have to use?

(I'm sorry fot my bad english...)

On Sun, 6 Feb 2005 20:00:04 +0100, Omar Adobati [EMAIL PROTECTED] wrote:
 But did you connect the UserDatabase
  with the web-application by specifying a realm in your context?
  (context.xml or server.xml)
 
 How can I set the Realm in my Context to specity an xml database?
 (maybe this is the main problem because it actually not exist)
 


-- 
Adobati Omar
[EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [SOLVED] Form Auth + xml users database

2005-02-06 Thread Mario Winterer
Hi!
I'm happy you could solve your problem now! Seems the reason was the 
missing Realm-definition in your context.xml.

To Question 1)
Tomcat offers a separate JNDI-namespace for each web application (so if 
you have 4 web applications you will have 4 namespaces). These 
namespaces are configured in the context-elements of the corresponsing 
web-applications. To define resources, you have to nest a 
Resource-element in your context-element (which should be in 
context.xml).
A resource that is defined in the namespace of a web application cannot 
be seen by other web applications (because the namespaces are separated 
from each other).
Sometimes, a resource may be required by more than one web application. 
To avoid configuring this resource several times - once per context - 
tomcat offers another namespace that is global and exists only once per 
tomcat instance. If you define a resource there, you can use it in each 
web application, that is allowed to use it.
So how can you allow a web application to use a global resource? Simply 
link the global resource into the local JNDI-namespace of the 
web-application! This can be done by nesting a ResourceLink element in 
the context element of the web-application that should be allowed to 
use the resource. When defining a ResourceLink-element, you must 
specify, which global resource you want to link into the namespace 
(attribut global), which type the resource is that you want to link 
(attribut type), and which name it should have in the local namespace 
(attribut name) - this name can be equal to the global name.

So the server.xml and context.xml hierarchy could look like the 
following (sorry for the text-art - use a fixed width font for best 
results):

+- Server
  |
  +- GlobalNamingResources
  |  +- Resource GlobResA
  |  +- Resource GlobResB
  |
  +- Service
 +- Engine
+- Realm X
+- Host www.A.org
|  +- Context /A1 (defined in context.xml)
|  |  +- ResourceLink to GlobResA, name: LocResA
|  |
|  +- Context /A2 (defined in context.xml)
|  |  +- ResourceLink to GlobResA, name: LocResA
|  |  +- ResourceLink to GlobResB, name: LocResB
|  |
|  +- Context /A3 (defined in context.xml)
| +- Resource, name LocalResA
|
+- Host www.B.org
   +- Context /B1
   |  +- ResourceLink to GlobResA, name: LocResA
   |
   +- Context /B2
  +- ResourceLink to GlobResB, name: LocResB
Question 2) If you do not want to change server.xml (e.g. because you 
want to deploy your application to a foreign server and you cannot 
modify server.xml there), you could define a local JNDI-Resource in the 
context-element of your web-application instead of the 
GlobalNamingResource (simply move the resource-definition from 
GlobalNamingResource into your context-element). If you do this, of 
course you do not need the ResourceLink any more!
So you do not have to touch server.xml because all configurations can be 
done inside context.xml which is in the meta-inf directory of your web 
application.

I hope, my explanations where understandable!
Best regards,
 Tex
Omar Adobati wrote:
changes in server.xml:
===
GlobalNamingResources
 Resource type=org.apache.catalina.UserDatabase description=User
database that can be updated and saved auth=Container
name=PhotoAlbum/
   ResourceParams name=PhotoAlbum
   parameter
 namefactory/name
 valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value
   /parameter
   parameter
 namepathname/name
 valueconf/Catalina/photoalbum.localhost/photoalbum-users.xml/value
   /parameter
 /ResourceParams  

/GlobalNamingResources
===
changes in [context].xml
===
?xml version='1.0' encoding='utf-8'?
Context privileged=true swallowOutput=true
workDir=work\Catalina\photoalbum\ path=/ cacheTTL=0
cachingAllowed=false displayName=bannerEmbedded beta docBase=.
cacheMaxSize=0 reloadable=true
 Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=PhotoAlbum/
 Valve className=org.apache.catalina.valves.AccessLogValve
directory=logs/photoalbum/ fileDateFormat=-MM-dd suffix=.txt
prefix=photoalbum_access_log./
 ResourceLink name=PhotoAlbum global=PhotoAlbum
type=org.apache.catalina.UserDatabase/
/Context
===
Question 1)
Also if I've red the tomcat site docs I cant understand so good what
ResourceLink does. Does anyone can explain me?
Question 2)
Using this approach I have changed the server.xml manually. So, if I
need/want to deploy my own webapp using a war file, which approach I
have to use?
(I'm sorry fot my bad english...)
On Sun, 6 Feb 2005 20:00:04 +0100, Omar Adobati [EMAIL PROTECTED] wrote:
 

But did you connect the UserDatabase
with the web-application by specifying a realm in your context?
(context.xml or server.xml)
 

How can I set the Realm in my Context to specity an xml database?
(maybe this is the main problem because it actually not exist)