Connexxion : Connecting Life with Technology

Byte by Byte Impressions on Technology, People and Process !

Archive for the 'Java' Category


Better Software: Setting Up the Development Environment

Posted by vikashazrati on Friday, July 4, 2008

This is first, in series of posts on how to write Better Software. The series would try to touch upon stories which would result in development of better software.

This post is about having a minimalistic development environment setup to do effective software development. As you can see in the picture we need 5 entities to begin with.

Read the rest of this entry »

Posted in Agile, Better Software, General, Java | No Comments »

QuickTip: Patching up JBoss 4.0.3 sp1 with EJB3

Posted by vikashazrati on Thursday, June 19, 2008

JBoss provides built-in EJB3 support version 4.2x onwards. For rest of the versions you would need to download the specif JEMSInstaller and patch-in the EJB 3 support.

This is what the JBoss site has to say

Important Note: If you want EJB3 or Seam support with JBoss AS 4.0.3 SP1, 4.0.4 or 4.0.5, you MUST download and use the relevant version of JEMS Installer together with JDK5.0. JBoss AS 4.2.x versions include support for EJB3, by default.

The problem is that when you download the JEMS Installer  for 4.0.3 sp1 and follow the instructions to get the EJB3 support working, it does not work! Your .ear would be deployed but the relevant services to load the EJBs are not started and they are not registered in the JNDI tree.

To get the EJB3 patch onto 4.0.3 sp1 you need to do the following …

Read the rest of this entry »

Posted in Java | No Comments »

QuickTip: JUnit: The input type of the launch configuration does not exist

Posted by vikashazrati on Monday, June 9, 2008

If you are getting the above error message in Eclipse IDE, while running your test case, just make sure that you have the test class as a part of the “eclipse source folder” definition.

Easiest way. Right click on the folder –> Build Path –>Use as source folder

Done.

Posted in Java, testing | No Comments »

QuickTip: java.lang.RuntimeException: java.util.zip.ZipException

Posted by vikashazrati on Sunday, May 25, 2008

Recently we were trying to deploy a EJB3 .ear to the Jboss 4.3GA application server when we started getting this exception.

org.jboss.deployment.DeploymentException: exception in init of file:/D:/jboss-4.3.0.GA/server/default/deploy/esl_dist.ear/conf.jar
; - nested throwable: (java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file)
        at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:53)
        at org.jboss.deployment.MainDeployer.init(MainDeployer.java:901)
        at org.jboss.deployment.MainDeployer.init(MainDeployer.java:895)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:809)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
        at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

Luckily for us we did not have to spend too much time trying to sort it out. This exception occurs when the app server is not able to open the archive that you have created. In our case we had created the archive with winrar and the size of the archive was 95KB. When we created the archive again with Winzip the size war 107KB and this time deployment to the app server worked like a dream!

Posted in Java | No Comments »

QuickTip : annotations are not supported in -source 1.3

Posted by vikashazrati on Tuesday, May 13, 2008

If you are using Maven 2 and you see this issue when you are building your applications then easy way out is to add the following snippet to your pom.xml


<build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

Another tip: For posting source code on wordpress click here

Posted in Java | No Comments »

QuickTip: Eclipse on Ubuntu : java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin

Posted by vikashazrati on Monday, April 14, 2008

This problem occurs if you do not have the JRE from Sun, but you are using the JRE from GNU. To get the JRE from Sun execute the following command

$sudo apt-get install sun-java5-jre

now you should get the JRE installed in the directory /usr/lib/jvm

if you hit $ java -version now you should see something like this

java version “1.5.0_13″
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05)
Java HotSpot(TM) Server VM (build 1.5.0_13-b05, mixed mode)

Now your Eclipse Europa should work without complaining.

Posted in Java, linux | No Comments »

QuickTip: Setting Java Heap Size for Ant

Posted by vikashazrati on Thursday, March 13, 2008

Today once I started getting ‘Not enough memory’ while creating the build of a huge project using Ant.

The easy way to increase the heap size is

set ANT_OPTS=”-Xms512m -Xmx512m”

For me it worked without the quotes
set ANT_OPTS=-Xms512m -Xmx512m

For setting up the Java Heap size for other app servers and frameworks refer to this link.

Posted in Java | No Comments »

QuickTip : Generating project structure using Maven

Posted by vikashazrati on Monday, January 28, 2008

When you are starting a new project it is very easy to get started if the project structure can be built for you. Maven provides a plugin called maven-archetype-plugin which can help you generate the desired project structure depending on the application that you are trying to build.

The Archetype Plugin allows the user to build archetype containers. These archetype containers contains the pom, default source, test, resources, test-resources, and site-resources files in a specific directory structure. The content of the pom, the default files, and the directory structure depends on the what archetype container was built.

To create a simple java application you can use

mvn archetype:create -DgroupId=[your project's group id] -DartifactId=[your project's artifact id] -DarchetypeArtifactId=maven-archetype-quickstart

Likewise to create a webapp use something like this

Read the rest of this entry »

Posted in Java, Maven | Tagged: , , , , | No Comments »

QuickTip: Android does not load my application in the emulator

Posted by vikashazrati on Tuesday, January 1, 2008

I faced this problem when I was working with the Android Eclipse plugin and sometimes my application or the application changes would not show up on the emulator.

You might want to check out this link which Google has for the same problem. However in my case it was not helpful.

What worked in my case was killing the adb process. If you are using Ubuntu then goto System->Administration->System Monitor and hunt for the adb process, which would be sleeping. Kill the process and rerun your application.

On Windows you can go to the task manager and kill the adb process.

Your changes should start showing up now.

AddThis Social Bookmark Button

Posted in General, Java | No Comments »

Introducing Google Android

Posted by vikashazrati on Tuesday, January 1, 2008

android_icon_125.pngA couple of weeks back I was at the TiE Summit 2007. There I could hardly find anyone who was not interested in the mobile space. Mobile phone space definitely is something which cannot be missed given that today the number of mobile phones far out number the number of personal computers. Also, with each passing day they are getting better memory and better computing power. It would soon become a necessity for all major e-commerce sites to offer their services over the mobile phone assuming that they are not already working on it. Apart from this there is a lot of potential for specific mobile phone applications which would help the consumer do better personally and professionally.Almost coinciding with the mobile space euphoria, Google released Android. It is a a fully integrated mobile “software stack” that consists of an operating system, middleware, user-friendly interface and applications. The important objective is to deliver a vastly improved web experience on mobile devices, equal to what people can experience on a desktop computer, in contrast to the limited functionality on today’s mobile phones.

At the TiE Summit I also heard many speakers saying that “portal is dead.” The next technology wave is dependent on the platform. Many applications and services would be built depending on the platform and a business would be successful depending on which platform does it align with. So if you align on the Android platform then assuming that Android is successful, you could be successful as an Android service provider, Android powered device maker etc etc. HTC would be launching Android powered phones in 2008.

Given all of the above I decided to check out the Android offering over the weekend and here are my initial findings

Read the rest of this entry »

Posted in General, Java | 1 Comment »