Category: Java

  • Active MQ – java.io.IOException: tmpFile.renameTo(classFile) failed

    I downloaded the latest version of Apache ActiveMQ. Post download followed the simple steps for installation and then followed the starting ActiveMQ. It started and I tried accessing the admin console @ http://localhost:8161/admin/. It opened by showed an error message: [sourcecode language=”java”] Error! Exception occurred while processing this request, check the log for more information!…

  • JAX-WS Custom Exception with FaultBean in TomEE and WebSphere Application Server

    In our last post we were able to deploy a simple JAX-WS service on both TomEE and WebSphere Application Server. JAX-WS Specification suggests that three thing should be followed for us to implement Custom Exception as SOAP Fault. WrapperException(String message, FaultBean faultInfo) A constructor where WrapperException is replaced with the name of the generated wrapper…

  • JAX-WS Exception Handling with TomEE and WebSphere Application Server 8.5

    Let’s write a simple JAX-WS example which will throw an Exception. We will then deploy it in TomEE and then to WebSphere 8.5 and see the difference. Download TomEE ( I have downloaded the plus version which at the time of writing was 1.7.1) Download and install WebSphere Application Server (Developer version is free) Download…

  • Java EE 6 Servlet – TomEE – Caused by: java.lang.IllegalArgumentException: Invalid in servlet mapping

    How bad a plain vanilla servlet can go with annotations??? Let’s see what happens if we miss a simple “/”. So I configured a simple Servlet in eclipse, see the code below [sourcecode language=”java”] package com.mumz.test.javaee.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class MySecondServlet. */…

  • Android ListFragment conflicts with a type defined in the same file – Heights of Ignorance

    Yesterday I stumbled upon below error while developing my Android application which also has a ListFragment [sourcecode language=”java”]The import android.support.v4.app.ListFragment conflicts with a type defined in the same file[/sourcecode] I had android-support-v4.jar in my libs folder and I was finding it very difficult to understand what could go wrong in such a simple class. And…

  • Android unable to execute dex : multiple dex files define Landroid

    Just today I started getting this exception: [sourcecode language=”java”]unable to execute dex : multiple dex files define Landroid[/sourcecode] Cause: This exception will come if you have multiple version of support library. Where to check: Right Click on Project and select Build Path Check in Libraries if you have support library added (This happens when we do…

  • Spring Data JPA

    Spring Data JPA provides a more cleaner approach of using JPA for DAO layer. It removes boilerplate code and developers can concentrate on actual logic. Our DataModel First create a maven project and add below dependencies: [sourcecode language=”xml”] <project xmlns="http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt; <modelVersion>4.0.0</modelVersion> <groupId>com.mumz.test.springdata.jpa</groupId> <artifactId>SpringDataJPA</artifactId> <version>0.0.1-SNAPSHOT</version> <properties> <spring.version>3.2.4.RELEASE</spring.version> <spring.data.version>1.3.4.RELEASE</spring.data.version> <hibernate.version>4.2.5.FINAL</hibernate.version> <jpa.version>1.0.1.FINAL</jpa.version> <querydsl.version>3.2.3</querydsl.version> <junit.version>4.8.2</junit.version> </properties>…

  • Integrating Primefaces and Spring Security

    Following all previous steps we always configured JSF and Spring. In case we use third party library like Primefaces you will have to configure resources required by Primefaces manually in Spring Security xml. Extending example at if we had Primefaces lib in our project we will have to add below configuration to jsfspring-sec-security-config.xml [sourcecode language=”xml”]…

  • Search Lucene Index created in database using JdbcDirectory

    In our last excercise we created Lucene index in database using JdbcDirectory which comes with Compass in this post we will search against index created. With this much of text let’s get our hand dirty and write some code. Please note following files will be used from create lucene index post pom.xml MyJDBCDirectory.java JDBCBatchInsert.java JDBCIndexer.java…

  • Android : Class file collision: A resource exists with a different case:

    Today I started getting this weird message in my Android project. A resource exists with a different case: ‘/MyApp/bin/classes/com/mumz/R$Id.class’. Initially I didn’t look at the error message closely and was goggling to get a resolution, which unfortunately I didn’t find so I came back to my eclipse and looked closely to the message. It was…