quote

lunedì, novembre 25, 2013

Soup with vegetables

Here a simple recipe to prepare a tasty soup with vegetables. Before starting make sure you have the following ingredients: 2 potatoes without peel, 3 carrots, 10 green beans with the ends cut, 1 pepper, 300ml tomato sauce, salt, oil of olive, 1 onion without peel.
So, let's start!
  • Cut the potatoes, carrots, green beans, pepper, onion in small pieces, not so small though.
  • Put these ingredients in a pot and fill it with the water.
  • Light the fire and wait till the water in the pot start to boil.
  • Once it's boiling reduce the level of firing to minimum and let it boil for other 60 minutes; really this is important, the level of firing should be very low, you should observe the level of water just boiling a bit.
  • Add the potatoes in the pot.
  • Add two spoons of oil of olive and a bit of salt.
  • Let it boil, always with low fire, for about 25 minutes.
  • Add the tomato sauce and half of dado knorr
  • Let it boil for the last 5 minutes.
Finally serve it hot in a dish with some slices of bread.
I learned how to prepare it today in the soup session with my friend Cristian, I hope to have not forgotten some steps so I won't consider myself responsible of the success of the soup ;-)

giovedì, novembre 21, 2013

Building Reactive Apps @ Jug Lausanne

Yesterday I've participated at the meeting @ JUG Lausanne, where there was a presentation with the title "Building Reactive Apps" kept by James Ward.
In the room there were about 40 persons and the speech was kept in English.
After having talked about the reactive manifesto , the speaker shortly introduced the principles of reactive programming
Has followed a demo of how to build a reactive application with the play framework, where he showed the usage of Future classes. Other topics were related websocket, actors in AKKA, scala and so on.
I think I'll give a try to these new technologies.

venerdì, settembre 13, 2013

NoClassDefFoundError in Jboss with maven EJB plugin when using SNAPSHOT dependencies

Context: Jboss 5.1.0, maven 2.x, snapshot dependencies.
Problem: I got this exception after deployed my ear in jboss 5.1.

EAR name: myEAR.ear
ejb component: services.jar

Jboss classloader cannot find the myPackage/MyInterface.class when this is a SNAPSHOT dependency of my services.jar.

Solution: Correct configuration of the maven ejb plugin.
You need to set to false the useUniqueVersion attribute.

org.apache.maven.plugins maven-ejb-plugin 3.0 true false Exception stack-trace:

er.MBeanServerImpl@52f97d27[ defaultDomain='jboss' ]
2013-09-13 14:22:03,699 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to PostClassLoader: name=vfszip:/usr/local/jboss-5.1.0.GA-jdk/server/standard/deploy/myEAR.ear/ state=ClassLoader mode=Manual requiredState=PostClassLoader
org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/usr/local/jboss-5.1.0.GA-jdk/server/standard/deploy/myEAR.ear/services.jar/
        at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
        at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:177)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
        at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
        at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
        at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
        at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
        at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
        at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
        at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
        at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
        at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
        at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
        at org.jboss.Main.boot(Main.java:221)
        at org.jboss.Main$1.run(Main.java:556)
        at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NoClassDefFoundError: myPackage/MyInterface
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
        at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
        at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)
        at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
        at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
        at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
        at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)


lunedì, maggio 20, 2013

Spring - Unable to process claimed identity 'https://www.google.com/accounts/o8/id'

Issue - The openId gmail authentication, built on top of springsecurity, stopped to work on my website and I got this error:
org.springframework.security.authentication.AuthenticationServiceException: Unable to process claimed identity 'https://www.google.com/accounts/o8/id'

Reason - in the class OpenID4JavaConsumer
error: org.openid4java.discovery.DiscoveryException: 0x70d: Error parsing XML document

Solution
I fixed the issue by updating the version of xmlParserAPIs and xercesImpl from 2.5 to 2.6.x.
The wrong version for xmlParserAPIs and xmlParserAPIs was brought by jcaptcha so I had to exclude those two.
See this link on jugevents.

giovedì, ottobre 11, 2012

mercurial and mercurialEclipse plugin in ubuntu

Install the latest version of mercurial

  • $ sudo add-apt-repository ppa:mercurial-ppa/releases
  • sudo apt-get update
  • $ sudo apt-get install mercurial
  • check version of mercurial: $ hg --version

Mercurial eclipse plugin

  • Help/Eclipse marketplace
  • Find: Mercurial
  • Install MercurialEclipse (requires at least mercurial 2.0)
Resources


mercoledì, ottobre 10, 2012

Creating a shortcut to eclipse on the ubuntu desktop

Proceed in this way:
  • right click on desktop: Create Launcher
  • set the proper icon eclipse_home/icon.xpm
  • Set the command: eclipse_home/eclipse
Troubleshooting
Issue: "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations "
Solution
  • $ cd eclipse_home
  • $ mkdir jre
  • $ cd jre
  • $ ln -s /opt/jdk1.6.0_35/jre/bin/ bin
Resources:

martedì, maggio 08, 2012

filesync eclipse plugin

Nice eclipse plugin to synchronize resources.
http://andrei.gmxhome.de/filesync/index.html
Adopting it will speed up your development process without need to rebuild each time you edit a resource in the src folder, for instances a jsp.

venerdì, gennaio 27, 2012

Remotely debug tomcat on linux

Create this simple shell script: debugtomcat.sh

#leave this command for future reference
#export currentdir=`pwd`
export JAVA_OPTS='-Xmx1024m -XX:MaxPermSize=512m
-Xdebug -Xrunjdwp:transport=dt_socket,
address=8000,server=y,suspend=n'
echo JAVA_OPTS: $JAVA_OPTS
/$HOME/MyPrograms/apache-tomcat-6.0.35/bin/catalina.sh run


resource

mercoledì, dicembre 07, 2011

svn ignore list commands


  • % set SVN_EDITOR=notepad
  • % svn propedit svn:ignore .
  • % svn propget svn:ignore .

Decrease the double click speed for Java Applications on Ubuntu Linux

I couldn't properly use double click on idea so I found a great solution in this post.
To resume:
In your home directory create a file called .Xresources and add the following line

*multiClickTime: 400

Then from the commandline execute

xrdb ~/.Xresources


It's amazing that intellij doesn't take in account this issue.

venerdì, luglio 22, 2011

Serving jboss logs as static content

This configuration has been tested using red hat linux and jboss 5.1.x

  1. Edit the
    <jboss_home>/server/default/deployers/jbossweb.deployer/web.xml
    and change the servlet attribute listings from false to true.
  2. Edit the
    <jboss_home>/server/default/deploy/jbossweb.sar/servlet.xml
    and add the attribute allowLinking="true" to the Context element.
  3. Create a log folder in the path
    <jboss_home>/server/default/deploy/ROOT.war
  4. In the log folder create a symbolic link to the log folder of jboss
    $ ln -s ../../../log listAll
  5. Restart the jboss instance
  6. The logs will be available at this url http://myHost:8080/log/listAll

Links
Enable symlinks
Enable directory browsing

venerdì, maggio 27, 2011

The thin red line - quotes

quotes

We'll meet again some day.
People who have been as close as we've been
always meet again.

sabato, maggio 14, 2011

martedì, febbraio 22, 2011

Jboss - Port already in use: 1098

I got this exception after started jboss 5.1 on windows XP.


ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main)
Error installing to Start: name=jboss:service=Naming
state=Create mode=Manual requiredState=Installed
java.rmi.server.ExportException: Port already in use: 1098;
nested exception is:
java.net.BindException: Address already in use: JVM_Bind


I tried to understand which process was using that port by running this command:

$> netstat -a -o -n

But the result didn't show any port associated to 1098.
Finally I edited the file at <jboss_51_home>\server\default\conf\bindingservice.beans\META-INF\bindings-jboss-beans.xml
and changed the value of the port 1098 to 10980 and the error has disappeared.
Windows and Jboss ...such a nightmare.
Here the link where I found the solution.

Nice java client to execute remote ssh

http://www.journaldev.com/246/java-program-to-run-shell-commands-on-ssh-enabled-system
Just add this dependency at your pom.xml

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.42</version>
</dependency>

lunedì, febbraio 21, 2011

Stop jboss in the case it's running

If you need to stop jboss inside a shell script this block of code could be useful.

if ps -ef | grep "<jboss_home>/bin/run.jar" | grep -v grep
then
echo [deploy] Stopping Jboss...
<jboss_home>/bin/shutdown.sh -S --server=localhost:1199
sleep 12s
else
echo [deploy] Jboss was already stopped
sleep 2s
fi

venerdì, febbraio 18, 2011

java.net.MalformedURLException: no protocol: and

I was trying to configure maven cargo plugin when I came across this exception:

Caused by: java.net.MalformedURLException: no protocol: and

I spent several hours trying to find the meaning of this error message when finally I found this link:


http://jackrabbit.510166.n4.nabble.com/jcr-rmi-problems-td534137.html


The author says:

The "and"
comes from the folder where your classes are which is probably something
beneath "C:\Documents and Settings"

So found the root of the problem, the maven local repository in windows is located at the path:
C:\Documents and Settings\<user>\.m2

So I have overridden the local maven repository folder adding this entry in the settings.xml maven configuration file:

<localRepository>c:/mavenrepository</localRepository>


After this change the error has disappeared.

giovedì, febbraio 10, 2011

Accesing to windows file system from cygwin


$ cd /cygdrive/c

That's pretty easy, but I always forget it...

martedì, febbraio 08, 2011

Spring - Referring to a String as a bean


<bean id="myString" class="java.lang.String">
<constructor-arg type="java.lang.String" value="Lucio"/>
</bean>

<bean id="myUser" class="com.benfante.User">
<property name="firstName" ref="myString"/>

</bean>

Thanks to Lucio for the example

lunedì, febbraio 07, 2011

svn client issue

After connecting to svn server using different users I got this message:

svn: Server sent unexpected return value (501 Method Not Implemented) in response to MKCOL request for

I have sorted out it deleting this folder on windows:

C:\Documents and Settings\myUser\Application Data\Subversion\auth