Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364372

Summary: NPE in org.eclipse.jetty.io.nio.SelectorManager.register()
Product: [RT] Jetty Reporter: Gili Mising name <cowwoc2020>
Component: serverAssignee: Jan Bartel <janb>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: janb, jetty-inbox
Version: unspecified   
Target Milestone: 7.5.x   
Hardware: PC   
OS: Windows 7   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=362614
Whiteboard:

Description Gili Mising name CLA 2011-11-21 11:36:40 EST
Build Identifier: 8.0.4.v20111024

2011-11-21 11:27:44.187,WARN,org.eclipse.jetty.server.AbstractConnector$Acceptor.run,qtp12610028-11 Acceptor0 SelectChannelConnector@0.0.0.0:50253 STARTING 
java.lang.NullPointerException: null
	at org.eclipse.jetty.io.nio.SelectorManager.register(SelectorManager.java:158) ~[jetty-io-8.0.4.v20111024.jar:8.0.4.v20111024]
	at org.eclipse.jetty.server.nio.SelectChannelConnector.accept(SelectChannelConnector.java:101) ~[jetty-server-8.0.4.v20111024.jar:8.0.4.v20111024]
	at org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:833) ~[jetty-server-8.0.4.v20111024.jar:8.0.4.v20111024]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598) [jetty-util-8.0.4.v20111024.jar:8.0.4.v20111024]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533) [jetty-util-8.0.4.v20111024.jar:8.0.4.v20111024]
	at java.lang.Thread.run(Thread.java:722) [na:1.7.0_01]


Reproducible: Sometimes

Steps to Reproduce:
Here's my code:

	public void start() throws IOException
	{
		final WebAppContext context = new WebAppContext();
		context.setServer(server);
		context.setWar("foo.war");

		// If the WAR file contains a different library versions we get a LinkageError.

		// Furthermore, we must use addSystemClass() instead of addServerClass() since we want to make 
		// use of logback.xml and ApplicationHome which are only visible from this classloader.
		context.addSystemClass("org.slf4j.");
		context.addSystemClass("ch.qos.logback.");
		context.addSystemClass(ApplicationHome.class.getName());

		// JPeripheral depends on Jace's native library which is loaded on the system classloader by
		// the native launcher. If we allow the webapp to load JPeripheral in its own classloader,
		// System.loadLibrary() will complain that Jace is already loaded by another classloader.
		context.addSystemClass("org.jperipheral.");

		server.setHandler(context);

		try
		{
			server.start();
			DateTime timeout = DateTime.now().plusSeconds(10);
			while (!server.isRunning())
			{
				Thread.sleep(300);
				if (DateTime.now().isAfter(timeout))
					throw new IOException("Server did not start after 10 seconds");
			}
		}
		catch (IOException e)
		{
			throw e;
		}
		catch (Exception e)
		{
			log.error("", e);
		}
	}

It's not clear what effect this exception has. The webapp seems to run as expected.
Comment 1 Jan Bartel CLA 2011-11-21 18:49:59 EST
Gili,

I think this is a duplicate of https://bugs.eclipse.org/bugs/show_bug.cgi?id=362614, which has already been resolved, both for jetty-7 and jetty-8 and will be going out with the next releases of each (currently scheduled as 7.6.0 and 8.1.0 respectively).

Jan

*** This bug has been marked as a duplicate of bug 362614 ***