Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WLS 6.0--getResource( "/" ) and NullPointerException

0 views
Skip to first unread message

Garvin Dean

unread,
Apr 6, 2001, 5:32:12 AM4/6/01
to
We're migrating from tomcat to WLS6.0 (servlet/jsp). Our app is
deployed in a war file and has been targeted as the default application
for a VirtualHost. The app has no trouble finding servlets/jsp's, but it
keeps throwing NullPointerException's for getResource("/") calls on
ServletContext objects. I know that the appropriate Exception is
"MalformedURLException for this method, but I'm getting a
NullPointerException. When I look at sc.getRealPath( "/" ) and
sc.getResource( "/" ) in tomcat, they are both correctly pathed to
/export/home/tomcat/webapps/commonweb. However, WLS6.0 returns "null"
for both. What I need it to return is commonweb for the root.
Here's the line of code:
ServletContext sc = getServletContext();
...
URL cyber_url = null;
try
{
cyber_url = sc.getResource("/");
}
catch( Exception e )
{
//DEBUG
System.out.println( "doGet() encountered Exception on sc.getResource(
/ ) " );
ErrorLog.log( strClassName, "doGet",
"URL object is null!", true,
"garvi...@cybersensor.com");
return;
}
...

Here's the Exception:
doGet() encountered NullPointerException, see following stackTrace for
more details:
java.lang.NullPointerException
at com.cybersensor.servlets.webdriver.doGet(webdriver.java:173)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:249)
at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:167)
at
weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:104)
at
jsp_servlet._generic_rain_gauge._index._jspService(_index.java:85)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:244)
at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:249)
at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:167)
at
com.cybersensor.webutils.VHResolution.doWork(VHResolution.java:94)
at
com.cybersensor.webutils.VHResolution.doGet(VHResolution.java:24)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:249)
at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:167)
at
weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:104)
at jsp_servlet._index._jspService(_index.java:85)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:244)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1127)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1529)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

I read the newsgroup and things that have not worked so far include:
1. Adding ContextPath="commonweb" to web.xml
2. Creating a physical structure outside of mydomain/applications and
setting ContextPath
to that path.
3. Deploying the application as a static directory structure instead of
a war file.

What I'm not sure of is whether there is a parameter that needs to be
configured in the config/web/weblogic.xml files that I'm missing out
on.

Please, all help and comments will be greatly appreciated.

Thanks!

Garvin

Garvin Dean

unread,
Apr 9, 2001, 11:55:06 AM4/9/01
to
Does anyone have experience with this problem?
0 new messages