Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319013 - java.lang.ClassNotFoundException when testing a servlet with ServletTester
Summary: java.lang.ClassNotFoundException when testing a servlet with ServletTester
Status: RESOLVED WONTFIX
Alias: None
Product: Jetty
Classification: RT
Component: other (show other bugs)
Version: 7.1.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 7.1.x   Edit
Assignee: Jesse McConnell CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-06 10:32 EDT by Tomasz Zarna CLA
Modified: 2010-10-06 17:25 EDT (History)
1 user (show)

See Also:


Attachments
full stack (26.09 KB, text/plain)
2010-07-06 10:32 EDT, Tomasz Zarna CLA
no flags Details
test project (18.65 KB, application/zip)
2010-07-06 10:34 EDT, Tomasz Zarna CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2010-07-06 10:32:32 EDT
Created attachment 173561 [details]
full stack

I was trying to write a simple servlet test as described here: http://docs.codehaus.org/display/JETTY/ServletTester

I created a tiny servlet which only purpose was to say hi. I copy-pasted the test setup and grabbed HttpTester.java and ServletTester.java from SVN trunk, since I couldn't find any jar with them.

This is the result I get when I run the test (I'll attach the full stack in a minute):

<...>
16:12:55.083 [main] DEBUG org.eclipse.jetty.util.log - starting ServletContextHandler@154ec5@154ec5/context-test,null
16:12:55.115 [main] DEBUG org.eclipse.jetty.util.log - Starting hello.HelloServlet-10759305
16:12:55.130 [main] WARN  org.eclipse.jetty.util.log - EXCEPTION 
java.lang.ClassNotFoundException: hello.HelloServlet
	at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.6.0_17]
	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_17]
	at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.6.0_17]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.6.0_17]
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.6.0_17]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.6.0_17]
	at org.eclipse.core.runtime.internal.adaptor.ContextFinder.loadClass(ContextFinder.java:129) ~[na:na]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.6.0_17]
	at org.eclipse.jetty.util.Loader.loadClass(Loader.java:90) ~[org.eclipse.jetty.util_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.util.Loader.loadClass(Loader.java:70) ~[org.eclipse.jetty.util_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.servlet.Holder.doStart(Holder.java:74) ~[org.eclipse.jetty.servlet_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:224) [org.eclipse.jetty.servlet_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55) [org.eclipse.jetty.util_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:691) [org.eclipse.jetty.servlet_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:204) [org.eclipse.jetty.servlet_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:588) [org.eclipse.jetty.server_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55) [org.eclipse.jetty.util_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92) [org.eclipse.jetty.server_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.server.Server.doStart(Server.java:228) [org.eclipse.jetty.server_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55) [org.eclipse.jetty.util_7.1.4.v20100610.jar:7.1.4.v20100610]
	at org.eclipse.jetty.testing.ServletTester.start(ServletTester.java:86) [hello/:na]
	at hello.tests.ServletsTest.setUp(ServletsTest.java:22) [hello/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_17]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.6.0_17]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.6.0_17]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.6.0_17]
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit.jar:na]
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit.jar:na]
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit.jar:na]
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) [junit.jar:na]
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) [junit.jar:na]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) [junit.jar:na]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [junit.jar:na]
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit.jar:na]
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit.jar:na]
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit.jar:na]
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit.jar:na]
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit.jar:na]
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit.jar:na]
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) [org.eclipse.jdt.junit4.runtime_1.1.100.v20100520-0800.jar:na]
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [org.eclipse.jdt.junit.runtime_3.4.200.v20100520-0800.jar:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [org.eclipse.jdt.junit.runtime_3.4.200.v20100520-0800.jar:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [org.eclipse.jdt.junit.runtime_3.4.200.v20100520-0800.jar:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [org.eclipse.jdt.junit.runtime_3.4.200.v20100520-0800.jar:na]
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) [org.eclipse.pde.junit.runtime_3.4.100.v20100504.jar:na]
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23) [org.eclipse.pde.junit.runtime_3.4.100.v20100504.jar:na]
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.start(UITestApplication.java:49) [org.eclipse.pde.junit.runtime_3.4.100.v20100504.jar:na]
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) [org.eclipse.equinox.app_1.3.0.v20100512.jar:na]
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) [org.eclipse.osgi_3.6.0.v20100517.jar:na]
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) [org.eclipse.osgi_3.6.0.v20100517.jar:na]
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) [org.eclipse.osgi_3.6.0.v20100517.jar:na]
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) [org.eclipse.osgi_3.6.0.v20100517.jar:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_17]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.6.0_17]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.6.0_17]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.6.0_17]
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) [org.eclipse.equinox.launcher_1.1.0.v20100507.jar:na]
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) [org.eclipse.equinox.launcher_1.1.0.v20100507.jar:na]
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407) [org.eclipse.equinox.launcher_1.1.0.v20100507.jar:na]
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383) [org.eclipse.equinox.launcher_1.1.0.v20100507.jar:na]
<...>
Comment 1 Tomasz Zarna CLA 2010-07-06 10:34:59 EDT
Created attachment 173562 [details]
test project

Here is the project I created to illustrate the issue. I launch the test with HelloServletTest.launch.
Comment 2 Jesse McConnell CLA 2010-07-16 16:20:30 EDT
the artifacts with those classes should be in 

http://repo2.maven.org/maven2/org/eclipse/jetty/test-jetty-servlet/

Past that it looks like a classpath problem as I don't see anything in your attached project that seems to indicate the use of maven..just some sort of .launch file and what looks like some sort of eclipse specific setup.
Comment 3 Jesse McConnell CLA 2010-10-06 17:25:02 EDT
closing as won't fix unless more information comes in about the execution environment and it is something we have control over somehow