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'
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.
It might have been a version issue. I had the same problem and it turns out this filter requires at minimum Tomcat version 7.0.41 to work, according to: http://enable-cors.org/server_tomcat.html
As reference, Debian 7.8 ships Tomcat 7.0.28, which does not support native CORS.
I had the same problem. In my case, the problem was that the maven dependencies had been deleted from the Deployment Assembly
section in project properties
. Hope it helps someone.
In my case, adding these 2 jar files in the tomcat lib folder solved the issue:
I had same prob but in ma case, first, my server status was unbound, so I changed it through 'Build path' But still didn't work.. my friend checked and he found Eclipse's 'Build Automatically' function. then it worked well !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.