Tag Archives: Java

Java: How to save / download a file available at a particular URL location in Internet?

Related articles Creating OSGi projects using Eclipse IDE and Maven (singztechmusings.wordpress.com) Working with OSGi and Maven in Eclipse IDE (singztechmusings.wordpress.com) Java download file from URL with unknown filename (stackoverflow.com) OSGi adoption by Large Scale Java-based Enterprise Software Platforms – LinkedIn Case Study (singztechmusings.wordpress.com) How to create/generate OSGi bundles from existing third-party jars? (singztechmusings.wordpress.com)

Groovy Programming with Eclipse: A Beginner’s Guide

What’s Groovy? If you know about Groovy already, you may skip this introduction. For those of you who are not aware of it yet, it’s one of the most popular Dynamic language for the Java platform (JVM). It is dynamically compiled to Java Virtual Machine (JVM) bytecode and interoperates with other Java code and libraries. […]

How to resolve HibernateObjectRetrievalFailureException (org.hibernate.ObjectNotFoundException: No row with the given identifier exists exception)?

Quite recently, we were getting the below exception in one of our stand-alone java application: org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException: No row with the given identifier exists: [example.hibernate.pojo.Person#10878]; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [example.hibernate.pojo.Person#10878] at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:660) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424) at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) at org.springframework.orm.hibernate3.HibernateTemplate.loadAll(HibernateTemplate.java:595) . . . Caused by: org.hibernate.ObjectNotFoundException: No row with […]

Contract-first Web Services: What are the different ways to define XML data contract?

I was glancing through Spring Web Services v2.0 framework reference tutorial today, and found an interesting piece of information that I’m gonna share with you all here: While writing contract-first web services i.e. developing web services that start with the XML Schema/WSDL contract first followed by the Java code second, there are four different ways […]

Java HotSpot VM Options: Client Vs Server And Impact On Performance

The Java Standard Edition Platform contains two implementations of the Java VM: 1. Java HotSpot Client VM, which is tuned for best performance when running applications in a client environment by reducing application start-up time and memory footprint. 2. Java HotSpot Server VM, which is designed for maximum program execution speed for applications running in […]

List all possible/different ways to create a Java object

The ways I know and have tried so far: 1. Using new keyword This is the most common way to create an object in java. Most of the time, Java objects are created in this way. MyTestObject obj = new MyTestObject(); 2. Using Class.forName() If we know the name of the class & if it […]

Java: Timezone Correction/Conversion with Daylight Savings Time settings

Have tried out a couple of code snippets to handle timezone corrections in Java code that’ll take into account Daylight Savings Time (DST) settings. None of them really suited our need; so I had to modify a particular code snippet which I found to be closer to what I was expecting. Here’s the modified code:. […]

J2EE/Java EE File Formats: EAR vs WAR

Overview J2EE application server has two containers (run time environments) – one is web container and other is EJB container Web container hosts web applications based on JSP/Servlets API – designed specifically for web request handling – more of request/response distributed computing. Web container requires the web module to be packaged in WAR file that […]

Getting started with Java’s ProcessBuilder: A simple utility class to interact with Linux from Java program

JDK 5.0 adds a new way of executing a command in a separate process, through a class called ProcessBuilder. You can find ProcessBuilder in the java.lang package (like Runtime and Process). According to the docs, This class is used to create operating system processes.Each ProcessBuilder instance manages a collection of process attributes. The start() method […]

PooledConnectionFactory vs CachingConnectionFactory: Which one is a perfect match for Spring JmsTemplate?

JmsTemplate, part of Core Spring JMS framework, simplifies the use of JMS since it handles the creation and release of resources when sending or synchronously receiving messages. As discussed in this post – https://singztechmusings.wordpress.com/2011/04/24/problem-with-creating-jms-messageproducer-using-spring-jmstemplate-how-to-solve/ – we need to have pooling in place to make it efficient. We’ve got two JMS provider choices: ActiveMQ‘s PooledConnectionFactory or […]