Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SEVERE: Exception starting filter CORS

I have RESTful web service deployed on tomcat' the web service is working fine in the client/server on same domain scenario' but I am required to make the Web Service available from cross domain' for this purpose I have used CORS filter.

I have included filter's jars in both myProjects/lib and tomcat/lib' and also have included following in my web.xml file of web service project'

<filter>
    <filter-name>CORS</filter-name>
    <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
</filter>

<init-param>
    <param-name>cors.supportedHeaders</param-name>
    <param-value>Accept, Origin, X-Requested-With, Content-Type, Last-Modified</param-value>
</init-param>

<filter-mapping>
    <filter-name>CORS</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping> 

But when I try to start the web service I get following error regarding CORS filter:

SEVERE: Exception starting filter CORS
java.lang.NoClassDefFoundError: com/thetransactioncompany/util/PropertyParseException
at com.thetransactioncompany.cors.CORSFilter.init(CORSFilter.java:100)

kindly guide me to figure out what is wrong with this situation'

like image 205
pointer Avatar asked May 06 '13 08:05

pointer


2 Answers

You need to add java-properties-utils-1.7.1.jar file to the classpath too as the cors filter has a dependancy on it.

http://search.maven.org/#browse%7C-411787350

like image 144
EvenStevens Avatar answered Nov 17 '22 00:11

EvenStevens


In my case, adding these 2 jar files in the tomcat lib folder solved the issue:

  • cors-filter-2.5.jar
  • java-property-utils-1.10.jar
like image 43
FAZIL MAHAMMOOD ABDULLAH Avatar answered Nov 16 '22 22:11

FAZIL MAHAMMOOD ABDULLAH