Tuesday, 20 May 2014

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet 

I was stuck for last couple of days on this error. So made it the title of this post. A very simple exception - ClassNotFound. We know the jar is missing but what if we know that the exception persists even if the jar is present.

I used Ivy as my dependency manager. To know more on Apache Ivy you can refer to my detailed post I posted earlier.

My directory Structure was

There are two ways to resolve this error

  1. Either move your libraries to WEB-INF/lib . Because this is the folder from where Eclipse searches for corresponding jars. OR
  2. Let Eclipse know that it can search the jars from ivy library folder which is not same as WEB-INF/lib.  So now I will explain how to resolve above problem with 2nd approach in Eclipse.

  • Right click the project and select properties. Now go to Deployment Assembly.

  • Now select Add and select Java build path entries.

  • Ivy option is automatically populated. Select that.

  • And you are done.Select Apply and Ok. ClassNotFound Exception vanishes.

That's it for resolving the issue. This issue may also occur if you genuinely don't have the corresponding jar in the lib folder :P . In that case you have to add the Jar. Dependencies I used for my Spring MVC project were

        <dependency org="org.springframework" name="spring-core" rev="4.0.3.RELEASE"/>
        <dependency org="org.springframework" name="spring-context" rev="4.0.3.RELEASE"/>
        <dependency org="org.springframework" name="spring-web" rev="4.0.3.RELEASE"/>
        <dependency org="org.springframework" name="spring-webmvc" rev="4.0.3.RELEASE"/>
        <dependency org="org.springframework" name="spring-beans" rev="4.0.3.RELEASE"/>

Important Links

Saturday, 10 May 2014

Download and Install cURL on Windows

Introduction to cURL

As per Wiki

cURL is a computer software project providing a library and command-line tool for transferring data using various protocols. The cURL project produces two products, libcurl and cURL. It was first released in 1997.

In this post we will see how do we install this tool and use it to perform some common HTTP requests like GET.

Installing cURL on Windows

  1. Go to curl Download Wizard
  2.  Select curl executable
  3. Select Win32 or Win64
  4. Then select package for it(Eg generic/cygwin) as per your requirement
  5. Then you will have to select version. You can select unspecified.
  6. This will directly take you to download link which on click will give you popup to download the zip file.
  7. Extract the zip to get the executable.(I have put the executable in C:\Curl
  8. Add this folder in your environment variables and you are done.

  9. You can then execute curl command from cmd.

PS : I had some problems with proxy. Though I don't have one cURL seems to pick it from somewhere. I was using that proxy about a year ago and have not used since. Not sure where cURL picks this confog from. But as a workaround I have use

curl --noproxy * websiteURL

This will essentially disable proxy. But you may not have to do so.

For more reading on various practical usages of curl command you may refer to

15 Practical Linux cURL Command Examples

Important Links

t> UA-39527780-1 back to top