Hi,

I'm using Tomcat v5.5.25 with two webbaps deployed as plain files (not
wars). Both of them use JNDI and do some initial binding upon webapp
(context) startup.
The "startup" event is determined by implementing a listener
(javax.servlet.ServletContextListener's contextInitialized method) and
placing it in WEB-INF/web.xml.

Now, there are (at least) two ways of defining/configuring webapp contexts:

1) by having both webapps defined in conf/server.xml, e.g.:

<Server ...>
  <GlobalNamingResources>
     <Resource name="foobar" auth="Container" type="java.util.HashMap"
factory="org.apache.naming.factory.BeanFactory"/>
  </GlobalNamingResources>

  <Service ...>
     <Connector.../>

     <Context path="" docBase="/path/to/my/webapp1">
        <ResourceLink global="foobar" name="local_foo" type="java.util.Map"/>
     </Context>
     <Context path="" docBase="/path/to/my/webapp2">
        <ResourceLink global="foobar" name="local_bar" type="java.util.Map"/>
     </Context>

  </Service>
</Server>

2) By having Context part defined separately, e.g. sitting in
conf/Catalina/localhost/webapp1.xml and
conf/Catalina/localhost/webapp2.xml

Now the difference between the two is that for the (1) case linked
JNDI resource ("java:comp/env/local_bar") is not available upon
startup - I'm getting "javax.naming.NameNotFoundException: Name
local_bar is not bound in this Context". Although when the config sits
separately from server.xml, as in case (2), everything works just fine
and JNDI contains all configured bindings/resource links.

The question is, is this a normal behavior or something that should be
addressed/fixed? Also, is there any bit of JNDI spec which would speak
of JNDI availability upon server/webapp startup?

I would prefer to use the (1) approach as in some cases I need to
specify the order of which webapp starts first while this is not
possible using (2).

Thanks indeed anyone for any ideas, really much appreciated.

Regards,
Mindaugas

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

Reply via email to