… for your ego.

Recently I discovered the code analyzer Sonar Qube with it’s eclipse plugin SonarLint.
When I uploaded my latest , perfect Java project, it revealed a lot of issues and possible problems.
It took some effort to correct the issues and make Sonar Qube happy. To my surprise the code seems to be cleaner and easier to understand.

Superhuman developers do make errors and they know it.

If you’re using a images in eclipse plugins: DO USE THE RESOURCE MANAGER !

I’m getting more and more into the Java World at the moment. Switching from pure Domino to pure Java. Outside of Domino, there’s a lot about manageing dependencies. The freedom of choice is paid by work to beat different runtimes.
Looking for a decent tool to help managing dependencies I came across Ant, Maven and Gradle.
Ant I new from the past. It’s ok but seems to be a lot of code to write and it’s XML…
Maven? Seems that I’m not smart enough.
I was not able to setup a working multi project setup without installing my sub projects in a repository. And it’s XML too.
Gradle, the youngest among these three, groovy based. After reading through some tutorials, and combing through stackoverflow I was able to setup my multi-project build,
with integratopm into my eclipse environment.

Even a Vaadin client is compiling with the right plugin. So I was not forced to use the Vaadin eclipse plugin at all. One thing I was not happy, the Vaadin plugin compiles some JavaDoc and Sources into my final EAR.

Step 1: Remove the JavaDoc and Sources from the deployment descriptor

deploymentDescriptor{
....
withXml {
def javaDocNode = asNode().module.find { it.ejb.text().contains('javadoc.jar') }
if (javaDocNode) {
asNode().remove( javaDocNode )
}
def sourceNode = asNode().module.find{it.ejb.text().contains('sources.jar') }
if (sourceNode) {
asNode().remove(sourceNode)
}
}
}

 

Step 2: Removing the actual Jar’s from the EAR

This page  helped me creating the following block

import org.apache.tools.ant.taskdefs.condition.Os
task removeJars (dependsOn:'ear'){
description 'Entferne unnötige Source und JavaDoc Jars'

doLast {
	if (Os.isFamily(Os.FAMILY_UNIX)){
	println "Entferne unnötige Source und JavaDoc Jars"
	 exec {
  		executable "zip"
  		args "-d", "build/libs/${project.archivesBaseName}-${project.version}.ear", "*-${project.version}-sources.jar"
 	 }
     exec {
     	executable "zip"
  		args "-d", "build/libs/${project.archivesBaseName}-${project.version}.ear", "*-${project.version}-javadoc.jar"
 	}
 	}
 	else
 	{
 		println "get Linux!"
 	}
 	}
}

 

Now I can build my EAR by simply calling gradle assemble removeJars
 

Tagged with: , ,

A long time ago, on a server far, far away….
There was this Connections Community everybody had to be a member, as there would be most important news posted there. And though shall not only be a member of that community no though shall follow it wherever the community may roam.

I accepted the quest and prepared for a long journey through the internet. From the depth of the IBM Infocenter and other resources I brought back an Assembly Line and some shell scripts.
And all was fine, quest completed, I thought. Creeping back to my cave to find some rest.

Short after I finished the quest I heard a cry. It was demanded to add another community which everybody has to be part of. And some communities you should not be able to not follow or even leave.

My crystal ball revealed that there will be more changes and new communities in the future.
This led me to the decision to throw away Assembly lines and scripts and rebuild the processes with a proper UI.
Soon I’ll be able to delegate that work to my principals and find some rest in my beloved cave….

I used the Openntf Junit plugin the first time today.
I was really surprised how easy it is to use and how fast it was integrated in my current project. Setup instructions.

With JUnit integrated this way I’m able to do my backend testing without writing any additional Xpage.

Tagged with:

Thanks to Michele Buccarello and the IBM Support
A workaround for the issue with the file viewer not working from the Connections 5.5’s activity stream has been discovered.

see this for more details.

I like the nginx server.
Easy to install, simple configuration file.

I built a new Development VM with Domino 9 and installed nginx on it.
Changed the Domino’s http port to 8088. restarted it, tested it. worked.
Removed the nginx default config. Created new config files.
I ran nginx -t, to check the config and service nginx start to startup the server. It started.

When I tried to connect to it, I got an err_connection_refused.
Checking with netstat I could not find anything listening on port 80.
Checking the nginx error log. empty.
Checked that the config file was under /etc/nginx/conf.d present.
Googled to see wether someone else had this issue before, found some hints but nothing worked.

After another cup of coffe I got back to my config file.
Sometimes the error sits in front of the screen.
I screwed the config file on purpose and restarted the nginx without getting an error.
Checking back at my config file I recognized my failure. The file extension was wrong.
Remember the extension has to be .conf ….

Tagged with: ,

If this code returns Null

public static Session getSessionAsSigner() {
 Session sessionAsSigner = null;
 try {
  FacesContext context = JSFUtil.getFacesContext();
  sessionAsSigner = (Session) context.getApplication().getVariableResolver().resolveVariable(context,"sessionAsSigner");
 } catch (Exception e) {
 Util.logError(e);
 }
 return sessionAsSigner;
 } 

Then your code might have been signed by different user / servers.. Just sign it with your user ID and try again.

Open the httpd.conf.

Uncomment the following lines

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Add a new Virtual Host entry.

<IfModule mod_ibm_ssl.c>
 NameVirtualHost *:443
 Listen *:443
 #Virtual Host for the Connections Server
 <VirtualHost *:443>
  ServerName connect5.belsoft.ch
  SSLEnable
  RewriteEngine On
  RewriteRule ^/$ https://connect5.belsoft.ch/homepage [R,L]
 </VirtualHost>

 #VirtualHost for the proxied Domino
 <VirtualHost *:443>
  ProxyPreserveHost On
  ProxyPass / http://ldap.lab/
  ProxyPassReverse / http://ldap.lab/
  ServerName tools.belsoft.ch
</VirtualHost></pre>
<pre></IfModule></pre>
<pre>

 

Evreybody knows that starting an XPage for the first time takes some time. Using the Notes.ini parameter for preloading the xpages can become slightly difficult if you have a lot of apps.

My solution is quite simple

 
#!/bin/bash 
USERNAME="UserName" 
PASSWORD="Password" 
BASEPATH=/opt/ibm/apps 
LOGIN_URL="https://[SERVER_NAME]/names.nsf?login" 
XPAGES_URL="https://[SERVER_NAME]/[PATH_TO_NSF]/myXpages.xsp"
if [ -f $BASEPATH/last.run ]; then
rm $BASEPATH/last.run
fi
wget --save-cookies cookies.txt --keep-session-cookies --post-data "Username=$USERNAME&Password=$PASSWORD" --delete-after $LOGIN_URL 
wget --load-cookies cookies.txt --delete-after $XPAGES_URL
if [ -f $BASEPATH/cookies.txt ] ; then 
 rm $BASEPATH/cookies.txt 
fi 
touch $BASEPATH/last.run 

Place this file on the server and call it through cron on a regular schedule and your xpages should be always loaded.

As always, use on your own risk.

Top