On Fri, 15 Mar 2002, Nikola Milutinovic wrote:
> Date: Fri, 15 Mar 2002 20:46:47 +0100
> From: Nikola Milutinovic <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: jndi versus database connection pooling
>
> Craig R. McClanahan wrote:
>
> >
> > In 4.0.x, automatically deployed contexts with no <Context> entry do not
> > have any resources assigned to match up the resource references.
> > Therefore, you must explicitly define such webapps in the server.xml file
> > to give them access to the corresponding JNDI resources.
>
>
> What's the story on double deployment? Can it make a mess of my
> operation?
I'm not sure what you mean by "double deployment".
If you're worried about the same webapp getting auto-deployed more than
once in the same virtual host (simply because you declare it as a
<Context> in server.xml), that doesn't happen because auto-deploy checks
to see if the context path is already in use.
To see this in action, look at how the examples webapp is delivered in the
default Tomcat configuration. Even though the "examples" directory is in
"webapps" (so it would normally get auto-deployed) *and* it is listed
specifically in server.xml, the app is only deployed once.
> What wouldbe the preferable way of handling multiple virtual
> hosts with JNDI on my mind?
>
> So far, I've been just creating one user account per virtual host, make a
> ./webapp dir and setup <Host ...> so it has appbase point to ~account/webapp.
> Then I would add any "system" contexts, like /docs and /manager.
>
That seems like a pretty reasonable approach to me.
>
> > In the HEAD branch (what will become 4.1), Tomcat supports the notion of a
> > separate "context descriptor file", which is an XML file that just
> > contains the <Context> element for a particular webapp, plus all of its
> > nested elements. This gives you the following options (in addition to the
> > auto-deploy support in 4.0):
> >
> > * Put a context description file in the appBase
> > directory and that webapp will be auto-deployed
> > with its resource definitions.
> >
> > * Use the /install command of the Manager webapp
> > to dynamically deploy a context description file
> > (and associated WAR or webapp directory).
> >
> > You can see this in action with a nightly build of Tomcat 4 -- the Admin
> > and Manager webapps themselves are deployed in this way.
>
> So, this is a CVS beta or what? Anyway, it looks nice.
>
It's visible if you build from CVS yourself, or if you grab one of the
recent nightly builds:
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/nightly/
> Oh, and one last thing. I'm using 4.0.1 and like some other guys, SAX is
> spitting an error on my web.xml:
>
> PARSE error at line 68 column 11
> org.xml.sax.SAXParseException: The content of element type "web-app" must match
> "(icon?,display-name?,des
>
>cription?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,sessi
>
>on-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-
> constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
>
> My web.xml file is:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
>
> <web-app>
> <description>E-Mail address book Admin GUI</description>
>
> <servlet>
> <servlet-name>OrgUnitServlet</servlet-name>
> <servlet-class>yu.co.ev.EVnet.mail.OrgUnitServlet</servlet-class>
> <init-param>
> <param-name>RedirectURL</param-name>
> <param-value>orgUnitDisplay.jsp?id=</param-value>
> <description>URL to redirect a client</description>
> </init-param>
> </servlet>
> <servlet-mapping>
> <servlet-name>OrgUnitServlet</servlet-name>
> <url-pattern>/servlets/OrgUnit</url-pattern>
> </servlet-mapping>
>
> <servlet>
> <servlet-name>EmailUserServlet</servlet-name>
> <servlet-class>yu.co.ev.EVnet.mail.EUserServlet</servlet-class>
> <init-param>
> <param-name>RedirectURL</param-name>
> <param-value>eUserDisplay.jsp?id=</param-value>
> <description>URL to redirect a client</description>
> </init-param>
> </servlet>
> <servlet-mapping>
> <servlet-name>EmailUserServlet</servlet-name>
> <url-pattern>/servlets/EUser</url-pattern>
> </servlet-mapping>
>
> <resource-ref>
> <description>
> javax.sql.DataSource for this application,
> as configured in server.xml
> </description>
> <res-ref-name>jdbc/AddressBookDB</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>container</res-auth>
> </resource-ref>
> </web-app>
>
> The only thing I've done is add <resource-ref> part. The ordering of
> elements seams to be OK. So, what could be the problem?
>
This file looks ok, but the XML parser is complaining about line 68 -- and
this one doesn't have that many lines. Check your other web.xml files as
well.
> Nix.
>
Criag
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>