java - Tomcat SEVERE: Exception starting filter CorsFilter, ClassNotFoundException -


i'm trying enable cors java servlet following class:

package com.prosperity.mobile.core;  import java.io.ioexception;  import javax.servlet.filter; import javax.servlet.filterchain; import javax.servlet.filterconfig; import javax.servlet.servletexception; import javax.servlet.servletrequest; import javax.servlet.servletresponse; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse;  public class corsfilter implements filter {      @override     public void init(filterconfig filterconfig) throws servletexception {     }      public void dofilter(servletrequest servletrequest,             servletresponse servletresponse, filterchain chain)             throws ioexception, servletexception {         httpservletrequest request = (httpservletrequest) servletrequest;         // system.out.println("request: " + request.getmethod());          httpservletresponse resp = (httpservletresponse) servletresponse;         resp.addheader("access-control-allow-origin", "*");         resp.addheader("access-control-allow-methods", "get,post");         resp.addheader("access-control-allow-headers",                 "origin, x-requested-with, content-type, accept");          // accept , reply ok if options         if (request.getmethod().equals("options")) {             resp.setstatus(httpservletresponse.sc_ok);             return;         }         chain.dofilter(request, servletresponse);     }      @override     public void destroy() {     } } 

my xml:

<filter>         <filter-name>corsfilter</filter-name>     <filter-class>com.prosperity.mobile.core.corsfilter</filter-class> </filter>  <filter-mapping>     <filter-name>corsfilter</filter-name>     <url-pattern>*</url-pattern> </filter-mapping> 

and when try , deploy war tomcat instance:

severe: exception starting filter corsfilter java.lang.classnotfoundexception: com.prosperity.mobile.core.corsfilter     @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1718)     @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1569)     @ org.apache.catalina.core.defaultinstancemanager.loadclass(defaultinstancemanager.java:529)     @ org.apache.catalina.core.defaultinstancemanager.loadclassmaybeprivileged(defaultinstancemanager.java:511)     @ org.apache.catalina.core.defaultinstancemanager.newinstance(defaultinstancemanager.java:139)     @ org.apache.catalina.core.applicationfilterconfig.getfilter(applicationfilterconfig.java:258)     @ org.apache.catalina.core.applicationfilterconfig.<init>(applicationfilterconfig.java:105)     @ org.apache.catalina.core.standardcontext.filterstart(standardcontext.java:4809)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5485)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:901)     @ org.apache.catalina.core.containerbase.addchild(containerbase.java:877)     @ org.apache.catalina.core.standardhost.addchild(standardhost.java:632)     @ org.apache.catalina.startup.hostconfig.deploywar(hostconfig.java:1073)     @ org.apache.catalina.startup.hostconfig$deploywar.run(hostconfig.java:1857)     @ java.util.concurrent.executors$runnableadapter.call(unknown source)     @ java.util.concurrent.futuretask.run(unknown source)     @ java.util.concurrent.threadpoolexecutor.runworker(unknown source)     @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source)     @ java.lang.thread.run(unknown source)  sep 21, 2015 11:49:35 org.apache.catalina.core.standardcontext startinternal severe: error filterstart sep 21, 2015 11:49:35 org.apache.catalina.core.standardcontext startinternal severe: context [/prosperitymobile] startup failed due previous errors 

which seems pretty obvious error, it's complaining it's not finding corsfilter class.. it's there, in correct package , everything?!

as note: tomcat instance located at: c:\apache-tomcat-7.0.52

unzip war file , triple check class file there.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -