users@glassfish.java.net

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

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 26 Feb 2007 18:03:08 -0800

Hi,

me again :-) Do you have the full stack trace of the NPE? That will help
knowing if the bug is inside the WebContainer or somewhere else.

Thanks

-- Jeanfrancois

glassfish_at_javadesktop.org wrote:
> 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 /.
>
> 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
>