Dec 27, 2012

EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0

Hi,
Lately i had this exception in my spring jdbc part of code. What it
actually means is that your query probably doesn't return any value while you are trying to assign the query result into let's say 'int'.

Change the query from queryForInt to regular query that returns a list. Use row mapper also.
Check the list, if it's empty, nothing returned from the query, decide what to do, else if the list isn't empty
and contain data, also, decide what to do.
It then will work for you.



Hoped i helped,
Dor

Sep 14, 2012

ERROR: Failed to parse POMs

Strange situation where the local build success but the build on the jenkins fails. 

After investigation i have noticed that one of the developers have add a tab somewhere in the pom. 
The tab \t character cause this error in the jenkins

Removing this character solved the issue. Of course i have reported that also to the jenkins guys. 


Hoped it helped you,

Dor

Aug 7, 2012

java.awt.color.CMMException: Invalid image format

Caused by the metadata within the picture file.
Try to save the file without the metadata (usually camera metadata). Since this version doesn't support this metadata.
Another solution, use JAI instead.


Hoped that it helped,
Dor

Aug 5, 2012

visualvm Local java applications cannot be monitored

It used to be a bug, happened to me on windows 7.

Solution can be found in the internet and is simple.

Close all your java servers/applications eclipse etc.
Go to your \users\yourusernamedir\AppData\Local\Temp\hsperfdata_yourusernamedir
And delete this directory.

For me it worked.

Dor

Jul 19, 2012

Maven parallel build

Hi All,

I have looked for a while for this option, wondered how could it be that they don't have it.

Finally i found it, since maven 3v, they add an experimental option, the T option.

You can now run maven build parallel way. Meaning, maven will check which parts from the project tree he can build in parallel and do it.

Performance ?

Big boost, something like >20%, Do it for your self and compare, you want regret it.

Good also for CI (Jenkins for example)

How?

First way,
"mvn -T 4 clean install"

-T   => Stands for telling maven to use the parallel way.

4    => Means, 4 threads to use.

Second way and my preferred,
"mvn -T 4C clean install"

-T   => Stands for telling maven to use the parallel way.

4C  => Means, 4 threads on each core


Dor

Jul 17, 2012

logback asyncappender

Since 1.0.4 logback has the famous async appender we all waited for at least me.
It's great news, not to use any custom appenders or custom async appender but their in house.

Just to inform you.
Dor

Jul 12, 2012

CDH4 Hadoop Ubuntu precise server

I got this error "JAVA_HOME "
When trying to install CDH4 of Cloudera Hadoop standalone version.
Although i did all the needed configuration + echo $JAVA_HOME is fine.
+ writing "java" works + writing "java -version" works ok .
Nothing really helped except
1. go to /etc/hadoop/conf
2. edit hadoop-env.sh
add export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_32
then try again, i was trying to format the namenode.

Hoped it helped.
Dor

Jul 9, 2012

YARN vs MRV2


YARN is the up coming version 2.0.0 which is now in alpha and MRV2 as for map reduce version 2.0
They used to call mrv2 for the previous 0.23 version.

More about it can be found in cloudera site.

Spring Hibernate Envers java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(I)V

Issue occurred to my college at work. It means that spring uses already the envers as a dependency inside it and you are trying to add it also with a different version. As result -> Conflict.
For me it happened with
spring 3.0.5
hibernate 3.6.0.FINAL
* We added hibernate-envers 3.6.0.FINAL.

Solution
Replacing hibernate-envers with the latest, current latest is 4.1.4 but you should look in maven repository.



Jun 7, 2012

Spring Transaction Listener

Very easy way doing that is by registering the listener with the transaction.

TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
       @Override
       public void afterCommit() {
        // here you will do something
       }
   }
);

This is Spring based.


Have a good day,
Dor

May 21, 2012

PermGen Maven

Had this while building company's project.
Solution is very easy, add "MAVEN_OPTS" to your system parameters
+
Add "-Xms2048 -Xmx4096"
Of course the minimum size and the maximum size depends on your local machine.


Apr 18, 2012

junit NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper

Got this error while trying to run one of my junits.
This junit annotated with spring annotations and works with spring-web3.0.5-RELEASE.

After a lot of digging, it seems that the issue is simple.
You need to add this to your pom :

   <dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.4.2</version>
</dependency>

Jackson 1.4.2 suite to spring-web3.0.5

Problem caused since the jackson dependency in spring-web is an optional=true.

Jan 11, 2012

.svn directory missing after upgrade to 1.7

Hi,

After upgrading my TortoiseSVN to the latest version from 1.6.12 and as well as my SilkSubversion.

I Checkout my project from svn again (not relate to the upgrade) and noticed that only the root directory contains the ".svn" folder.

Child folders doesn't contain the ".svn" folder any more.

After a lot of digging it came out that from version 1.7.X of tortoise and silk there won't be any child ".svn" folders (hidden) anymore. Only one folder in the root.

+
If you work in eclipse, you need to uninstall (unless till you read this they will upgrade it) the old subversion/svnkit/javahl plugins from it and install it again using this updated site
"http://subclipse.tigris.org/update_1.8.x"




Hoped it helps,
Dor