Techies Experience

Friday, April 11, 2014

How to Resolve java.net.unknownhostexception in Jboss

Java Technlogy Updates : How to Resolve java.net.unknownhostexception in Jboss

How to Resolve java.net.unknownhostexception in Jboss


This post describes How to Resolve java.net.unknownhostexception in Jboss.
Many times we have seen when we start jboss we are facing one exception in jboss "java.net.UnknownHostException".

1:  java.net.UnknownHostException: localhost.localdomain: localhost.localdomain  
2:  at java.net.InetAddress.getLocalHost(InetAddress.java:1234)  
3:  at org.jboss.system.server.ServerInfo.getHostAddress(ServerInfo.java:233)  
How to resolve this Exception.One Quick solutions to resolve this exception is modify /etc/hosts configuration file in linux.
in this post will discuss how to modify /etc/hosts file and how to change entry in /etc/hosts file.

What is /etc/hosts file


The hosts file contains lines of text containing IP address in the first text field followed by one or more host names. Each field is separated by white space (blanks or seperated by tab).
Comment lines may be included; they are indicated by a hash character (#) in the first position of such lines. Entirely blank lines in the file are ignored.

For example,Hosts contains following details:
1:  # IPAddress Hostname        Alias   
2:  192.168.11.55 chkmmd051.kgnglobal.local chkmmd051   
3:  127.0.0.1 localhost.localdomain localdomain   
4:  ::1  localhost localhost.localdomain localhost6 localhost6.localdomain6   

The left column is the IP address to be resolved. The next column is that host's name and next columns are alias for that host. In the second line, for example, the IP address 192.168.11.55 is for the host chkmmd051.kgnglobal.local Another alias is chkmmd051.

to change this file will require root user permission, After you are finished configuration of your files, don't forget to restart your services and restart your jboss server for the changes to take effect.

References :
  1. How do I modify my hosts file? @ http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file
  2. How to Modify /etc/hosts @ http://community.linuxmint.com/tutorial/view/159

Monday, April 7, 2014

How to Select Oracle Driver Version

Java Technlogy Updates : How to Select oracle Driver Version

How To select Oracle Driver Version


This post describes how to use diffrent JDBC drivers with diffrent JDK versions.
whenever we upgrdate our database or JDK we are facing Exceptions like "DriverManager.getConnection gives the Error: "No suitable driver".

Check this link for more information how to select oracle driver version and other database version.


Which JDBC drivers support which versions of Javasoft's JDK?


Below table shows how to use jdk and JDBC drivers.

Driver Compatibility Matrix
JDBC drivers Version Driver Type JDK Version
Oracle pre-8i OCI THIN Drivers JDK 1.0.x and JDK 1.1.x
Oracle 8.1.5 OCI and THIN Drivers JDK 1.0.x and JDK 1.1.x
Oracle 8.1.6 SDK THIN Driver JDK 1.1.x and JDK 1.2.x (aka Java2)
8.1.6 SDK OCI Driver JDK 1.1.x
8.1.6 OCI and THIN Driver JDK 1.1.x and JDK 1.2.x
8.1.7 OCI and THIN Driver JDK 1.1.x and JDK 1.2.x
9.0.1 OCI and THIN Driver JDK 1.1.x, JDK 1.2.x and JDK 1.3.x
9.0.2 OCI and THIN Driver JDK 1.1.x, JDK 1.2.x, JDK 1.3.x, and JDK 1.4.x
10.1.0 OCI and THIN Driver JDK 1.1.x, JDK 1.2.x, JDK 1.3.x, and JDK 1.4.x
10.2.0 OCI and THIN Driver JDK 1.2.x, JDK 1.3.x, JDK 1.4.x, and JDK 5.0.x

What are the jar files and supported JDK Installation.


Supported JDK Installation for Oracle Drivers.
Supported Jar File Java Version Remarks
ojdbc5.jar JDK1.5  
ojdbc5_g.jar JDK1.5 compiled with option -g
ojdbc5dms.jar JDK1.5 includes code to support Oracle Dynamic Monitoring Service
ojdbc5dms_g.jar JDK1.5 includes code to support Oracle Dynamic Monitoring Service
ojdbc6.jar JDK1.6 support basic functionality for the Thin and OCI drivers
ojdbc6_g.jar JDK1.6  
ojdbc6dms.jar JDK1.6 Oracle Dynamic Monitoring Service (DMS)
ojdbc6dms_g.jar JDK1.6 full JDBC logging support
In future whenever you upgrade Database version you have to conside appropriate JDK version.
References :
  1. Oracle Driver Version @ http://www.oracle.com/technetwork/java/hotspotfaq-138619.html
  2. Feature Matrix for Oracle Server JDBC drivers @ https://www.inetsoftware.de/products/jdbc-driver/oracle/features