tags:

views:

124

answers:

0

Hello,

I'm using the echo2 web framework in my application. But trying to start it in JRun4 returns the following exception:

26/02 17:12:21 user Remote: init
26/02 17:12:22 error
[1]java.lang.NullPointerException
    at nextapp.echo2.app.util.PropertiesDiscovery.loadProperties(PropertiesDiscovery.java:67)
    at nextapp.echo2.app.util.PeerFactory.<init>(PeerFactory.java:66)
    at nextapp.echo2.webcontainer.SynchronizePeerFactory.<clinit>(SynchronizePeerFactory.java:40)
    at nextapp.echo2.webcontainer.ContainerSynchronizeService.renderInit(ContainerSynchronizeService.java:426)
    at nextapp.echo2.webrender.service.SynchronizeService.service(SynchronizeService.java:269)
    at nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273)
    at nextapp.echo2.webrender.WebRenderServlet.doPost(WebRenderServlet.java:189)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at com.inet.remote.gui.RemoteGuiServlet.service(SourceFile:182)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

Echo2 uses .properties files to map the components to their peers.

The NPE occurres in the line with "in.close();" in the following function. Is there something configurable to ensure that JRun4 can open the stream to the properties files?

public static Map loadProperties(String resourceName, ClassLoader classLoader) 
throws IOException {
    Map propertyMap = new HashMap();
    Enumeration resources = classLoader.getResources(resourceName);
    while (resources.hasMoreElements()) {
        URL resourceUrl = (URL) resources.nextElement();
        Properties peerProperties = new Properties();
        InputStream in = resourceUrl.openStream();
        try {
            peerProperties.load(in);
            propertyMap.putAll(peerProperties);
        } finally {
            in.close();
        }
    }
    return propertyMap;
}

Or any other idea what I can do to get it running?

Thanks.