-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Tarin,

On 3/8/18 1:56 PM, Mark Thomas wrote:
> On 08/03/18 18:53, Tarin Gamberini wrote:
>> On 08/03/2018 17:52, Rémy Maucherat wrote:
>>> On Thu, Mar 8, 2018 at 5:26 PM, Tarin Gamberini
>>>> [cut] # PROBLEM
>>>> 
>>>> I have two datasources in the same web application:
>>>> 
>>>> <ResourceLink global="jdbc/abc/ABC" name="jdbc/abc" 
>>>> type="javax.sql.DataSource"/> <ResourceLink
>>>> global="jdbc/abc/jkl/XXX_YYY" name="jdbc/abc/jkl" 
>>>> type="javax.sql.DataSource"/> [cut]
>>> 
>>> Well, you have "abc" that s already bound and is a datasource,
>>> then you try to create a subcontext "abc" and it doesn't work.
>>> 
>> Sorry, I'm not sure I have understood what you mean. Just for
>> clarification:
>> 
>> 1. By «you have "abc" that s already bound and is a datasource»
>> are you thinking about the "abc" just after "jdbc/" in
>> «global="jdbc/abc/ABC"» ?
>> 
>> 2. By «then you try to create a subcontext "abc"» are you
>> thinking about the ending ABC in «global="jdbc/abc/ABC"» ?
> 
> No. Look at the names, not the global names.

It might help to understand a bit about how JNDI works. It's very much
like a filesystem where you have directories and files. A particular
path name can either be a file or a directory, but not both.

For example, on a standard *NIX system, you can't have a file called
/etc because there needs to be an /etc directory with files in it.

In your case, you are first creating a DataSource (the analogy here is
a file) called "jdbc/abc", and then you are trying to create another
DataSource "inside" that path "jdbc/abc" called "jdbc/abd/ABC". In
order to create "jdbc/abc/ABC", the path "jdbc/abc" must be a
directory, not a file. (In JNDI, it must be a Context, but it's a
DataSource instead).

If you were thinking that the JNDI namespace was like a map of
full-paths -> objects:

comp:env/java/jdbc/abc     -> DataSource
comp:env/java/jdbc/abc/ABC -> DataSource

It doesn't work that way. Instead, the / character actually separates
parts of the hierarchy and each part has to have the expected type,
like this:

comp:env -> context
            java -> context
                    jdbc -> context
                            abc -> DataSource
                                   [can't create a path below a DS]

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlqhkqQdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFhrTg/+Ie9oIxVnXmoufSO/
vb0kRtrdhPx4KVCqVbsU9imOPpgXD6aDIxdIHs0iIFCxuQTVsJ7duIa5n9Dd3MDp
zM9E17L/wIHvGTeiuwvb6a6OWgnX1MDS9HX3UC1X9dd11DKVpWDyOeywTPiSSUn5
DWtGPyjwThVRlvX6anOUZfcNWkoGxaB/3TSyA02n6eeuhCSNLQgJJLNddwIwJTDy
/EJs2/u3HBS1KrH0aRHyPmsPEdishgbXCqj3n+AKeE6jeJvNS3VSaWbtgZ+2EHto
0f1QDSwrfOd0LEx0tv8z9TuF3cyH4F8NObnK6p9s50ogZjnjLG9kPENKe6gNznEJ
QIjzrtSr4ba8gCrmQ9hnYO40p+fiwFpCFkg2LRMmhzWHsuEfifNogud3yEmqg4+L
7s/zpL5qz0NA+LypX2mPZZq7DW893icZbncn9e/z7krQVz9gn/ETi0ejhwMBsi8n
UVlGbc9HzsUBVHD/XVMPuX3INM/ycQZHfShKK4NIp7tea/K9xQADox4yBOMzKUFM
JHZc/uPePuGAKQcN7bZkGLtVZ8Jk5sjV8uA8uayb3kWF3wRF/EdwkoebXDBArmcd
dpSJOp6u7J3QdaR63Lx9QeI1GOqzJWDrH3KGqpoOmAw4sOXBROWdAl3VtpluonTE
ri5hYpkVOQvrO5svchLr8QLn+Og=
=70hm
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to