Header Ad

Saturday, December 28, 2013

Property 'defaultTargetUrl' threw exception; nested exception is java.lang.IllegalArgumentException: defaultTarget must start with '/' or with 'http(s)'




This is happened to be spring configuration related issue.


Make sure spring-security.xml is correct in all ways.
I found reason behind is my default-target-url was incorrect.
It was without / i.e. default-target-url="test" it should be default-target-url="/test".

Help more people:- Share this link, or comment if you have any suggestion.

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: You must use a 3.0 schema with Spring Security 3.0.(2.0 or 3.1 versions are not valid) Please update your schema declarations to the 3.0.3 schema (spring-security-3.0.3.xsd).

Look like you have mis-match w.r.t your spring version.

For example in pom.xml or in your lib folder you have Spring 3.0 jar files whereas in spring-security.xml is having greater version of spring.

Solution is: Either updated spring version in as jar/pom.xml or change in spring-security.xml.

Help more people:- Share this link, or comment if you have any suggestion.





Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/log4j.dtd]

Check your log4j.xml it must be looking for log4j.dtd

<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
Instead you can use


<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">


Remember:- Help more people by sharing this link, and you may comment if you have any suggestion.

java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?

Let me give you some background what is actually happening in your code.

  1.  You must be using Listener in your class.
  2. While spring container is getting in its life its trying to load listeners too.
  3. But in your web.xml does not know where it is, or how to load
  4. So just add it and run your code again.


<listener>        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>    </listener>
in your web.xml file

Remember:- Help more people by sharing this link, and you may comment if you have any suggestion.