<?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/"
	>

<channel>
	<title>blog.macrominds &#187; Software</title>
	<atom:link href="http://blog.macrominds.de/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.macrominds.de</link>
	<description></description>
	<lastBuildDate>Thu, 01 Dec 2011 12:36:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Netbeans Platform development with maven: Troubleshooting</title>
		<link>http://blog.macrominds.de/2011/12/netbeans-platform-development-with-maven-troubleshooting/</link>
		<comments>http://blog.macrominds.de/2011/12/netbeans-platform-development-with-maven-troubleshooting/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 10:28:32 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=403</guid>
		<description><![CDATA[This article is about common problems in Rich Client development with the Netbeans Platform using maven. I&#8217;ll extend this article every now and then, when there&#8217;s time for it.

Dependency problems
When you want to install certain modules in your standalone application based on Netbeans RCP-Application, make sure to use &#60;type&#62;jar&#60;/type&#62; in order to have it considered [...]]]></description>
			<content:encoded><![CDATA[<p>This article is about common problems in Rich Client development with the Netbeans Platform using maven. I&#8217;ll extend this article every now and then, when there&#8217;s time for it.<br />
<span id="more-403"></span></p>
<h3>Dependency problems</h3>
<p>When you want to install certain modules in your standalone application based on Netbeans <abbr title="Rich Client Platform">RCP</abbr>-Application, make sure to use &lt;type&gt;jar&lt;/type&gt; in order to have it considered transitive. This way, Netbeans will install dependent modules as well. Otherwise, (e.g. when using &lt;type&gt;nbm&lt;/type&gt;) you&#8217;ll end up adding tons of modules required by other modules directly, which is time-consuming (run-time trial-error), annoying and less maintainable.</p>
<p>When you get errors on startup, saying &#8220;Could not install xyz&#8221;, make sure to check the file target/userdir/var/log/messages.log of your application in order to get more useful error-messages.</p>
<h3>Nullpointer Exception when dealing with Schema Aware Code Completion</h3>
<h4>Errormessage:</h4>
<pre>
java.lang.NullPointerException
    at
org.netbeans.modules.xml.schema.completion.util.CompletionUtil.isDTDBasedDocument(CompletionUtil.java:669)
    at
org.netbeans.modules.xml.schema.completion.util.CompletionUtil.canProvideCompletion(CompletionUtil.java:769)
    at
org.netbeans.modules.xml.schema.completion.SchemaBasedCompletionProvider.getAutoQueryTypes(SchemaBasedCompletionProvider.java:80)
    at
org.netbeans.modules.editor.completion.CompletionImpl.insertUpdate(CompletionImpl.java:320)
    at
org.netbeans.lib.editor.util.swing.PriorityDocumentListenerList.insertUpdate(PriorityDocumentListenerList.java:85)
    at
javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:185)
    at
org.netbeans.editor.BaseDocument.fireInsertUpdate(BaseDocument.java:1670)
    at org.netbeans.editor.BaseDocument.insertString(BaseDocument.java:816)
    at
org.netbeans.editor.BaseKit$DefaultKeyTypedAction.insertString(BaseKit.java:1198)
    at
org.netbeans.editor.BaseKit$DefaultKeyTypedAction.performTextInsertion(BaseKit.java:1264)
    at
org.netbeans.editor.BaseKit$DefaultKeyTypedAction.access$100(BaseKit.java:1077)
    at
org.netbeans.editor.BaseKit$DefaultKeyTypedAction$1.run(BaseKit.java:1137)
    at
org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:344)
    at
org.netbeans.editor.BaseKit$DefaultKeyTypedAction.actionPerformed(BaseKit.java:1130)
    at
org.netbeans.editor.ext.ExtKit$ExtDefaultKeyTypedAction.actionPerformed(ExtKit.java:1068)
    at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:339)
</pre>
<h4>Solution:</h4>
<p>It is actually a bug in CompletionUtil.isDTDBasedDocument, because it doesn&#8217;t check for the reasonable return value null. But the source of the problem is that there&#8217;s no appropriate LanguageProvider registered.<br />
Add the Dependency <strong>org.netbeans.modules : org-netbans-modules-lexer-nbbridge</strong>, which provides org.netbeans.modules.lexer.nbbridge.MimeLookupLanguageProvider.</p>
<h3>No module providing the capability org.netbeans.modules.editor.actions could be found</h3>
<h4>dependencies defined:</h4>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.api<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org-netbeans-modules-editor<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>RELEASE71-BETA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h4>Errormessage:</h4>
<pre>
Warning - could not install some modules:
	org.netbeans.modules.editor.lib2 - No module providing the capability org.netbeans.modules.editor.actions could be found.
	org.netbeans.modules.editor.lib2 - The module org.netbeans.modules.editor.settings would also need to be installed.
	org.netbeans.modules.editor.settings - No module providing the capability org.netbeans.api.editor.settings.implementation could be found.
	org.netbeans.modules.editor.indent - The module org.netbeans.modules.editor.lib2 would also need to be installed.
	org.netbeans.modules.editor.indent - The module org.netbeans.modules.editor.settings would also need to be installed.
	org.netbeans.modules.editor.fold - The module org.netbeans.modules.editor.lib2 would also need to be installed.
	org.netbeans.modules.editor.fold - The module org.netbeans.modules.editor.settings would also need to be installed.
</pre>
<h4>Solution:</h4>
<p>Add following dependency (this will not be sufficient. you&#8217;ll need to add org-netbeans-modules-editor-settings-storage as well. See solution below):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.modules<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org-netbeans-modules-editor-actions<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>RELEASE71-BETA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h3>No module providing the capability org.netbeans.api.editor.settings.implementation could be found.</h3>
<h4>dependencies defined:</h4>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.api<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org-netbeans-modules-editor<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>RELEASE71-BETA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.modules<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org-netbeans-modules-editor-actions<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>RELEASE71-BETA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h4>Errormessage:</h4>
<pre>
Warning - could not install some modules:
	org.netbeans.modules.editor.fold - The module org.netbeans.modules.editor.lib2 would also need to be installed.
	org.netbeans.modules.editor.fold - The module org.netbeans.modules.editor.settings would also need to be installed.
	org.netbeans.modules.editor.settings - No module providing the capability org.netbeans.api.editor.settings.implementation could be found.
	org.netbeans.modules.editor.lib2 - None of the modules providing the capability org.netbeans.modules.editor.actions could be installed.
	org.netbeans.modules.editor.lib2 - The module org.netbeans.modules.editor.settings would also need to be installed.
	org.netbeans.modules.editor.indent - The module org.netbeans.modules.editor.lib2 would also need to be installed.
	org.netbeans.modules.editor.indent - The module org.netbeans.modules.editor.settings would also need to be installed.
	org.netbeans.modules.editor.actions - The module org.netbeans.modules.editor.lib2 would also need to be installed.
	org.netbeans.modules.editor.actions - The module org.netbeans.modules.editor.lib would also need to be installed.
	org.netbeans.modules.editor.actions - The module org.netbeans.modules.editor.settings would also need to be installed.
	org.netbeans.modules.editor.lib - The module org.netbeans.modules.editor.fold would also need to be installed.
	org.netbeans.modules.editor.lib - The module org.netbeans.modules.editor.indent would also need to be installed.
	org.netbeans.modules.editor.lib - The module org.netbeans.modules.editor.lib2 would also need to be installed.
	org.netbeans.modules.editor.lib - The module org.netbeans.modules.editor.settings would also need to be installed.
</pre>
<h4>Solution:</h4>
<p>Add following dependency:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.modules<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org-netbeans-modules-editor-settings-storage<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>RELEASE71-BETA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h3>java.lang.ClassCastException: org.openide.text.FilterDocument cannot be cast to javax.swing.text.AbstractDocument</h3>
<p>This bug might appear when you&#8217;re dealing with the XML-Schema-Module. In my case, it appeared when I was trying to get a Xam-based-approach working with MultiViewEditor. I copied sourcecode from the Schema-Module in the first place in order to get a glance on how that works.</p>
<h4>Hint for Solution</h4>
<p>Thanks to Jesse Glick from the nbdev mailinglist: Make sure the editor-related modules are enabled in your app. The resulting BaseDocument should be assignable to AbstractDocument.</p>
<h3>Module dependency has friend dependency on org.netbeans.bootstrapbut is not listed as friend.</h3>
<h4>Description</h4>
<p>When dealing with org.netbeans.modules.xml.xam.ModelSource. (But appears in other constellations as well, so transfer the solution to your constellation. Debugging by temporarily adding the implementation-dependencies helps a lot.)<br />
I had this problem in a submodule that used ModelSource. As soon as ModelSource was used somewhere, this error-message appeared when compiling.<br />
In order to resolve the issue, I added implementation-dependencies in the first place. It was not sufficient to only add org-netbeans-bootstrap, but core-startup and netbeans-core would be neccessary too.<br />
Note: This is not the solution but the way I went:<br />
I modified src/main/nbm/module.xml and added these to the &lt;dependencies&gt; section:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.modules:org-netbeans-bootstrap<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>impl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;explicitValue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.bootstrap/1 = 201109252201<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/explicitValue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.modules:org-netbeans-core-startup<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>impl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;explicitValue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.core.startup/1 = 201109252201<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/explicitValue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.modules:org-netbeans-core<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>impl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;explicitValue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.core/2 = 201109252201<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/explicitValue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Then the actual error-message occured when compiled:<br />
&#8220;Project uses classes from transitive module org.netbeans.api:org-netbeans-modules-xml-xam:jar:RELEASE71-BETA which will not be accessible at runtime.&#8221;<br />
Which basically means that you have to add this module as a direct dependency:</p>
<h4>Solution</h4>
<p>Add this to the dependencies-section of your pom.xml:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org-netbeans-modules-xml-xam<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.api<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>RELEASE71-BETA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Afterwards, you should remove the previously added implementation-dependencies from src/main/nbm/module.xml if you followed my debugging steps.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2011/12/netbeans-platform-development-with-maven-troubleshooting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Favorites per Default in Netbeans Rich Client Platform (Maven Standalone Application)</title>
		<link>http://blog.macrominds.de/2011/08/open-favorites-per-default-in-netbeans-rich-client-platform-maven-standalone-application/</link>
		<comments>http://blog.macrominds.de/2011/08/open-favorites-per-default-in-netbeans-rich-client-platform-maven-standalone-application/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 21:31:58 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=376</guid>
		<description><![CDATA[It&#8217;s sometimes kinda hard to force your Netbeans RCP Standalone Application to open the Favorites Window per Default (at least when using maven). 
Here&#8217;s the solution:

The easiest way to start is to open your layer.xml-file in the explorer view (by using the plus-sign, don&#8217;t open it in the editor). Search the folder &#60;this layer in [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s sometimes kinda hard to force your Netbeans <abbr title="Rich Client Platform">RCP</abbr> Standalone Application to open the Favorites Window per Default (at least when using maven). </p>
<p>Here&#8217;s the solution:<br />
<span id="more-376"></span><br />
The easiest way to start is to open your layer.xml-file in the explorer view (by using the plus-sign, don&#8217;t open it in the editor). Search the folder &lt;this layer in context&gt; and search for the Windows2-folder. Open it. You should see a favorites.wstcref entry. Double click.<br />
change &lt;state opened=&#8221;false&#8221; /&gt; to &lt;state opened=&#8221;true&#8221; /&gt;.<br />
<strong>Make sure to specify a module tag (see below on how to get this right).</strong>.<br />
Netbeans created an entry in the layer-file for you that should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;folder</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;explorer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;favorites.wstcref&quot;</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;favoritesWstcref.xml&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/folder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>If it didn&#8217;t, create that entry on your own now.<br />
Here&#8217;s some context-info, just place that section anywhere directly under the filesystem-tag:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;folder</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Windows2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;folder</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Modes&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;folder</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;explorer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;favorites.wstcref&quot;</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;favoritesWstcref.xml&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/folder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/folder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/folder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Netbeans also created a file named &#8220;favorites<abbr title="WindowSystemTopComponent">Wstc</abbr>ref.xml&#8221; for you under src/main/resources/path.to.your.package. The name doesn&#8217;t matter, just make sure to have the same name as referenced by the url-attribute of the file-tag in the layer.xml (see above).<br />
The file should look like this (although Netbeans might not have created the very important module-tag. Just make sure to have everything just like below in the favoritesWstcref.xml-file):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
<span style="color: #00bbdd;">&lt;!DOCTYPE tc-ref PUBLIC</span>
<span style="color: #00bbdd;">          &quot;-//NetBeans//DTD Top Component in Mode Properties 2.0//EN&quot;</span>
<span style="color: #00bbdd;">          &quot;http://www.netbeans.org/dtds/tc-ref2_0.dtd&quot;&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tc-ref</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;2.2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;org.netbeans.modules.favorites/1&quot;</span> <span style="color: #000066;">spec</span>=<span style="color: #ff0000;">&quot;1.25.1&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tc-id</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;favorites&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;state</span> <span style="color: #000066;">opened</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tc-ref<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>You&#8217;ll wonder which settings to take (especially when you don&#8217;t use Netbeans RCP Release701 as I did here).</p>
<p>You can look that up in the dependency which you will define right now.<br />
You need to define a Dependency to the Favorites module in order to make sure that it gets loaded before your module, otherwise you&#8217;ll have a Favorites-Window that disappears under certain circumstances on startup or won&#8217;t show up at all.</p>
<p>To define the dependency you might want to search by right-clicking the &#8220;Dependencies&#8221;-Folder and choose &#8220;Add Dependency&#8230;&#8221; enter &#8220;favorites&#8221; in the Query-Input-Field and choose the appropriate module and version (in my case &#8220;org.netbeans.modules : org-netbeans-modules-favorites&#8221; RELEASE701 [nbm] &#8211; netbeans)<br />
Or you could simply add it to your pom.xml under dependencies like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.modules<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org-netbeans-modules-favorites<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>RELEASE701<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Once downloaded have a look at Dependencies/org-netbeans-modules-favorites-RELEASE701.jar or whatever version you chose in the explorer-window of netbeans. Open META-INF/MANIFEST.MF to get the infos you need for the above mentioned module-tag in the favoritesWstcref.xml-file.<br />
The important entries are: </p>
<pre>
OPENIDE-Module: org.netbeans.modules.favorites/1
</pre>
<p>and</p>
<pre>
OpenIDE-Module-Specification-Version: 1.25.1
</pre>
<p>These two values are needed for the attributes of the modules-tag in the favoritesWstcref.xml-file.</p>
<p>When you build your project, you will get an error-message saying:<br />
&#8220;Failed to execute goal org.codehaus.mojo:nbm-maven-plugin:3.5:manifest (default-manifest) on project [...]: Module dependency has friend dependency on org.netbeans.modules.favoritesbut is not listed as friend. -> [Help 1]&#8221;</p>
<p>This means that you have to specify an implementation version of the favorites-module (which is pretty bad, because your module will only work with this very version afterwards). You can specify that you wish to use the implemenation version by modifying src/main/nbm/module.xml to contain the following entry:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.modules:org-netbeans-modules-favorites<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>impl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;explicitValue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.netbeans.modules.favorites/1 = 201107282000<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/explicitValue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Again, have a look at the Dependencies/org-netbeans-modules-favorites-RELEASE701.jar /META-INF/MANIFEST.MF to find the right values for explicitValue:<br />
the important values are:</p>
<pre>
OpenIDE-Module: org.netbeans.modules.favorites/1
</pre>
<p>and</p>
<pre>
OpenIDE-Module-Implementation-Version: 201107282000
</pre>
<p>If you get an error like the one below at runtime (open View/IDELog, when parts of your applications GUI or functionality are missing on startup, you&#8217;ll find the errors there (just be patient, they&#8217;ll appear in a minute)), then you&#8217;ve got a typo in your module.xml.</p>
<pre>
WARNING [org.netbeans.core.startup.ModuleList]: Error encountered while reading [YOUR_MODULE]
java.lang.IllegalArgumentException: Malformed dot-separated identifier: [YOUR_EXPLICIT_VALUE_IN_MODULES.XML]
	at org.openide.modules.Dependency.checkCodeName(Dependency.java:201)
	at org.openide.modules.Dependency.create(Dependency.java:275)
	at org.netbeans.Module.initDeps(Module.java:683)
	at org.netbeans.Module.parseManifest(Module.java:465)
Caused: org.netbeans.InvalidException: While parsing [YOUR_PACKAGE] a dependency attribute
	at org.netbeans.Module.parseManifest(Module.java:467)
	at org.netbeans.StandardModule.<init>(StandardModule.java:136)
	at org.netbeans.ModuleFactory.create(ModuleFactory.java:69)
	at org.netbeans.ModuleManager.create(ModuleManager.java:594)
[catch] at org.netbeans.core.startup.ModuleList$ReadInitial.run(ModuleList.java:1611)
	at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:125)
	at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:566)
	at org.netbeans.core.startup.ModuleList.readInitial(ModuleList.java:168)
	at org.netbeans.core.startup.ModuleSystem.readList(ModuleSystem.java:280)
	at org.netbeans.core.startup.Main.getModuleSystem(Main.java:171)
	at org.netbeans.core.startup.Main.start(Main.java:308)
	at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)
	at java.lang.Thread.run(Thread.java:722)
</pre>
<p>I found the following links helpful:</p>
<ul>
<li><a href="http://stackoverflow.com/questions/5730698/module-dependency-has-friend-dependency-on-org-netbeans-libs-javacimpl-1but-is-no" rel="external">Stack Overflow: Module dependency has friend dependency on org.netbeans.libs.javacimpl/1but is not listed as friend</a></li>
<li><a href="http://platform.netbeans.org/tutorials/61/nbm-htmleditor.html" rel="external">Netbeans Platform Quick Start</a></li>
<li><a href="http://rubenlaguna.com/wp/2009/04/28/opening-favorites-window-at-startup-in-a-netbeans-platform-application/" rel="external">Opening Favorites window at startup in a Netbeans Platform Application</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2011/08/open-favorites-per-default-in-netbeans-rich-client-platform-maven-standalone-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instrumentation (Javaagent) and Javaassist, className Issue with getClassFile2</title>
		<link>http://blog.macrominds.de/2011/05/instrumentatio-javaagent-and-javaassist-classname-issue-with-getclassfile2/</link>
		<comments>http://blog.macrominds.de/2011/05/instrumentatio-javaagent-and-javaassist-classname-issue-with-getclassfile2/#comments</comments>
		<pubDate>Mon, 09 May 2011 14:23:43 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=362</guid>
		<description><![CDATA[Just a hint if you have the following problem:
You&#8217;re using javaassist (in my case 3.14.GA) and a Java-Agent / instrumentation to invoke javaassist for Class-transformations. (I use Java7 which works with Javaassist 3.14.GA).
The following code returns a CtClass:

//make sure to add your classpath, e.g. cp.appendClassPath(new LoaderClassPath(loader));
&#160;
//throws no Exception
CtClass cc = cp.get&#40;className&#41;;
&#160;
//this would return a non-null [...]]]></description>
			<content:encoded><![CDATA[<p>Just a hint if you have the following problem:<br />
You&#8217;re using javaassist (in my case 3.14.GA) and a Java-Agent / instrumentation to invoke javaassist for Class-transformations. (I use Java7 which works with Javaassist 3.14.GA).<br />
The following code returns a CtClass:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//make sure to add your classpath, e.g. cp.appendClassPath(new LoaderClassPath(loader));</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//throws no Exception</span>
CtClass cc <span style="color: #339933;">=</span> cp.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>className<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//this would return a non-null object (alternative to above line of code)</span>
<span style="color: #666666; font-style: italic;">//CtClass cc = cp.getOrNull(className);</span></pre></div></div>

<p>But as soon as you invoke cc.getAnnotations or similar, it either fails silently (then add &#8220;catch (Exception e)&#8221; ) or (after you added the catch-block) you get a Runtime-Exception:</p>
<pre>
java.lang.RuntimeException: cannot find your/package/YourClassName: your.package.YourClassName found in your/package/YourClassName.class
	at javassist.CtClassType.getClassFile2(CtClassType.java:192)
	at javassist.CtClassType.getAnnotation(CtClassType.java:473)
	at your.package.Agent$1.transform(Agent.java:98)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:794)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:144)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	...
</pre>
<p>Make sure to call ClassPool::get with a ClassName not containing slashes, but dots. That is:</p>
<pre>
instr.addTransformer(new ClassFileTransformer() {
  public byte[] transform(ClassLoader loader, String className,
                                    Class<?> classBeingRedefined,
                                    ProtectionDomain protectionDomain,
                                    byte[] classfileBuffer)
                                        throws IllegalClassFormatException {
                        //NOT THAT WAY:
                        //CtClass cc = cp.get(className);
                        //BUT THAT WAY:
                        className = className.replace("/",".");
                        CtClass cc = cp.get(className);
...
</pre>
<p>Otherwise, ClassPool would happily populate your CtClass but it would fail on</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//line 191 of CtClassType.java in javassist:javassist 3.14.GA</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>cf.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>qualifiedName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>and throw an ugly Runtime-Exception, when you try to inspect Annotations.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2011/05/instrumentatio-javaagent-and-javaassist-classname-issue-with-getclassfile2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven, Netbeans Run and the use of a Javaagent</title>
		<link>http://blog.macrominds.de/2011/05/maven-netbeans-run-and-the-use-of-a-javaagent/</link>
		<comments>http://blog.macrominds.de/2011/05/maven-netbeans-run-and-the-use-of-a-javaagent/#comments</comments>
		<pubDate>Tue, 03 May 2011 12:13:14 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=355</guid>
		<description><![CDATA[Here&#8217;s my setup for a maven 3 multi-module project, using a java-agent, that can be run either from the Netbeans-IDE or with a handcrafted windows-batch-file.

My system is: Windows7 64bit, Netbeans7, JDK7, Maven 3
The Multimodule Project

First I created a new Multimodule Project (&#8221;File&#8221;-&#62;&#8221;New Project&#8221;-&#62;&#8221;Maven&#8221;-&#62;&#8221;POM Project&#8221;).
I set up my multimodule-pom for my needs (utf-8, Java 1.7, Checkstyle, [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my setup for a maven 3 multi-module project, using a java-agent, that can be run either from the Netbeans-IDE or with a handcrafted windows-batch-file.</p>
<p><span id="more-355"></span></p>
<p>My system is: Windows7 64bit, Netbeans7, JDK7, Maven 3</p>
<h3>The Multimodule Project</h3>
<p>
First I created a new Multimodule Project (&#8221;File&#8221;-&gt;&#8221;New Project&#8221;-&gt;&#8221;Maven&#8221;-&gt;&#8221;POM Project&#8221;).<br />
I set up my multimodule-pom for my needs (utf-8, Java 1.7, Checkstyle, etc., <a href="#pom_multi">see pom.xml(multi) below</a> (entries under modules will be added by Netbeans automatically when creating submodules).</p>
<p>For Checkstyle-config, I used the netbeans Config-Dialog &#8220;Project-Properties&#8221;-&gt;&#8221;Formatting&#8221;-&gt;&#8221;CheckStyleFormatting&#8221;. This automatically creates configs in the pom and creates a file called nb-configuration.xml with IDE-specific configs. The pom &lt;configLocation&gt; suggested by Netbeans is just fine for my case (config/sun_checks.xml) as this is a predefined config. If you wish to use custom checkstyle-config you should follow <a rel="external" href="http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html">this very good article about multimodule-projects and checkstyle</a>.
</p>
<h3>The agent / first submodule</h3>
<p>
Then I created the first submodule &#8220;agent&#8221;. This is as simple as creating a regular Maven Java App with Netbeans. The project-location is important though.<br />
So after &#8220;File&#8221;-&gt;&#8221;New Project&#8221;-&gt;&#8221;Maven&#8221;-&gt;&#8221;Java Application&#8221;, you specfiy your project to have the location directly below the multimodule-project. That is, if your multimodule-project is located in Z:\\myprojects\\mymultimoduleproject\\ (this is where the pom.xml is located), then your submodule should have exactly this path as project-location. Netbeans will add a folder according to the project-name directly below the multimodule-folder and it will add this submodule to the modules-section of the parent-pom, as well as adapting the pom of our submodule to refer to the parent pom.</p>
<p>
The agent shown here is only a skeleton for demonstration purposes. As I decided to use <a rel="external" href="http://www.jboss.org/javassist">javassist</a>, I added the following dependency</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.javassist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javassist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>3.14.0-GA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><a rel="external" href="http://blog.ubigrate.com/2008/04/18/java-bytecode-engineering/">Here&#8217;s a good article about Bytecode-Engineering Libs. (German only!)</a></p>
<p>As it will be important later on to have a jar-file with a certain manifest entry, I added this section to &lt;build&gt;-&lt;plugins&gt; as well:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-jar-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.3.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;archive<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;index<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/index<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifestEntries<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Premain-Class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.macrominds.test.agent.Agent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Premain-Class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifestEntries<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/archive<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><a href="#agentpom">The full pom is shown at the end of the article</a>.</p>
<p>And here&#8217;s the agent&#8217;s javacode:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.macrominds.test.agent</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.instrument.ClassFileTransformer</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.instrument.IllegalClassFormatException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.instrument.Instrumentation</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.security.ProtectionDomain</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javassist.ClassPool</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javassist.CtClass</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javassist.NotFoundException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.log4j.Logger</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Example Agent, that doesn't do anything. It's just here for 
 * demonstration-purposes.
 * @author Thomas
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Agent <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Logger LOG <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>Agent.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> premain<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> arg, Instrumentation instr<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;premain called&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        instr.<span style="color: #006633;">addTransformer</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ClassFileTransformer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> consideredWorthACheck<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> className<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #666666; font-style: italic;">// TODO check Classname against ruleset to quickly check if </span>
                <span style="color: #666666; font-style: italic;">// costly analysis shall be performed.</span>
                <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> transform<span style="color: #009900;">&#40;</span><span style="color: #003399;">ClassLoader</span> loader, <span style="color: #003399;">String</span> className, 
                                    Class<span style="color: #339933;">&lt;?&gt;</span> classBeingRedefined, 
                                    <span style="color: #003399;">ProtectionDomain</span> protectionDomain, 
                                    <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> classfileBuffer<span style="color: #009900;">&#41;</span> 
                                        <span style="color: #000000; font-weight: bold;">throws</span> IllegalClassFormatException <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>consideredWorthACheck<span style="color: #009900;">&#40;</span>className<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    ClassPool cp <span style="color: #339933;">=</span> ClassPool.<span style="color: #006633;">getDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                        CtClass cc <span style="color: #339933;">=</span> cp.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>className<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #666666; font-style: italic;">// TODO perform analysis and transformation strategies here</span>
                        LOG.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;didn't perform transformation on &quot;</span><span style="color: #339933;">+</span>className<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;. Not implemented yet.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>NotFoundException ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        LOG.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;could not load class &quot;</span><span style="color: #339933;">+</span>className
                                <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; for introspection though the ruleset says is&quot;</span>
                                <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; worth an introspection. Falling back. That &quot;</span>
                                <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;means, the unmodified Bytecode is returned&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">return</span> classfileBuffer<span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>The runnable App / second submodule</h3>
<p>
What I wanted to have at the end is an Application, that can be distributed easily (though I decided to use a handcrafted batch-file for the moment). That means, I wanted dependent libs to be in a dedicated lib-folder.</p>
<p>I created the second submodule-project in the same way, I did before with the agent-module: &#8220;File&#8221;-&gt;&#8221;New Project&#8221;-&gt;&#8221;Maven&#8221;-&gt;&#8221;Java Application&#8221; and made sure, that the project-location is right below the multimodule-project&#8217;s folder (where the pom is located).</p>
<p>
In order to get the dependencies in place (lib-folder) and to have the according classpath-entries added to the manifest of the jar-file, I added the plugins maven-dependency-plugin and maven-jar-plugin to the pom and configured the dependency-plugin to store the dependencies in ${project.build.directory}/lib and the jar-plugin to add the classpath and to prefix the classpath with lib/. In order to have the agent in place, I added the agent as dependency.
</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://maven.apache.org/POM/4.0.0&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modelVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4.0.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modelVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>testmulti<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.macrominds.test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.macrominds.test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>app<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>app<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://www.test.nourl/app<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project.build.sourceEncoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>UTF-8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project.build.sourceEncoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-dependency-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>install<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>copy-dependencies<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                               <span style="color: #808080; font-style: italic;">&lt;!-- output of dependent libs  see ClasspathPrefix-configuration below --&gt;</span>                                
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;outputDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.directory}/lib<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/outputDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-jar-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.3.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;archive<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;index<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/index<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;addClasspath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/addClasspath<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #808080; font-style: italic;">&lt;!-- prefix the classpath for the distribution --&gt;</span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpathPrefix<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>lib/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/classpathPrefix<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mainClass<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${main.class}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mainClass<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifestEntries<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.url}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifestEntries<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/archive<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.groupId}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>agent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.version}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>I left the autogenerated main-class as it was, it&#8217;s just testing now. (All you need is a Java-Class with a main-method. Just make sure to have the entry</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;main.class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.macrominds.test.app.App<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/main.class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>of the multimodule pom correctly set to your package and classname.)</p>
<h3>Running the Application from the console / out of the explorer</h3>
<p>As I really didn&#8217;t want to fiddle around with the several tools out there for the moment, I decided to create a handcrafted Windows-batch-file for now.</p>
<p>However: If you&#8217;re interested in this stuff, here are some links:</p>
<ul>
<li><a rel="external" href="http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/">Appassembler</a></li>
<li><a rel="external" href="http://stackoverflow.com/questions/97640/force-maven2-to-copy-dependencies-into-target-lib">Discussion on Appassembler and other tools</a></li>
<li><a rel="external" href="http://maksim.sorokin.dk/it/2010/06/10/izpack-with-maven/">IzPack</a></li>
</ul>
<p>Back to the batch file: I placed the following batch-file directly in the multimodule-project-location. You can see, that the commandline-argument -javaagent is passed to the jvm in order to get the agent working. It resides under the lib-folder as soon as you build the project, because we specified that in the above pom.</p>

<div class="wp_syntax"><div class="code"><pre class="bat" style="font-family:monospace;">rem switch to appliation distribution directory
cd .\app\target\
rem launch nodez using the javaagent
java.exe -javaagent:lib/agent-1.0-SNAPSHOT.jar -jar app-1.0-SNAPSHOT.jar  
rem return to directory, this script has been started from
cd %~dp0</pre></div></div>

<h3>Running the Application from the Netbeans IDE</h3>
<p>This part was a bit tricky.</p>
<p>I fiddled around with maven-exec, but then decided to use Netbeans-Run-Configuration under &#8220;Project-Properties&#8221;-&gt;&#8221;Run&#8221;. There I specified the Main-class (de.macrominds.test.app.App), the Working Directory (<del datetime="2011-05-20">app-module-base-path</del> app-module-target-path), e.g. <del datetime="2011-05-20">&#8220;Z:\\myprojects\\mymultimoduleproject\\app&#8221;</del>  &#8220;Z:\\myprojects\\mymultimoduleproject\\app\\target&#8221; and the VM-Options (java-agent).</p>
<p>The first tests didn&#8217;t succeed. I tried &#8220;lib/agent-1.0-SNAPSHOT.jar&#8221;, &#8220;./lib/agent-1.0-SNAPSHOT.jar&#8221;, &#8220;agent-1.0-SNAPSHOT.jar&#8221;, but nothing would work. <ins datetime="2011-05-20">Well, as you can see, I made a mistake, when I used the app-path for working directory. It certainly has to be the target-path, so the vm-options I tried before might have worked with the target path.</ins></p>
<p><strong>The solution is to use your maven repositories path in VM Options: &#8220;-javaagent:${settings.localRepository}/de/macrominds/test/agent/1.0-SNAPSHOT/agent-1.0-SNAPSHOT.jar&#8221;.</strong></p>
<p>That&#8217;s it. You can now run the application from netbeans (right-click on the app-module-&gt;&#8221;run&#8221;), or build it using maven or netbeans and then start it with the batch-file. For distribution, I&#8217;d modify the paths in the batch file and put target/app-1.0-SNAPSHOT.jar and target/lib together with the batch-file into a zip file.</p>
<p>My needs for distribution are currently only to show progress to the customer, so I guess there will be another solution for release, that is easier to maintain and suits other OS as well.</p>
<hr />
<p><a id="pom_multi">pom.xml(multi)</a></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://maven.apache.org/POM/4.0.0&quot;</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modelVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4.0.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modelVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.macrominds.test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>testmulti<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;packaging<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>pom<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/packaging<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>testmulti<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project.build.sourceEncoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>UTF-8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project.build.sourceEncoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- global main class for execution, needed for executable app-jar --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;main.class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.macrominds.test.app.App<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/main.class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-compiler-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.3.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;encoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.sourceEncoding}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/encoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.7<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.7<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;showDeprecation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/showDeprecation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-resources-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;encoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.sourceEncoding}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/encoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reporting<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-checkstyle-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.6<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configLocation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>config/sun_checks.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configLocation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/reporting<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>junit<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>junit<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4.8.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>log4j<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>log4j<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.2.16<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>agent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>app<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><a id="agentpom">pom.xml(agent)</a></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://maven.apache.org/POM/4.0.0&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modelVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>4.0.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modelVersion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>testmulti<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.macrominds.test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.macrominds.test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>agent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>agent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://www.test.nourl/javaagent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project.build.sourceEncoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>UTF-8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project.build.sourceEncoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;agent.class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.macrominds.test.agent.Agent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/agent.class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-jar-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.3.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;archive<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;index<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/index<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifestEntries<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Premain-Class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${agent.class}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Premain-Class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifestEntries<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/archive<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.javassist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javassist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>3.14.0-GA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2011/05/maven-netbeans-run-and-the-use-of-a-javaagent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JWebPane reloaded / Thoughts on a Swing-based Browser-component</title>
		<link>http://blog.macrominds.de/2011/04/jwebpane-reloaded-thoughts-on-a-swing-based-browser-component/</link>
		<comments>http://blog.macrominds.de/2011/04/jwebpane-reloaded-thoughts-on-a-swing-based-browser-component/#comments</comments>
		<pubDate>Sat, 30 Apr 2011 14:14:51 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=334</guid>
		<description><![CDATA[When I searched for a Swing Component that is able to render modern HTML/CSS, I noticed that there&#8217;s no solution that covered all of my needs. Here are my thoughts on the topic and an (unfinished and rough) idea on how to create a JWebPane while the original JWebPane (announced 2008) stays vaporware.


A year ago, [...]]]></description>
			<content:encoded><![CDATA[<p>When I searched for a Swing Component that is able to render modern <abbr title="Hypertext markup language">HTML</abbr>/<abbr title="cascading stylesheets">CSS</abbr>, I noticed that there&#8217;s no solution that covered all of my needs. Here are my thoughts on the topic and an (unfinished and rough) idea on how to create a JWebPane while the <a rel="external" href="http://weblogs.java.net/blog/alex2d/archive/2008/12/jwebpane_projec_1.html">original JWebPane (announced 2008) stays vaporware</a>.</p>
<p><span id="more-334"></span></p>
<p>
A year ago, I wanted to use a browser-component in a translucent / shaped Swing window. After a whole lot of research, I decided to try <a rel="external" href="http://djproject.sourceforge.net/ns/"><abbr>DJ</abbr> Native</a> (<a href="/2010/03/embedded-gecko-browser-in-java-application-with-djnativeswing/">I wrote an article on this as well</a>).
</p>
<p>In short: No support for translucent windows. I haven&#8217;t found a solution for this requirement. The project then switched away from <abbr title="Hypertext markup language">HTML</abbr>/<abbr title="cascading stylesheets">CSS</abbr> in favour of JavaFX, so I didn&#8217;t mind for a long time.</p>
<p>Now I&#8217;ve got the same requirement again.<br />
Again I searched the web for solutions and found nothing appropriate for Swing.</p>
<p>There seems to be a <a rel="external" href="http://www.genuitec.com/about/labs.html">solution</a> for <abbr title="Standard Widget Toolkit">SWT</abbr> though (that <a rel="external" href="http://www.eclipse.org/swt/faq.php#howusewebkit">seems to cover the main <abbr title="Operating Systems">OS</abbr> Linux, Win and Mac OS</a>). Well, I don&#8217;t want to use <abbr title="Standard Widget Toolkit">SWT</abbr> right now for several reasons, so I didn&#8217;t dive deeper into this topic. Besides, <a rel="external" href="http://www.eclipse.org/swt/faq.php#howusewebkit">there are several prerequisite requirements</a>, that simply don&#8217;t fit the usual scenario.</p>
<p>I found several approaches for the problem of having a Swing component for displaying <abbr title="Hypertext markup language">HTML</abbr>/<abbr title="cascading stylesheets">CSS</abbr>:</p>
<dl>
<dt>Use native Renderer</dt>
<dd>This is the preferred solution if you want to have your component stay up-to-date and display modern webpages. However, there&#8217;s no way to use that in Swing without problems (especially in translucent windows). This is partly caused by the lightweight / heavyweight issue in Swing (or simply the nature of Swing versus native display). (See <a rel="external" href="http://wiki.netbeans.org/EmbeddedBrowser">the link</a> under &#8220;Other approaches and thoughts&#8221; below or <a rel="external" href="http://sourceforge.net/projects/djproject/forums/forum/671154/topic/3629028">the discussion concerning <abbr>DJ</abbr> Native Swing</a> for more info on this)</dd>
<dt>100% pure Java</dt>
<dd>The solutions are often pure Swing, so no problems here, but all of them lack the ability to render modern pages. Most of them don&#8217;t even display better than <abbr title="Internet Explorer">IE</abbr> 5.5. (for example due to the lack of displaying background-images or other issues). I found no solution that was even slightly able to render CSS3-styled pages.</dd>
<dt>Other approaches and thoughts</dt>
<dd><a rel="external" href="http://wiki.netbeans.org/EmbeddedBrowser">Here&#8217;s a good list of approaches for an embedded Browser in Netbeans</a>.</dd>
</dl>
<p>One approach, that I really liked, was the one of <a rel="external" href="http://lobobrowser.org/cobra.jsp">Cobra</a>. It parses and interprets  <abbr title="Hypertext markup language">HTML</abbr>/<abbr title="cascading stylesheets">CSS</abbr>, creates a <abbr title="document object model">DOM</abbr>-Tree and provides methods for accessing the attributes and calculating the absolute coordinates of the elements. However, Cobra relies on its own Java-Implementation and thus lacks the great standards compliance and &#8220;up-to-date&#8221;ness of gecko or webkit.</p>
<h3>So what I thought about is the following idea.</h3>
<ul>
<li>Use Webkit or Gecko as an external native lib, just for parsing and interpreting and logically laying out the components. Clearly, this only works if the engines provide a logically layed out dom or scenegraph. (I didn&#8217;t manage to get a closer look at the engines yet).</li>
<li>Provide a <abbr title="Java native interface">JNI</abbr> for receiving the <abbr title="Document Object Model">DOM</abbr>, handling <abbr title="Unified Resource Locator">URL</abbr>-resolution (client apps may or may not have this requirement), user interaction and forward events.</li>
<li>
Write an own renderer, which walks through the scenegraph and stupidly renders the elements using the absolute coordinates and calculated attributes using Java2D and Swing.
</li>
<li>Write java-based interaction manager, that forwards interaction-events to the engines&#8217; <abbr title="Document Object Model">DOM</abbr>-tree</li>
</ul>
<p>While it would be a lot of work to write the renderer (especially for CSS3 stuff like multiple backgrounds, web-fonts, shadows, etc) and it&#8217;s unclear how both worlds would interact on stuff like animations / transitions, this is <abbr title="in my humble opinion">IMHO</abbr> the only way to get a <strong>real</strong> Swing-Component, that keeps up-to-date (well, the renderer itself would need updates as well, but I think the main work on keeping up-to-date is the logical engine).</p>
<p>The downside is, that such a component would never be able to render plugins like Flash, etc. in the Swing-Way. They will always be required to be displayed natively.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2011/04/jwebpane-reloaded-thoughts-on-a-swing-based-browser-component/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mediawiki sendmail problems on windows xampp solved</title>
		<link>http://blog.macrominds.de/2011/03/mediawiki-sendmail-problems-on-windows-xampp-solved/</link>
		<comments>http://blog.macrominds.de/2011/03/mediawiki-sendmail-problems-on-windows-xampp-solved/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 09:38:10 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=322</guid>
		<description><![CDATA[I got several errors when trying to make mediawiki send e-mails on my windows 7 xampp 1.7.4 test-installation. Now here&#8217;s what I did.

First I unsuccessfully tryed to set $wgSMTP in LocalSettings.php as mentioned here and on several other pages. Loads of strict- and deprecation-warnings appeared, no E-Mail was send.
The solution is to change xampp/php/php.ini as [...]]]></description>
			<content:encoded><![CDATA[<p>I got several errors when trying to make mediawiki send e-mails on my windows 7 xampp 1.7.4 test-installation. Now here&#8217;s what I did.</p>
<p><span id="more-322"></span></p>
<p>First I unsuccessfully tryed to set $wgSMTP in LocalSettings.php as mentioned <a href="http://www.apachefriends.org/f/viewtopic.php?f=16&#038;t=18693" rel="external">here</a> and on several other pages. Loads of strict- and deprecation-warnings appeared, no E-Mail was send.</p>
<p>The solution is to change xampp/php/php.ini as follows</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">; For Win32 only.</span>
<span style="color: #666666; font-style: italic;">;sendmail_from = me@example.com</span>
&nbsp;
<span style="color: #666666; font-style: italic;">; For Unix only. You may supply arguments as well (default: &quot;sendmail -t -i&quot;).</span>
<span style="color: #000099;">sendmail_path</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;\&quot;</span>C:\xampp\sendmail\sendmail.exe\<span style="color: #933;">&quot; -t&quot;</span></pre></div></div>

<p>It is important to set the sendmail_path to the executable on windows although the documentation says &#8220;for unix only&#8221;.</p>
<p>Then modify xampp/sendmail/sendmail.ini as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">; you must change mail.mydomain.com to your smtp server,</span>
<span style="color: #666666; font-style: italic;">; or to IIS's &quot;pickup&quot; directory.  (generally C:\Inetpub\mailroot\Pickup)</span>
<span style="color: #666666; font-style: italic;">; emails delivered via IIS's pickup directory cause sendmail to</span>
<span style="color: #666666; font-style: italic;">; run quicker, but you won't get error messages back to the calling</span>
<span style="color: #666666; font-style: italic;">; application.</span>
&nbsp;
<span style="color: #000099;">smtp_server</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">mysmtpserver.de</span>
&nbsp;
<span style="color: #666666; font-style: italic;">; smtp port (normally 25)</span>
&nbsp;
<span style="color: #000099;">smtp_port</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">25</span>
&nbsp;
<span style="color: #666666; font-style: italic;">;[...]</span>
<span style="color: #666666; font-style: italic;">; if your smtp server requires authentication, modify the following two lines</span>
<span style="color: #000099;">auth_username</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">myusername</span>
<span style="color: #000099;">auth_password</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">mypassword</span></pre></div></div>

<p>Make sure to restart apache. Also make sure to remove $wgSMTP from LocalSettings.php if you added it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2011/03/mediawiki-sendmail-problems-on-windows-xampp-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Object Type or object value changed in php-session</title>
		<link>http://blog.macrominds.de/2010/05/object-type-or-object-value-changed-in-php-session/</link>
		<comments>http://blog.macrominds.de/2010/05/object-type-or-object-value-changed-in-php-session/#comments</comments>
		<pubDate>Sun, 02 May 2010 12:49:12 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=283</guid>
		<description><![CDATA[A friend of mine recently had a mysterious problem. He stored an object in $_SESSION and fetched it from the $_SESSION. When he fetched it, it had magically turned it&#8217;s type from the concrete class to the type of the super-class.  To get even more mysterious, the problem only occured on the production server, [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine recently had a mysterious problem. He stored an object in $_SESSION and fetched it from the $_SESSION. When he fetched it, it had magically turned it&#8217;s type from the concrete class to the type of the super-class.  To get even more mysterious, the problem only occured on the production server, which is hosted by 1&#038;1. The error didn&#8217;t occur on his local xampp.Here&#8217;s what happened.<span id="more-283"></span></p>
<p>We first thought it was a problem related to serialization / deserialization and debugged the concerned parts of the code. Then we found out that the type of the object in the session changed between some lines of code (without an explicit new assignment), not between HTTP-Requests.<br />
His session object was assigned to $_SESSION["oProject"] and there was an assignment to a totally different object $oProject in the code before reading $_SESSION["oProject"].<br />
Well.. I would have thought no serious provider turns on register_globals, well.. surprise surprise, 1&#038;1 does that at the time of this writing.<br />
You cannot simply do this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//doesn't work!! You cannot set register_globals off while a script is running.</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;register_global&quot;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As recommended by php.net, you could add the following code to your .htaccess file:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">php_flag register_globals <span style="color: #0000ff;">on</span></pre></div></div>

<p>This isn&#8217;t allowed by 1&#038;1 though, but <a href="http://hilfe-center.1und1.de/sp-service/sofort_hilfe_faq/technische_fragen/web_hosting/scripte_cgi_php_asp_etc_/php/2.html">1&#038;1 recommends the following workaround</a>, which may only work with 1&#038;1:<br />
Create a php.ini file and put it into the directory, you want it to apply for. The file may contain only the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">register_globals = <span style="color: #0000ff;">off</span></pre></div></div>

<p>If that wouldn&#8217;t work for you, you could as well make sure that your $_SESSION-indices are unique and don&#8217;t collide with local variables, but it&#8217;s not only the $_SESSION that is affected by register_globals, it&#8217;s $_GET and $_POST and so on. This can be highly dangerous, as it can inject values into your code, thus change the behaviour of your code.</p>
<p><a href="http://php.net/manual/de/security.globals.php#87101" rel="external" >Here&#8217;s a simple solution for those of you who are not allowed to change register_globals</a> (I didn&#8217;t test it though and the other solutions on the page linked above might work even better).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2010/05/object-type-or-object-value-changed-in-php-session/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apache Jackrabbit 2 / JCR2 Nullpointer Exception on shutdown</title>
		<link>http://blog.macrominds.de/2010/04/apache-jackrabbit-2-jcr2-nullpointer-exception-on-shutdown/</link>
		<comments>http://blog.macrominds.de/2010/04/apache-jackrabbit-2-jcr2-nullpointer-exception-on-shutdown/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 17:30:03 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=275</guid>
		<description><![CDATA[I just fiddled around with Apaches Jackrabbit 2 and found the following error and solution noteworthy.
Testing around with the docs on Jackrabbit, I configured and implemented a pretty simple Prototype that embeds a Jackrabbit Repository.
Java Code:

public class App
&#123;
    public static void main&#40; String&#91;&#93; args &#41;
    &#123;
    [...]]]></description>
			<content:encoded><![CDATA[<p>I just fiddled around with <a href="http://jackrabbit.apache.org/">Apaches Jackrabbit 2</a> and found the following error and solution noteworthy.<span id="more-275"></span><br />
Testing around with the docs on Jackrabbit, I configured and implemented a pretty simple Prototype that embeds a Jackrabbit Repository.<br />
Java Code:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> App
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        BasicConfigurator.<span style="color: #006633;">configure</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">String</span> xml <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;repository/configuration.xml&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">String</span> dir <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;repository&quot;</span><span style="color: #339933;">;</span>
            RepositoryConfig config <span style="color: #339933;">=</span> RepositoryConfig.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span>xml, dir<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">Repository</span> repository <span style="color: #339933;">=</span> RepositoryImpl.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">Thread</span>.<span style="color: #006633;">sleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>App.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">SEVERE</span>, <span style="color: #000066; font-weight: bold;">null</span>, ex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>RepositoryImpl<span style="color: #009900;">&#41;</span> repository<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">shutdown</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">ConfigurationException</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>App.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">SEVERE</span>, <span style="color: #000066; font-weight: bold;">null</span>, ex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>RepositoryException ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>App.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">SEVERE</span>, <span style="color: #000066; font-weight: bold;">null</span>, ex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The Repository configuration:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE Repository</span>
<span style="color: #00bbdd;">          PUBLIC &quot;-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN&quot;</span>
<span style="color: #00bbdd;">          &quot;http://jackrabbit.apache.org/dtd/repository-2.0.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Repository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;FileSystem</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.jackrabbit.core.fs.local.LocalFileSystem&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;path&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${rep.home}/repository&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/FileSystem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Security</span> <span style="color: #000066;">appName</span>=<span style="color: #ff0000;">&quot;jackrabbit-nodez-poc&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LoginManager</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.jackrabbit.core.security.SimpleAccessManager&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LoginModule</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.jackrabbit.core.security.SimpleLoginModule&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Security<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Workspaces</span> <span style="color: #000066;">rootPath</span>=<span style="color: #ff0000;">&quot;${rep.home}/workspaces&quot;</span> <span style="color: #000066;">defaultWorkspace</span>=<span style="color: #ff0000;">&quot;default&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Workspace</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;${wsp.name}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;FileSystem</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.jackrabbit.core.fs.local.LocalFileSystem&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;path&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${wsp.home}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/FileSystem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PersistenceManager</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Workspace<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Versioning</span> <span style="color: #000066;">rootPath</span>=<span style="color: #ff0000;">&quot;${rep.home}/version&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;FileSystem</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.jackrabbit.core.fs.local.LocalFileSystem&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;path&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${rep.home}/version&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/FileSystem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PersistenceManager</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Versioning<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Repository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>It turned out that an <abbr title="Nullpointer Exception">NPE</abbr> was thrown when I tried to shut down the Repository:</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;"><span style="">20223</span> <span class="br0">&#91;</span>main<span class="br0">&#93;</span> INFO org.apache.jackrabbit.core.RepositoryImpl  - Shutting down repository...
<span style="">20224</span> <span class="br0">&#91;</span>main<span class="br0">&#93;</span> INFO org.apache.jackrabbit.core.RepositoryImpl  - shutting down workspace 'default'...
<span style="">20224</span> <span class="br0">&#91;</span>main<span class="br0">&#93;</span> INFO org.apache.jackrabbit.core.observation.ObservationDispatcher  - Notification of EventListeners stopped.
Exception in thread &quot;main&quot; java.lang.NullPointerException: dispatcher
        at org.apache.jackrabbit.core.observation.ObservationManagerImpl.&lt;init&gt;<span class="br0">&#40;</span>ObservationManagerImpl.java:<span style="">97</span><span class="br0">&#41;</span>
        at org.apache.jackrabbit.core.WorkspaceImpl.getObservationManager<span class="br0">&#40;</span>WorkspaceImpl.java:<span style="">748</span><span class="br0">&#41;</span>
        at org.apache.jackrabbit.core.SessionImpl.removeRegisteredEventListeners<span class="br0">&#40;</span>SessionImpl.java:<span style="">1189</span><span class="br0">&#41;</span>
        at org.apache.jackrabbit.core.SessionImpl.logout<span class="br0">&#40;</span>SessionImpl.java:<span style="">1217</span><span class="br0">&#41;</span>
        at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doDispose<span class="br0">&#40;</span>RepositoryImpl.java:<span style="">2183</span><span class="br0">&#41;</span>
        at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.dispose<span class="br0">&#40;</span>RepositoryImpl.java:<span style="">2138</span><span class="br0">&#41;</span>
        at org.apache.jackrabbit.core.RepositoryImpl.doShutdown<span class="br0">&#40;</span>RepositoryImpl.java:<span style="">1175</span><span class="br0">&#41;</span>
        at org.apache.jackrabbit.core.RepositoryImpl.shutdown<span class="br0">&#40;</span>RepositoryImpl.java:<span style="">1127</span><span class="br0">&#41;</span>
        at ...</pre></div></div>

<h3>Solution</h3>
<p>Make sure to login.<br />
Yes. It&#8217;s that simple, just add</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">Session session <span style="color: #339933;">=</span> repository.<span style="color: #006633;">login</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>before you shut it down.<br />
Note: It seems to be a better practice to shutdown using a RepositoryImpl you retreived from this Session as well:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>RepositoryImpl<span style="color: #009900;">&#41;</span>session.<span style="color: #006633;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">shutdown</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The resulting &#8220;Hello Repository&#8221; code would look like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//use this to get a quick configuration for log4j output</span>
BasicConfigurator.<span style="color: #006633;">configure</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">String</span> xml <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;repository/configuration.xml&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">String</span> dir <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;repository&quot;</span><span style="color: #339933;">;</span>
            RepositoryConfig config <span style="color: #339933;">=</span> RepositoryConfig.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span>xml, dir<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">Repository</span> repository <span style="color: #339933;">=</span> RepositoryImpl.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            Session session <span style="color: #339933;">=</span> repository.<span style="color: #006633;">login</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">Thread</span>.<span style="color: #006633;">sleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>App.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">SEVERE</span>, <span style="color: #000066; font-weight: bold;">null</span>, ex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>RepositoryImpl<span style="color: #009900;">&#41;</span>session.<span style="color: #006633;">getRepository</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">shutdown</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">ConfigurationException</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>App.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">SEVERE</span>, <span style="color: #000066; font-weight: bold;">null</span>, ex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>RepositoryException ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>App.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">SEVERE</span>, <span style="color: #000066; font-weight: bold;">null</span>, ex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2010/04/apache-jackrabbit-2-jcr2-nullpointer-exception-on-shutdown/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Embedded gecko-browser in java-application with DJNativeSwing</title>
		<link>http://blog.macrominds.de/2010/03/embedded-gecko-browser-in-java-application-with-djnativeswing/</link>
		<comments>http://blog.macrominds.de/2010/03/embedded-gecko-browser-in-java-application-with-djnativeswing/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 10:51:21 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=265</guid>
		<description><![CDATA[The excellent library DJ Native Swing allows a java-program to use an embedded native Browser (among other things).
On Windows-Systems it uses an Internet-Explorer per default. However this browser isn&#8217;t exactly known for being standards-compliant. In order to use a mozilla firefox / gecko-browser, you can use XulRunner.
In order to bundle the XulRunner with your application [...]]]></description>
			<content:encoded><![CDATA[<p>The excellent library <a rel="external" href="http://djproject.sourceforge.net/ns/"><abbr>DJ</abbr> Native Swing</a> allows a java-program to use an embedded native Browser (among other things).<br />
On Windows-Systems it uses an Internet-Explorer per default. However this browser isn&#8217;t exactly known for being standards-compliant. In order to use a mozilla firefox / gecko-browser, you can use XulRunner.<br />
In order to bundle the XulRunner with your application (thus run a certain version without the need to install xulrunner), you can set the following properties in your java-application:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">String</span> xulHome <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lib/xulrunner&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getAbsolutePath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
NSSystemPropertySWT.<span style="color: #006633;">WEBBROWSER_XULRUNNER_HOME</span>.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span>xulHome<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;org.eclipse.swt.browser.XULRunnerPath&quot;</span>, xulHome<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This code needs to have the following directory-structure:</p>
<ul>
<li>yourapp.jar</li>
<li>lib (directory)
<ul>
<li>xulrunner (directory)
<ul>
<li>xulrunner-files (e.g. xpcom.dll)</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>A complete example on how to set up a frame with a browser can be found in the example source code of <a rel="external" href="http://djproject.sourceforge.net/ns/"><abbr>DJ</abbr> Native Swing</a>.</p>
<p><strong>[Update]</strong></p>
<p>You can&#8217;t expect that a native application embedded in swing will completely behave like a swing component.<br />There are several issues. Some of them have been solved by the developers of <abbr>DJ</abbr> Native Swing. Some not.</p>
<p><a rel="external" href="http://sourceforge.net/projects/djproject/forums/forum/671154/topic/3629028" >Currently you cannot display a Browser in a translucent (semitransparent) or shaped window</a>.</p>
<p><a rel="external" href="http://wiki.netbeans.org/EmbeddedBrowser">There&#8217;s a good collection of thoughts and tests about embedding a browser in Netbeans</a>.</p>
<p>And while you search the net for a useable Swing-Webbrowser, you&#8217;ll stumble across lots of wanna-be-solutions. All of them have issues concerning the integration in swing or the standards-compliant rendering.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2010/03/embedded-gecko-browser-in-java-application-with-djnativeswing/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>dealing with utf-8 in php5</title>
		<link>http://blog.macrominds.de/2010/03/dealing-with-utf-8-in-php5/</link>
		<comments>http://blog.macrominds.de/2010/03/dealing-with-utf-8-in-php5/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 11:36:02 +0000</pubDate>
		<dc:creator>Thomas Praxl</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.macrominds.de/?p=259</guid>
		<description><![CDATA[I just worked on a search-engine indexer, which crawls utf-8 files and creates an index of the words. There have been some issues, that are easy to solve if you know them.
First of all, I worked with utf-8 files without BOM.
In order to find possible searchwords, some regular expressions have been used.
The indexed words were [...]]]></description>
			<content:encoded><![CDATA[<p>I just worked on a search-engine indexer, which crawls utf-8 files and creates an index of the words. There have been some issues, that are easy to solve if you know them.<span id="more-259"></span></p>
<p>First of all, I worked with utf-8 files without <abbr title="Byte Order Mark">BOM</abbr>.</p>
<p>In order to find possible searchwords, some regular expressions have been used.</p>
<p>The indexed words were supposed to be stored in lower case.</p>
<h3>These are the suggestions, if you have a similar task:</h3>
<p>There was no problem with reading the files using get_file_contents or writing the index file using file_put_contents. (as all of my files, even the php-sources were encoded in utf-8).</p>
<p>Make sure to use preg_split or preg_replace with the &#8216;/u&#8217; option, for example preg_split(&#8221;/\b/u&#8221;, $haystack). This tells php to use utf-8. (see <a href="http://www.php.net/manual/de/reference.pcre.pattern.modifiers.php" rel="external">php.net &#8211; pcre pattern modifiers</a> for more information). Make sure to use the lowercase &#8216;u&#8217;.</p>
<p>Using mb_split instead of preg_split didn&#8217;t work for me, as the results differed from my expectation. I didn&#8217;t go deeper into it though.</p>
<p>To convert utf-8 strings to lowercase, don&#8217;t use strtolower, but use mb_convert_case($word,MB_CASE_LOWER,&#8221;UTF-8&#8243;); instead.</p>
<p>That&#8217;s it. If you have any further tips related to this topic, I&#8217;d appreciate your comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macrominds.de/2010/03/dealing-with-utf-8-in-php5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

