Posts

Showing posts from 2014

Couldn't store job: Unable to serialize JobDataMap for insertion into database because the value of property 'jobLauncher' is not serializable

This occurs during the quartz - spring-batch integration when we are trying to pass in the JobLauncher object into the quartz class that extens the quartz bean. this can be overcome like below <bean id="fetchTransaction_quartz" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"> <property name="jobClass" value="com.incomm.chase.settlement.quartz.FetchTransaction"> </property>   <property name="jobDataAsMap">       <map>       entry key="timeout" value="5"/>       <entry key="jobName" value="chaseSettlement"></entry>       <!--the entries added here will cause a serialization exception -->           <!--  <entry key="jobLocator" value-ref="jobRegistry"/>            <entry key="jobLauncher" value-ref="jobLauncher"/> -->      </map>  </property>    

Web app root system property already set to different value: 'webapp.root'

<context-param>     <param-name>webAppRootKey</param-name>     <param-value>{project name and version}</param-value>    </context-param> Add this to Web.xml and this will fix the issue. Replace the value with project name and version number. Happy Coding.

Illegal character(s) in message header value

Recently was trying to consume a Rest Web Service by passing AES256 encrypted values in header Params and hit the above exception. java.lang.IllegalArgumentException: Illegal character(s) in message header value: After a little bit of resaerch i found that it is a bug with java while using BASE64 Encoded String.If the string length exceeds 76 characters, the Base64Encoder adds a "\n" character. While trying to sent it in header it fails complaining about the "\n" in the Base64 encoded string. This is actually a bug with JAVA http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6459815 The fix is String encodeMe = m_username + ":" + m_sToken; BASE64Encoder encoder = new BASE64Encoder(); String base64Encoded = encoder.encode(encodeMe.getBytes()); //!Important! - Get rid of any newline characters erroneously // added by the Base64Encoder base64Encoded = base64Encoded.replaceAll(&quo

Why Use Java Cryptography Extension (JCE) Unlimited Strength ?

An issue with Selecting the Encryption key size in java is that JDK has a key size specified in the Shipped out version. On doing a 256-bit AES encryption with the default JDK,will  throw an  InvalidKeyException , Exception with message  "Illegal key size or default parameters" . This is because of an arbitrary restriction imposed by JDK with default settings. The Cipher size by default is 128 bit and this is because of the restrictions imposed by some countries on the key size. How to make it 256 ?..  and in order to make it to a 256 bit requires a JCE - Java Cryptography Extension Unlimited Strength  Downloadable from this link http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html This will enable to have a 256 bit key encryption possible.  The Deployment instructions are defined in the bundle.After unzipping, copy paste the jars to Lib/Secuirty folder under JRE. if referring to a JDK, JRE will be within the JDK installation path.

Check if a port is open and is listening in Linux.

1.  lsof -i :<port>  (Takes seconds) 2.  netstat -an |grep <port> |grep LISTEN  (Takes seconds) 3.  telnet  <Server Ip> <port>

Remote Debugging the TC Server

Enabling Remote Debugging on TC server is Quite simple. Step 1: Enable remote debugging on the server and restart the server. Open setenv.bat (or .sh) in any text editor.File can be found at path-vmware-tc-sever\bin\setenv.bat. add these arguments to JVM_DEBUG_OPTS set JVM_DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8003,server=y,suspend=n Add %JVM_DEBUG_OPTS%  to JAVA_OPTS Eg:  JVM_OPTS=%GENERAL_JVM_OPTS% %SUN_JVM_OPTS% %JVM_DEBUG_OPTS% After making the above changes Step 2: Run this command and make sure the server is listening # fuser 8003/tcp         O/p   -- 8003/tcp:            21057  ls -l /proc/21057/exe  --   O/P -lrwxrwxrwx 1 root root 0 Mar  6 11:08 /proc/21057/exe -> /usr/java/jdk1.7.0_40/bin/java. Step 3: Enable the remote Debugging in Eclipse go to your eclipse Menu --> Run --> Debug Configuration Left Panel, double click on "Remote Java Application" Enter Conf Name Host: Give Remote Server n