title: ClassCastException: MyFilter cannot be cast to javax.servlet.Filter
body: <p>I'm migrating an application to JBoss 7, where all dependencies were in <code>"JBOSS_HOME/server/default/lib"</code> (JBoss 4). I included the lib <code>"servlet.jar"</code> (javax.servlet. *), however, after setting a <a href="https://docs.jboss.org/author/display/AS71/Developer+Guide#DeveloperGuide-GlobalModules" rel="nofollow">Global Module for JBoss 7</a> (modules.xml, standalone.xml, jboss-deployment-structure.xml in war files), libraries are loaded normally by JBoss. </p>
  
  <p>When JBoss 7 tries to start the filters, I get following exception:</p>
  
  <pre><code>15:09:15,222 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/RegistrarValorDolar]] (MSC service thread 1-2) Exception starting filter cripto: java.lang.ClassCastException: cenpra.com.sigtec.business.utilities.SessionFilter cannot be cast to javax.servlet.Filter
  at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:]
  at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
  at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
  at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
  at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
  at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_15]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_15]
  at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_15]
  </code></pre>
  
  <p>Trying to remove the library "servlet.jar" from Global Modules, in a try that the server loads it's own classes using an internal jar, I got a <code>ClassNotFoundException</code>of <code>javax.servlet.Filter</code> class.</p>
  
  <ul>
  <li>I want to use global modules, since I need to reuse a lot of libraries.</li>
  </ul>