NullPointerException in Jetty's ContextLoader class.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

NullPointerException in Jetty's ContextLoader class.

Artur Zielazny
Hi

  I have problem wit embeded Jetty. My application needs to stop Jetty
in some circumstances, and then to launch it again.
  In the first start - work - stop cycle everything is ok, but when
the server is starting the second time NullPointerException occurs
while webapp is readed.
  While debugging I can see that in jetty's ContextLoader class
_parent is null and it causes this exception.

    public synchronized URL getResource(String name)
    {
        URL url= null;
        boolean tried_parent= false;
        if (_java2compliant || isSystemPath(name))
        {
            if (log.isTraceEnabled())
                log.trace("try getResource " + name + " from " + _parent);
            tried_parent= true;


[here _parent is null]

            url= _parent.getResource(name);
        }
        ....



I'm starting Jetty this way:

                                webServerSocketListener = new SocketListener();
                                webServerSocketListener.setPort(portNumber);
                                webServerSocketListener.setHost(usedInterface);

                                webServer = new Server();
                                webServer.setStatsOn(true);
                                webServer.addListener(webServerSocketListener);
                                webServer.addWebApplications(webAppPath);
                                webServer.start();


and stopping as follows:

                                webServer.stop();
                                webServer.removeListener(webServerSocketListener);
                                HttpContext[] c = webServer.getContexts();
                                for (HttpContext context : c) {
                                        webServer.removeContext(context);
                                }
                                webServer.destroy();
                                webServer = null;

                                webServerSocketListener = null;


Log with stack trace looks like this:


[main] DEBUG org.mortbay.jetty.servlet.Holder  - Started holder of
class org.apache.axis.transport.http.AdminServlet
[main] DEBUG org.mortbay.jetty.servlet.ServletHandler  - getRealPath
of /WEB-INF in org.mortbay.jetty.servlet.WebApplicationHandler@18c5e67
[main] DEBUG org.mortbay.jetty.servlet.ServletHandler  - getRealPath
of / in org.mortbay.jetty.servlet.WebApplicationHandler@18c5e67
[main] DEBUG org.mortbay.jetty.servlet.ServletHandler  - getRealPath
of /WEB-INF in org.mortbay.jetty.servlet.WebApplicationHandler@18c5e67
[main] DEBUG org.mortbay.http.ContextLoader  - try getResource
META-INF/services/org.apache.axis.EngineConfigurationFactory from null
[main] DEBUG org.mortbay.jetty.servlet.ServletHandler  - EXCEPTION
java.lang.NullPointerException
        at org.mortbay.http.ContextLoader.getResource(ContextLoader.java:265)
        at org.apache.commons.discovery.jdk.JDK12Hooks.getResources(JDK12Hooks.java:149)
        at org.apache.commons.discovery.resource.DiscoverResources$1.getNextResources(DiscoverResources.java:153)
        at org.apache.commons.discovery.resource.DiscoverResources$1.getNextResource(DiscoverResources.java:129)
        at org.apache.commons.discovery.resource.DiscoverResources$1.hasNext(DiscoverResources.java:116)
        at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.getNextClassNames(DiscoverNamesInFile.java:186)
        at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.getNextClassName(DiscoverNamesInFile.java:170)
        at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.hasNext(DiscoverNamesInFile.java:157)
        at org.apache.commons.discovery.resource.names.NameDiscoverers$1.getNextIterator(NameDiscoverers.java:143)
        at org.apache.commons.discovery.resource.names.NameDiscoverers$1.hasNext(NameDiscoverers.java:126)
        at org.apache.commons.discovery.resource.classes.ResourceClassDiscoverImpl$1.getNextResource(ResourceClassDiscoverImpl.java:159)
        at org.apache.commons.discovery.resource.classes.ResourceClassDiscoverImpl$1.hasNext(ResourceClassDiscoverImpl.java:147)
        at org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:120)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:113)
        at org.apache.axis.transport.http.AxisServletBase.getEngineEnvironment(AxisServletBase.java:273)
        at org.apache.axis.transport.http.AxisServletBase.getEngine(AxisServletBase.java:172)
        at org.apache.axis.transport.http.AxisServletBase.getOption(AxisServletBase.java:396)
        at org.apache.axis.transport.http.AxisServletBase.init(AxisServletBase.java:112)
        at javax.servlet.GenericServlet.init(GenericServlet.java:168)
        at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:383)
        at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:243)
        at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:445)
        at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:323)
        at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:511)
        at org.mortbay.util.Container.start(Container.java:72)
        at org.mortbay.http.HttpServer.doStart(HttpServer.java:753)
        at org.mortbay.util.Container.start(Container.java:72)


I will really appreciate any help in solving this issue !

Thank in advance. Regards !

-Artur Zielazny


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: NullPointerException in Jetty's ContextLoader class.

Greg Wilkins-5
Artur,

if you call destroy, you should not start the server.

Can you try just calling stop, doing your work and then calling start.

cheers



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: NullPointerException in Jetty's ContextLoader class.

Artur Zielazny
On 8/14/05, Greg Wilkins <[hidden email]> wrote:
> Artur,
>
> if you call destroy, you should not start the server.
>
> Can you try just calling stop, doing your work and then calling start.
>
> cheers

Thanks for Your reply... but unfortunately that wasn't it.

I'v made simple test case apart of all my application to be sure there
is no bad influence from my side to jetty. There are two tests: first
one just starts and stops server, and the second do the same but
twice.

This is that testCase:
---------------
public class WebServiceStartStopTest extends TestCase {

        private Server webServer;

        public void testStartStop() throws Exception {
                start();
                stop();
        }

        public void testDoubleStartStop() throws Exception {
                start();
                stop();
                start();
                stop();
        }

        private void start() throws Exception {

                webServer = new Server();

                SocketListener webServerSocketListener = new SocketListener();
                webServerSocketListener.setPort(8989);
                webServerSocketListener.setHost("127.0.0.1");

                webServer.addListener(webServerSocketListener);
                webServer.addWebApplications("./webapps");
                webServer.setStatsOn(true);
                webServer.start();

        }

        private void stop() throws InterruptedException {
                webServer.stop();
        }
}
-----------------

And the question is why the testDoubleStartStop() didn't pass, and how
to fix it ?

Stacktrace is:
[main] DEBUG org.mortbay.http.ContextLoader  - try getResource
META-INF/services/org.apache.axis.EngineConfigurationFactory from null
[main] DEBUG org.mortbay.jetty.servlet.ServletHandler  - EXCEPTION
java.lang.NullPointerException
        at org.mortbay.http.ContextLoader.getResource(ContextLoader.java:265)
        at org.apache.commons.discovery.jdk.JDK12Hooks.getResources(JDK12Hooks.java:149)
        at org.apache.commons.discovery.resource.DiscoverResources$1.getNextResources(DiscoverResources.java:153)
        at org.apache.commons.discovery.resource.DiscoverResources$1.getNextResource(DiscoverResources.java:129)
        at org.apache.commons.discovery.resource.DiscoverResources$1.hasNext(DiscoverResources.java:116)
        at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.getNextClassNames(DiscoverNamesInFile.java:186)
        at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.getNextClassName(DiscoverNamesInFile.java:170)
        at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.hasNext(DiscoverNamesInFile.java:157)
        at org.apache.commons.discovery.resource.names.NameDiscoverers$1.getNextIterator(NameDiscoverers.java:143)
        at org.apache.commons.discovery.resource.names.NameDiscoverers$1.hasNext(NameDiscoverers.java:126)
        at org.apache.commons.discovery.resource.classes.ResourceClassDiscoverImpl$1.getNextResource(ResourceClassDiscoverImpl.java:159)
        at org.apache.commons.discovery.resource.classes.ResourceClassDiscoverImpl$1.hasNext(ResourceClassDiscoverImpl.java:147)
        at org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:120)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:113)
        at org.apache.axis.transport.http.AxisServletBase.getEngineEnvironment(AxisServletBase.java:273)
        at org.apache.axis.transport.http.AxisServletBase.getEngine(AxisServletBase.java:172)
        at org.apache.axis.transport.http.AxisServletBase.getOption(AxisServletBase.java:396)
        at org.apache.axis.transport.http.AxisServletBase.init(AxisServletBase.java:112)
        at javax.servlet.GenericServlet.init(GenericServlet.java:168)
        at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:383)
        at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:243)
        at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:445)
        at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:323)
        at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:511)
        at org.mortbay.util.Container.start(Container.java:72)
        at org.mortbay.http.HttpServer.doStart(HttpServer.java:753)
        at org.mortbay.util.Container.start(Container.java:72)
        at wip.pc.soap.WebServiceStartStopTest.start(WebServiceStartStopTest.java:35)
        at wip.pc.soap.WebServiceStartStopTest.testDoubleStartStop(WebServiceStartStopTest.java:20)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
2005-08-16 10:33:00,550 [main] DEBUG
org.mortbay.jetty.servlet.WebApplicationHandler  - jsr154filter=null
2005-08-16 10:33:00,550 [main] INFO  org.mortbay.http.SocketListener
- Started SocketListener on 127.0.0.1:8989
2005-08-16 10:33:00,551 [SessionScavenger] DEBUG
org.mortbay.jetty.servlet.AbstractSessionManager  - Session scavenger
period = 30s




I will be grateful for any sugestions.
If this matters: Linux Debian, Java5.

Regards - Artur Zielazny !


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: NullPointerException in Jetty's ContextLoader class.

Artur Zielazny
Hi
I'v found something strange. My web application is Axis (WebService
framework) - and when I'm changing it to anything else all works
well...

But maybe you can give me, after all, any sugestions why with Axis
Jetty behaves like this ?

Regards and thanks - Artur !


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: NullPointerException in Jetty's ContextLoader class.

Greg Wilkins-5
In reply to this post by Artur Zielazny
Artur,

when you stop Jetty, you do not need to reconfigure it before starting it
again!

So you do NOT need to add listeners and you do not need to readd the webapplication.

I just did a test with the default axis webapp.   I put it in webapps and
ran

   java -jar start.jar etc/admin.xml etc/jetty.xml

I then used the admin servlet and was able to stop/start/stop/start as much
as I wanted.


However, I'm still puzzled by your NPE.   You really should just get
extra contexts and listeners added and in your second start you should
get a port already used exception????

regards



Artur Zielazny wrote:

> On 8/14/05, Greg Wilkins <[hidden email]> wrote:
>
>>Artur,
>>
>>if you call destroy, you should not start the server.
>>
>>Can you try just calling stop, doing your work and then calling start.
>>
>>cheers
>
>
> Thanks for Your reply... but unfortunately that wasn't it.
>
> I'v made simple test case apart of all my application to be sure there
> is no bad influence from my side to jetty. There are two tests: first
> one just starts and stops server, and the second do the same but
> twice.
>
> This is that testCase:
> ---------------
> public class WebServiceStartStopTest extends TestCase {
>
> private Server webServer;
>
> public void testStartStop() throws Exception {
> start();
> stop();
> }
>
> public void testDoubleStartStop() throws Exception {
> start();
> stop();
> start();
> stop();
> }
>
> private void start() throws Exception {
>
> webServer = new Server();
>
> SocketListener webServerSocketListener = new SocketListener();
> webServerSocketListener.setPort(8989);
> webServerSocketListener.setHost("127.0.0.1");
>
> webServer.addListener(webServerSocketListener);
> webServer.addWebApplications("./webapps");
> webServer.setStatsOn(true);
> webServer.start();
>
> }
>
> private void stop() throws InterruptedException {
> webServer.stop();
> }
> }
> -----------------
>
> And the question is why the testDoubleStartStop() didn't pass, and how
> to fix it ?
>
> Stacktrace is:
> [main] DEBUG org.mortbay.http.ContextLoader  - try getResource
> META-INF/services/org.apache.axis.EngineConfigurationFactory from null
> [main] DEBUG org.mortbay.jetty.servlet.ServletHandler  - EXCEPTION
> java.lang.NullPointerException
> at org.mortbay.http.ContextLoader.getResource(ContextLoader.java:265)
> at org.apache.commons.discovery.jdk.JDK12Hooks.getResources(JDK12Hooks.java:149)
> at org.apache.commons.discovery.resource.DiscoverResources$1.getNextResources(DiscoverResources.java:153)
> at org.apache.commons.discovery.resource.DiscoverResources$1.getNextResource(DiscoverResources.java:129)
> at org.apache.commons.discovery.resource.DiscoverResources$1.hasNext(DiscoverResources.java:116)
> at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.getNextClassNames(DiscoverNamesInFile.java:186)
> at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.getNextClassName(DiscoverNamesInFile.java:170)
> at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.hasNext(DiscoverNamesInFile.java:157)
> at org.apache.commons.discovery.resource.names.NameDiscoverers$1.getNextIterator(NameDiscoverers.java:143)
> at org.apache.commons.discovery.resource.names.NameDiscoverers$1.hasNext(NameDiscoverers.java:126)
> at org.apache.commons.discovery.resource.classes.ResourceClassDiscoverImpl$1.getNextResource(ResourceClassDiscoverImpl.java:159)
> at org.apache.commons.discovery.resource.classes.ResourceClassDiscoverImpl$1.hasNext(ResourceClassDiscoverImpl.java:147)
> at org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:120)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:113)
> at org.apache.axis.transport.http.AxisServletBase.getEngineEnvironment(AxisServletBase.java:273)
> at org.apache.axis.transport.http.AxisServletBase.getEngine(AxisServletBase.java:172)
> at org.apache.axis.transport.http.AxisServletBase.getOption(AxisServletBase.java:396)
> at org.apache.axis.transport.http.AxisServletBase.init(AxisServletBase.java:112)
> at javax.servlet.GenericServlet.init(GenericServlet.java:168)
> at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:383)
> at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:243)
> at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:445)
> at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:323)
> at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:511)
> at org.mortbay.util.Container.start(Container.java:72)
> at org.mortbay.http.HttpServer.doStart(HttpServer.java:753)
> at org.mortbay.util.Container.start(Container.java:72)
> at wip.pc.soap.WebServiceStartStopTest.start(WebServiceStartStopTest.java:35)
> at wip.pc.soap.WebServiceStartStopTest.testDoubleStartStop(WebServiceStartStopTest.java:20)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> 2005-08-16 10:33:00,550 [main] DEBUG
> org.mortbay.jetty.servlet.WebApplicationHandler  - jsr154filter=null
> 2005-08-16 10:33:00,550 [main] INFO  org.mortbay.http.SocketListener
> - Started SocketListener on 127.0.0.1:8989
> 2005-08-16 10:33:00,551 [SessionScavenger] DEBUG
> org.mortbay.jetty.servlet.AbstractSessionManager  - Session scavenger
> period = 30s
>
>
>
>
> I will be grateful for any sugestions.
> If this matters: Linux Debian, Java5.
>
> Regards - Artur Zielazny !
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: NullPointerException in Jetty's ContextLoader class.

Artur Zielazny
Hi !

On 8/17/05, Greg Wilkins <[hidden email]> wrote:
> Artur,
> when you stop Jetty, you do not need to reconfigure it before starting it
> again!
> So you do NOT need to add listeners and you do not need to readd the webapplication.

Yes.. you are right of corse. All this because of combinations to make
it working ! At the beginning it was just start and stop, but it
didn't work - so i'v started to make things more complicated ;-)

> I just did a test with the default axis webapp.   I put it in webapps and
> ran
>
>    java -jar start.jar etc/admin.xml etc/jetty.xml
>
> I then used the admin servlet and was able to stop/start/stop/start as much
> as I wanted.

Ok, but you have to consider thad calling this stop.jar cause that
class org.mortbay.start.Monitor simply invokes System.exit(0) method.
So, in fact every start-stop cycle is absolutely separate form
another. It is not the case of my application or JUnit's test neither.
In this cases containing application is still running - only Jetty is
stopped and started...

> However, I'm still puzzled by your NPE.   You really should just get
> extra contexts and listeners added and in your second start you should
> get a port already used exception????

I didn't get "address already in use" exception just because this npe
was thrown before.

I'dont want to bore You with this, so for the last time, I promise ;-)
****
public class WebServiceStartStopTest extends TestCase {
        private Server webServer;

        public void testDoubleStartStop() throws Exception {
                start();
                stop();
                start();
                stop();
        }

        private void start() throws Exception {
                if (webServer == null) {
                        webServer = new Server();
                        SocketListener webServerSocketListener = new SocketListener();
                        webServerSocketListener.setPort(8989);
                        webServerSocketListener.setHost("127.0.0.1");
                        webServer.addListener(webServerSocketListener);
                        webServer.addWebApplications("./webapps");
                        webServer.setStatsOn(true);
                }

                webServer.start();
        }

        private void stop() throws InterruptedException {
                webServer.stop();
        }
}
****

With "regular" webapplication "jsp-examples"-like everytrhing is ok,
but with axis i have this NPE. Maybe I have to post to Axis community
with this... However - if sb has any other sugestions - I will
appreciate.

Thanks for help, and I will post here if I'll find the solution.

Regards !


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: NullPointerException in Jetty's ContextLoader class.

Greg Wilkins-5

There was a bug added to the listener that stopped it opening the socket on
the second start.

Fixed in 5.1.5rc1, so give that a try.

cheers



Artur Zielazny wrote:

> Hi !
>
> On 8/17/05, Greg Wilkins <[hidden email]> wrote:
>
>>Artur,
>>when you stop Jetty, you do not need to reconfigure it before starting it
>>again!
>>So you do NOT need to add listeners and you do not need to readd the webapplication.
>
>
> Yes.. you are right of corse. All this because of combinations to make
> it working ! At the beginning it was just start and stop, but it
> didn't work - so i'v started to make things more complicated ;-)
>
>
>>I just did a test with the default axis webapp.   I put it in webapps and
>>ran
>>
>>   java -jar start.jar etc/admin.xml etc/jetty.xml
>>
>>I then used the admin servlet and was able to stop/start/stop/start as much
>>as I wanted.
>
>
> Ok, but you have to consider thad calling this stop.jar cause that
> class org.mortbay.start.Monitor simply invokes System.exit(0) method.
> So, in fact every start-stop cycle is absolutely separate form
> another. It is not the case of my application or JUnit's test neither.
> In this cases containing application is still running - only Jetty is
> stopped and started...
>
>
>>However, I'm still puzzled by your NPE.   You really should just get
>>extra contexts and listeners added and in your second start you should
>>get a port already used exception????
>
>
> I didn't get "address already in use" exception just because this npe
> was thrown before.
>
> I'dont want to bore You with this, so for the last time, I promise ;-)
> ****
> public class WebServiceStartStopTest extends TestCase {
> private Server webServer;
>
> public void testDoubleStartStop() throws Exception {
> start();
> stop();
> start();
> stop();
> }
>
> private void start() throws Exception {
> if (webServer == null) {
> webServer = new Server();
> SocketListener webServerSocketListener = new SocketListener();
> webServerSocketListener.setPort(8989);
> webServerSocketListener.setHost("127.0.0.1");
> webServer.addListener(webServerSocketListener);
> webServer.addWebApplications("./webapps");
> webServer.setStatsOn(true);
> }
>
> webServer.start();
> }
>
> private void stop() throws InterruptedException {
> webServer.stop();
> }
> }
> ****
>
> With "regular" webapplication "jsp-examples"-like everytrhing is ok,
> but with axis i have this NPE. Maybe I have to post to Axis community
> with this... However - if sb has any other sugestions - I will
> appreciate.
>
> Thanks for help, and I will post here if I'll find the solution.
>
> Regards !
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support