Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368291 - NoSuchFieldException thrown during stopping an embedded jetty instance
Summary: NoSuchFieldException thrown during stopping an embedded jetty instance
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 7.6.0.RC3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 7.5.x   Edit
Assignee: Jan Bartel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-10 14:56 EST by David Carver CLA
Modified: 2012-01-11 20:22 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Carver CLA 2012-01-10 14:56:48 EST
When calling the server.stop() from an embedded jetty server being used during unit tests, the following stacktrace is logged as a warning:

2012-01-10 14:49:29.856:WARN:oejsl.ELContextCleaner:Cannot purge classes from javax.el.BeanELResolver
java.lang.NoSuchFieldException: properties
	at java.lang.Class.getDeclaredField(Class.java:1882)
	at org.eclipse.jetty.servlet.listener.ELContextCleaner.getField(ELContextCleaner.java:91)
	at org.eclipse.jetty.servlet.listener.ELContextCleaner.contextDestroyed(ELContextCleaner.java:53)
	at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:769)
	at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:144)
	at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:479)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:84)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStop(HandlerWrapper.java:102)
	at org.eclipse.jetty.server.Server.doStop(Server.java:322)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:84)
	at com.intalio.core.email.test.BaseTestCase.stopWebapp(BaseTestCase.java:45)
	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:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:36)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Nothing fancy being done with the setup, it's pretty basic.

	private static final String contextPath = "/test-rest";
	private static final String warLocation = "src/test/webapp";
	
	private static final int RANDOM_PORT = 0;

	@BeforeClass
	public static void startWebapp() throws Exception {
		server = new Server(RANDOM_PORT); 
		
		WebAppContext webAppContext = new WebAppContext();
		webAppContext.setContextPath(contextPath);
		webAppContext.setWar(warLocation);

		server.setHandler(webAppContext);

		server.start();
	}

	@AfterClass
	public static void stopWebapp() throws Exception {
		server.stop();
	}
Comment 1 Jan Bartel CLA 2012-01-10 18:37:16 EST
Hi Dave,

What's the jvm version? And I guess this is being run as a unit test inside Eclipse?

ta
Jan
Comment 2 Jan Bartel CLA 2012-01-10 18:56:57 EST
Nevermind, I was getting this cleaner mixed up with the IntrospectorCleaner.

The problem is that you have some other javax.el api jar on the classpath in eclipse that contains a BeanELResolver that does not have a field called "properties". Maybe I should change the error message, because if you don't have a field called "properties", it won't have cached the beans and therefore it doesn't need cleaning :)

cheers
Jan
Comment 3 Jan Bartel CLA 2012-01-11 20:22:26 EST
Warning changed to info for 7.6.0-RC4/8.1.0-RC4