users@glassfish.java.net

Re: Default web module causes context problems. Any solution?

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Mon, 26 Feb 2007 18:10:38 -0800

glassfish_at_javadesktop.org wrote On 02/26/07 05:55 PM,:

>Heyho!
>
>We have a web application set to the /myapp context in Sun Application Server 9. In the admin gui, I defaulted our virtual server to that web application. I.e. "Configuration" -> "Http Service" -> "Virtual Servers" -> "server" -> "Default web module: myapp".
>
>My web app uses the SAS connection pools (work very well). I access the pool using the usual context connection code, i.e.:
>[code]
>initContext = new InitialContext();
>source = (DataSource) initContext.lookup("java:comp/env/jdbc/mydb");
>conn = source.getConnection();
>[/code]
>
>With the default web module set to the web application, I can access the web application at http://www.culpamea.com/ and at http://www.culpamea.com/myapp/.
>
>When I redeploy the web application (I use Netbeans 5.5), the redeploy works perfectly. When I load the application at it's usual URL (http://www.culpamea.com/myapp/) pages that use the database work correctly.
>
>BUT, after redeploy (but without restarting the domain), pages that I attempt to access at http://www.culpamea.com/ (without the context) do not load! The log error that appears is
>[code]
>javax.naming.NameNotFoundException: No object bound for java:comp/env/jdbc/oraclesccweb [Root exception is java.lang.NullPointerException]
>[/code]
>
>So, using the default web module and accessing my web app at the / context causes a problem with looking up JDNI resource names.
>
>Is there a way to correct that? We would like to allow our users to access the application at the root context /.
>
>

Can you try one of the recent GlassFish V2 builds?

In GlassFish V2, we've simplified the default-web-module mechanism
quite a bit.

In GlassFish V1 and earlier SJSAS versions, we used to treat "/" and
"/webapp" (where "webapp" has been designated as the virtual-server's
default-web-module) as separate web modules, which was inefficient
and resulted in unnecessary code complexity. Under the covers, the
container would create a copy of "/webapp" and deploy it at "/".

In GlassFish V2, we no longer duplicate "/webapp" at "/". Instead, we make
the *same* copy of "webapp" available at both "/webapp" and "/".


Jan

>dailysun
>[Message sent by forum member 'dailysun' (dailysun)]
>
>http://forums.java.net/jive/thread.jspa?messageID=205375
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>