<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>schlikkes</title>
	<atom:link href="http://schlikkes.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://schlikkes.wordpress.com</link>
	<description>IT since 1995 - from turbo pascal to jee</description>
	<lastBuildDate>Mon, 11 Jul 2011 09:34:29 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='schlikkes.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>schlikkes</title>
		<link>http://schlikkes.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://schlikkes.wordpress.com/osd.xml" title="schlikkes" />
	<atom:link rel='hub' href='http://schlikkes.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Struts 2: default action is not found</title>
		<link>http://schlikkes.wordpress.com/2011/07/07/struts-2-default-action-is-not-found/</link>
		<comments>http://schlikkes.wordpress.com/2011/07/07/struts-2-default-action-is-not-found/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 13:58:31 +0000</pubDate>
		<dc:creator>schlikkes</dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[Action]]></category>
		<category><![CDATA[Struts 2]]></category>

		<guid isPermaLink="false">http://schlikkes.wordpress.com/?p=27</guid>
		<description><![CDATA[I changed a lot configuration in struts.xml and web.xml and after a while the welcome-file tag was ignored by Struts 2 and i got ERROR Dispatcher:38 - Could not find action or result /att/ There is no Action mapped for namespace / and action name . - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189) when I called the app just by <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schlikkes.wordpress.com&amp;blog=24771627&amp;post=27&amp;subd=schlikkes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I changed a lot configuration in <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">struts.xml </span>and <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">web.xml </span>and after a while the <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">welcome-file </span>tag was ignored by Struts 2 and i got</p>
<pre>ERROR Dispatcher:38 - Could not find action or result
/att/
There is no Action mapped for namespace / and action name . - [unknown location]
	at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)</pre>
<p>when I called the app just by its domain (e.g. <em>http://www.myapp.com</em>). Just the usage of the <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">action </span>itself worked properly (e.g.<em> http://www.myapp.com/showLogin.action</em>).</p>
<p>Solving this issue took me days (&#8217;cause of the existing workaround) but it was just a copy- &amp; past-thing in combination with wrong configured examples. Where ever you read about Struts 2 examples a <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">web.xml </span>looks like this:</p>
<pre>&lt;!-- Default --&gt;

&lt;filter&gt;
    &lt;filter-name&gt;struts2&lt;/filter-name&gt;
    &lt;filter-class&gt;
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    &lt;/filter-class&gt;
&lt;/filter&gt;

&lt;filter-mapping&gt;
    &lt;filter-name&gt;struts2&lt;/filter-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/filter-mapping&gt;</pre>
<p>If you change the <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">url-pattern </span>of the <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">filter-mapping </span>from <em>/*</em> to<em> *.action</em> everthing works as supposed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schlikkes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schlikkes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schlikkes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schlikkes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/schlikkes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/schlikkes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/schlikkes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/schlikkes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schlikkes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schlikkes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schlikkes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schlikkes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schlikkes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schlikkes.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schlikkes.wordpress.com&amp;blog=24771627&amp;post=27&amp;subd=schlikkes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://schlikkes.wordpress.com/2011/07/07/struts-2-default-action-is-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb39d80c7253eb49e61719057a4a5961?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schlikkes</media:title>
		</media:content>
	</item>
		<item>
		<title>Spring 3: Spring-Security</title>
		<link>http://schlikkes.wordpress.com/2011/07/07/spring-3-spring-security/</link>
		<comments>http://schlikkes.wordpress.com/2011/07/07/spring-3-spring-security/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 13:35:45 +0000</pubDate>
		<dc:creator>schlikkes</dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://schlikkes.wordpress.com/?p=20</guid>
		<description><![CDATA[As I currently evaluate some frameworks and how the can be used in further projects I thought &#8216;let&#8217;s have a look at Spring security for authentication and authorization&#8217;. You need just some simple steps to include Spring security into your Spring project. First of all you need the necessary lib. In a Maven project just add the <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schlikkes.wordpress.com&amp;blog=24771627&amp;post=20&amp;subd=schlikkes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As I currently evaluate some frameworks and how the can be used in further projects I thought &#8216;let&#8217;s have a look at Spring security for authentication and authorization&#8217;. You need just some simple steps to include Spring security into your Spring project.</p>
<p>First of all you need the necessary lib. In a Maven project just add the following dependency to your <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">pom.xml</span>:</p>
<pre>&lt;dependency&gt;
   &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
   &lt;artifactId&gt;spring-security-core&lt;/artifactId&gt;
   &lt;version&gt;${org.springframework_spring_version}&lt;/version&gt;
&lt;/dependency&gt;

&lt;dependency&gt;
   &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
   &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
   &lt;version&gt;${org.springframework_spring_version}&lt;/version&gt;
&lt;/dependency&gt;</pre>
<p>(<span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">${org.springframework_spring_version} </span>is set to &#8217;3.0.5.RELEASE&#8217; so I just have one version information for all Spring libs)</p>
<p>As second step you need a security context configuration file in your classpath e.g. <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">security-applicationContext.xml</span>:</p>
<pre>&lt;beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"&gt;

    &lt;http use-expressions="true"&gt;
        &lt;intercept-url pattern="/**" access="permitAll" /&gt;
        &lt;form-login /&gt;
    &lt;/http&gt;

    &lt;authentication-manager&gt;
        &lt;authentication-provider&gt;
            &lt;user-service&gt;
                &lt;user name="rod" password="koala" authorities="supervisor, teller, user" /&gt;
                &lt;user name="dianne" password="emu" authorities="teller, user" /&gt;
                &lt;user name="scott" password="wombat" authorities="user" /&gt;
                &lt;user name="peter" password="opal" authorities="user" /&gt;
            &lt;/user-service&gt;
        &lt;/authentication-provider&gt;
    &lt;/authentication-manager&gt;
&lt;/beans:beans&gt;</pre>
<p>The third step is to tell your web application to use the security filter. This is made within the <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">web.xml</span>. The context-param has to be edited like this:</p>
<pre>&lt;context-param&gt;
   &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
   	&lt;param-value&gt;
   	 classpath:applicationContext.xml
   	 classpath:security-applicationContext.xml
   &lt;/param-value&gt;
&lt;/context-param&gt;</pre>
<p>&#8230; and the filter has to be added:</p>
<pre>&lt;filter&gt;
   &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
   &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
&lt;/filter&gt;

&lt;filter-mapping&gt;
   &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
   &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/filter-mapping&gt;</pre>
<p>That&#8217;s it. BUT you will get the following error message when starting your web server (like Jetty or Tomcat):</p>
<pre><code>org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security] Offending resource: ServletContext resource [classpath:spring-applicationContext.xml]</code></pre>
<p>It took me hours to solve this issue. The error message better should say, &#8216;You are missing a dependency&#8230;&#8217;      :/       &#8217;cause adding</p>
<pre>&lt;dependency&gt;
   &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
   &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
   &lt;version&gt;${org.springframework_spring_version}&lt;/version&gt;
&lt;/dependency&gt;</pre>
<p>to your <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">pom.xml</span> solves the problem.</p>
<p>Now you are ready to use Spring security in your web project.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schlikkes.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schlikkes.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schlikkes.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schlikkes.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/schlikkes.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/schlikkes.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/schlikkes.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/schlikkes.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schlikkes.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schlikkes.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schlikkes.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schlikkes.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schlikkes.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schlikkes.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schlikkes.wordpress.com&amp;blog=24771627&amp;post=20&amp;subd=schlikkes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://schlikkes.wordpress.com/2011/07/07/spring-3-spring-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb39d80c7253eb49e61719057a4a5961?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schlikkes</media:title>
		</media:content>
	</item>
		<item>
		<title>Spring 3 and JUnit 4 &#8211; How To</title>
		<link>http://schlikkes.wordpress.com/2011/07/04/spring-3-and-junit-4-how-to/</link>
		<comments>http://schlikkes.wordpress.com/2011/07/04/spring-3-and-junit-4-how-to/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 09:11:34 +0000</pubDate>
		<dc:creator>schlikkes</dc:creator>
				<category><![CDATA[DEV]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://schlikkes.wordpress.com/?p=11</guid>
		<description><![CDATA[To use Spring components like services within JUnit you need to tell JUnit to run in a Spring context in order to use Spring configured beans (doesn&#8217;t matter whether they are configured by annotation or XML). Maven pre-requisites: JUnit and Spring-Test in your Spring project&#8217;s pom.xml &#60;dependency&#62; &#60;groupId&#62;junit&#60;/groupId&#62; &#60;artifactId&#62;junit&#60;/artifactId&#62; &#60;version&#62;4.8.1&#60;/version&#62; &#60;/dependency&#62; &#60;dependency&#62; &#60;groupId&#62;org.springframework&#60;/groupId&#62; &#60;artifactId&#62;spring-test&#60;/artifactId&#62; &#60;version&#62;3.0.5.RELEASE&#60;/version&#62; &#60;/dependency&#62; After <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schlikkes.wordpress.com&amp;blog=24771627&amp;post=11&amp;subd=schlikkes&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To use Spring components like services within JUnit you need to tell JUnit to run in a Spring context in order to use Spring configured beans (doesn&#8217;t matter whether they are configured by annotation or XML).</p>
<p>Maven pre-requisites: JUnit and Spring-Test in your Spring project&#8217;s pom.xml</p>
<pre>&lt;dependency&gt;
    &lt;groupId&gt;junit&lt;/groupId&gt;
    &lt;artifactId&gt;junit&lt;/artifactId&gt;
    &lt;version&gt;4.8.1&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
    &lt;groupId&gt;org.springframework&lt;/groupId&gt;
    &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
    &lt;version&gt;3.0.5.RELEASE&lt;/version&gt;
&lt;/dependency&gt;</pre>
<p>After setting this up, all you need to do is tell JUnit to run with another runner class and where to Spring configuration is stored:</p>
<pre>@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/applicationContext-test.xml" })
public class TestdatenGenerator</pre>
<p>The configuration file has to be located in <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">src/test/resources. </span>Without the <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">@ContextConfiguration</span>-annotation the configuration file has to be named after the class you want to test (e.g. <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">TestdatenGenerator_context.xml</span>). This means you can configure a different Spring context for every test class. But you are also able to inherit the Spring configuration (from your project configuration or other test configurations). To achieve this the <span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;">applicationContext-test.xml </span>could be look like this:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;

	&lt;import resource="applicationContext.xml" /&gt;

&lt;/beans&gt;</pre>
<p><span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:13px;line-height:19px;white-space:normal;">If configured as seen above you are able to use injected and Spring instantiated resources as you are used to:</span></p>
<pre>@Resource
private MandantenService mandantenService;
[...]
@Test
public void doSomething() {
    Mandant persMandant = mandantenService.findByName(mandant.getName());
}</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/schlikkes.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/schlikkes.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/schlikkes.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/schlikkes.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/schlikkes.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/schlikkes.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/schlikkes.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/schlikkes.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/schlikkes.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/schlikkes.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/schlikkes.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/schlikkes.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/schlikkes.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/schlikkes.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=schlikkes.wordpress.com&amp;blog=24771627&amp;post=11&amp;subd=schlikkes&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://schlikkes.wordpress.com/2011/07/04/spring-3-and-junit-4-how-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb39d80c7253eb49e61719057a4a5961?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">schlikkes</media:title>
		</media:content>
	</item>
	</channel>
</rss>
