You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tim Lucia <ti...@yahoo.com> on 2004/01/06 16:00:20 UTC

NullPointerException at ActionServlet.java:1003 using JRun4; work OK under Tomcat/JWSDP1.2

All,

I have a struts application using modules which deploys fine under
JWSDP1.2/Tomcat (5, I think), but when I deploy it under (trial edition
of) JRun4, I get 

java.lang.NullPointerException
	at
org.apache.struts.action.ACtionServlet.parseModuleConfigFile(ActionServl
et.java:1003)
.
.
.

Peeking at the source, it looks like it's trying to read a config file,
presumably for my module.

Anyone seen this before?  How did you overcome this problem?

Thanks,
Tim


    private void parseModuleConfigFile(
        String prefix,
        String paths,
        ModuleConfig config,
        Digester digester,
        String path)
        throws UnavailableException {

        InputStream input = null;
        try {
            URL url = getServletContext().getResource(path);
            InputSource is = new InputSource(url.toExternalForm()); //
########## 1003 ###
            input = getServletContext().getResourceAsStream(path);
            is.setByteStream(input);
            digester.parse(is);
            getServletContext().setAttribute(Globals.MODULE_KEY +
prefix, config);
            
        } catch (MalformedURLException e) {
            handleConfigException(paths, e);
        } catch (IOException e) {
            handleConfigException(paths, e);
        } catch (SAXException e) {
            handleConfigException(paths, e);
        } finally {
            if (input != null) {
                try {
                    input.close();
                } catch (IOException e) {
                    throw new UnavailableException(e.getMessage());
                }
            }
        }
    }



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: NullPointerException at ActionServlet.java:1003 using JRun4; work OK under Tomcat/JWSDP1.2

Posted by Tim Lucia <ti...@yahoo.com>.
I have solved this myself.  It appears that JRun4 considers
"tim.web.xml" as part of "web.xml", and so it tried to load a config
file that did not exist.

(Any Struts developers reading?? -- Would it be possible in a future
release of Struts to actually say "resource not found:
/WEB-INF/module/struts-config-module.xml" rather then
NullPointerException?)

Tim


> -----Original Message-----
> From: Tim Lucia [mailto:timlucia@yahoo.com] 
> Sent: Tuesday, January 06, 2004 10:00 AM
> To: 'Struts Users Mailing List'
> Subject: NullPointerException at ActionServlet.java:1003 
> using JRun4; work OK under Tomcat/JWSDP1.2
> 
> 
> All,
> 
> I have a struts application using modules which deploys fine 
> under JWSDP1.2/Tomcat (5, I think), but when I deploy it 
> under (trial edition
> of) JRun4, I get 
> 
> java.lang.NullPointerException
> 	at 
> org.apache.struts.action.ACtionServlet.parseModuleConfigFile(A
> ctionServl
> et.java:1003)
> .
> .
> .
> 
> Peeking at the source, it looks like it's trying to read a 
> config file, presumably for my module.
> 
> Anyone seen this before?  How did you overcome this problem?
> 
> Thanks,
> Tim
> 
> 
>     private void parseModuleConfigFile(
>         String prefix,
>         String paths,
>         ModuleConfig config,
>         Digester digester,
>         String path)
>         throws UnavailableException {
> 
>         InputStream input = null;
>         try {
>             URL url = getServletContext().getResource(path);
>             InputSource is = new 
> InputSource(url.toExternalForm()); // ########## 1003 ###
>             input = getServletContext().getResourceAsStream(path);
>             is.setByteStream(input);
>             digester.parse(is);
>             
> getServletContext().setAttribute(Globals.MODULE_KEY + prefix, config);
>             
>         } catch (MalformedURLException e) {
>             handleConfigException(paths, e);
>         } catch (IOException e) {
>             handleConfigException(paths, e);
>         } catch (SAXException e) {
>             handleConfigException(paths, e);
>         } finally {
>             if (input != null) {
>                 try {
>                     input.close();
>                 } catch (IOException e) {
>                     throw new UnavailableException(e.getMessage());
>                 }
>             }
>         }
>     }
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org