Retrieve Key-Value Pairs of the Properties files in Java

Java  Properties class represents a persistent set of properties.

Properties class extends HashTable meaning Properties inherits from Hashtable, So put and putAll methods can be applied to a Properties object.

Some of useful methods are metioned below which object of Properties class can call.

Properties pro = new Properties();

  1. keySet() - Retrieve Set of Keys 
  2. keys() - Retrieves all keys of the properties files. Which stored in the Enumeration objects.

javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found

I was working on writing JSR 303 Custom Validation to validate Email Address and encountered with following exception.

javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
    at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)
    at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:110)
    at com.anuj.core.test.ValidEmailTest.setUp(ValidEmailTest.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)

How to write Custom JSR 303 Validation using ConstraintValidator

What is JSR 303?
JSR 303 is Java Bean Validation framework which comes as part of J2EE 6. So in order to use classes specified by them, for Validation you need to include javaee-api jar Ex. javaee-api-7.0.jar

Requirement :
Consider that I want to write my own custom validation to validate email. Ya, there is already email validator provided by Hibernate as part of Hibernate 4.2 but this is just for eample. and you can create own validation to validate FileName or any other validation you like.

Steps to create Custom Validation to validate Email :
1. Create Interface - @interface
2. Create Custom Validation Implementation class using ConstraintValidator
3. Apply Custom Annotation to Bean(Pojo) but it can be any where on Constructor,Method,parameter,Field etc based on how you have added ElementType in @Target

EJB 3.1 SessionBean Example with Remote Interface using WebLogic 12.1.1

EJB stands for Enterprise Java Bean. If you are not fimilar with EJB, Please read below in order to move ahead with "Creating EJB 3.1 Application using WebLogic 12.1.1".
  1. What is EJB and Why Comes into Picture
  2. EJB Container and it's Feature
EJB application requires to be run in Application Server like WebLogic, JBoss. As part of current EJB Demo, WebLogic Server 12.1.1 and  JDK 1.7 Update 03 is used.

Suppose, I want to write Stateless Session Bean(Can be local or remote), in My case Remote Component which will provide customer Information upon request from Client.

How to write JAX-WS WebServices and WebService Client in Java

Today, I am going to explain about how to write JAX-WS Webservice providers(Endpoints) and how to create webservice client which uses published webservices.

JAX-WS is Java Api for XML webservices. APIs for creating webservices in XML formats.

Let's consider that I want to write JAX-WS Service which will publish customer Information and client will use this service and display requested customer Information.

You require to develop following parts :
  1. Create WebService Endpoint Interfaces
  2. Create WebService Endpoint Implementation
  3. Endpoint Publisher
  4. Analyze Created wsdl file
  5. Create WebService Client which will use exposed services.