Classloader/Classpath problem on plugin development

Hi,

I'm working on a plugin that needs a web container (in my case jetty 8+weld), but no matter how I configure my dependencies jetty always throws "java.lang.NoClassDefFoundError: javax/servlet/Servlet" (attached complete stacktrace) when I try to start jetty. Here is a code snippet of my container startup:

        final URL url = MyPluginRegistration.class.getClassLoader().getResource( "embedded.war" );
        final WebAppContext context = new WebAppContext();

        context.setWar( url.toExternalForm() );
        context.setServerClasses( new String[]{
                "-org.eclipse.jetty.servlet.",
                "-org.eclipse.jetty.server.handler." } );
        context.setContextPath( "/" );

        server = new Server( 8080 );
        server.setHandler( context );

        server.start();

  Some notes: my embedded.war is available as a resource, internally my war application has several dependencies (including weld for CDI).

  I've tried several different configurations, but none seems to be effective as I'm always getting the same exception. In my lib directory I have all jetty dependencies (including servlet-api) as you can see in attached image (screenshot of dependencies). 


  Any idea? Tips are welcome (as this is my first experience with intellij plugin). My setup is MacOS, Java7 + IntelliJ 13.

  Btw: Just to be clear about the purpose of a web container: this plugin is a research project that is trying to bridge web based editors and IDEs (basically the idea is re-use web based editors). We already have this working on Eclipse, but I need to be sure that we have it working on most important IDEs.



Attachment(s):
stacktrace.txt.zip
intellij-plugin.png

Please sign in to leave a comment.