title: NoClassDefFoundError when using Glassfish
body: <p>I'm building a web application. When I run it on Tomcat, everything's working without a problem. But if I use Glassfish, I'm getting NoClassDefFoundError exception. Why is that? The class it's throwing an exception for is imported by Maven and as I said, Tomcat doesn't have any problem with running the application and finding the class. Why is there a problem with Glassfish?</p>
  
  <p>A stacktrace I'm getting:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: org/openrdf/rio/RDFHandlerException    
  
  
  
  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 com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)    
  
  at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)    
  
  at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)    
  
  at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)    
  
  at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)    
  
  at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)    
  
  at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)    
  
  at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)    
  
  at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)    
  
  at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)    
  
  at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)    
  
  at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)    
  
  at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)    
  
  at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)    
  
  at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)    
  
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)    
  
  at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)    
  
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)    
  
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)    
  
  at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)    
  
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)    
  
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)    
  
  at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)    
  
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)    
  
  at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)    
  
  at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)    
  
  at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)    
  
  at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)    
  
  at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)    
  
  at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)    
  
  at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)    
  
  at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)    
  
  at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)    
  
  at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)    
  
  at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)    
  
  at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)    
  
  at com.sun.grizzly.ContextTask.run(ContextTask.java:71)    
  
  at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)    
  
  at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)    
  
  at java.lang.Thread.run(Thread.java:662)    
  
  Caused by: java.lang.ClassNotFoundException: org.openrdf.rio.RDFHandlerException    
  
  at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1509)    
  
  at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)    
  
  ... 45 more
  
  java.lang.ClassNotFoundException: org.openrdf.rio.RDFHandlerException
      at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1509)
      at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
      at pl.psnc.synat.web.Service.runMapping(Service.java:68)
      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 com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
      at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
      at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
      at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
      at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>