Illegal key size or default parameters

I was working on webservice call where my code was breaking in RAD during decrypting the password of keystore. I encountered below error:

Caused by: Illegal key size or default parameters
    at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6]
    at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6]
    at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6]
    at javax.crypto.Cipher.init(DashoA13*..) ~[na:1.6]
    at javax.crypto.Cipher.init(DashoA13*..) ~[na:1.6]

Continue reading “ Illegal key size or default parameters”

Caused by: Cannot recover key

During deployment of my code on server I faced below issue signature issue:

org.apache.axis2.AxisFault: Error in signature with X509Token
    at org.apache.rampart.handler.RampartSender.invoke(
    at org.apache.axis2.engine.Phase.invoke(
    at org.apache.axis2.engine.AxisEngine.invoke(
    at org.apache.axis2.engine.AxisEngine.send(
    at org.apache.axis2.description.OutInAxisOperationClient.send(
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
    at org.apache.axis2.client.OperationClient.execute(
 Caused by: org.apache.rampart.RampartException: Error in signature with X509Token
    at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignature(
    at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignBeforeEncrypt(
    at org.apache.rampart.handler.RampartSender.invoke(
    … 102 more

Caused by: Signature creation failed; nested exception is: Cannot recover key
    at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignature(
    … 106 more
Caused by: Cannot recover key
    … 107 more

Continue reading “Caused by: Cannot recover key”

java.lang.IllegalStateException: Cannot map handler [controller] to URL path : There is already handler

I am using Spring 3.0 for my new application…I am not very familiar with annotation but learning them they are cool.  Today I faced “Cannot Map Handler [XXX] to URL Path” error, while running my page.

Later debug I found that I duplicated the Controller definition stuff inside XXX-Servlet.xml as below. Continue reading “java.lang.IllegalStateException: Cannot map handler [controller] to URL path : There is already handler”

How To get ServletContext inside Filter

I was coding last night and I have to get some information from Manifest file in filters. In order to read the Manifest I need the ServletContext. Using below code you can get the ServletContext inside Filter.

public class SomeFilter implements Filter {
FilterConfig config;

public void setFilterConfig(FilterConfig config) {
this.config = config;

public FilterConfig getFilterConfig() {
return config;

public void init(FilterConfig config) throws ServletException {

// doFilter and destroy methods…
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {

ServletContext context = getFilterConfig().getServletContext();
Manifest mManifest=new Manifest();
System.out.println(“Manifest “+mManifest.getBuildInfo(context));


XStream: Cannot parse date

I was sending date “06-14-2011” in XML request, during it’s processing i got this parse error

Cannot parse date 06-14-2011 com.thoughtworks.xstream.converters.basic.DateConverter.fromString(

this is because Xstream by default don’t handle MM-dd-yyyy format. So we need to add one in order to make our format working.

String[] formats ={“MM-dd-yyyy”}; XStream xstream = new XStream(); xstream.registerConverter(new DateConverter(“MM-dd-yyyy”,formats)); Object obj=xstream.fromXML(inputXML)

This will resolve the issue. =)

Mainframe CICS DB2 : java.lang.NoClassDefFoundError: com/ibm/crypto/provider/IBMJCE

I was trying to access Mainframe () DB2 using standalone application with “” driver where I encountered the below error

java.lang.NoClassDefFoundError: com/ibm/crypto/provider/IBMJCE

Problem was that ibmjceprovider.jar was missing from my classpath and file I added the jar file and then added below line in security works.

Java Return Value to Unix Shell Script

Today I faced a situation where I need to verify something though Java class in database . My problem was I have to do this inside unix shell script. I created the below solution to achieve that, I am posting here sample working code:


public class Sample

public static void main(String args[])
//Do the complete logic and print the result using system out
System.out.println(“Sample Testing”);    

Shell Script

Continue reading “Java Return Value to Unix Shell Script”

DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704

SQLCODE -204 is "object does not exist".

I was getting this error while executing a query, this was happening because I was using the SCHEMA name of Q7 database and executing the query inside Q0 db.

means not able to find table with given user id.

When I corrected the db name it works fine.

This error also appear when you are not using schema name in query.

When we need HttpSessionBindingListener?

The HttpSessionBindingListener interface is implemented when an object needs to be notified if it's being bound to a session or unbound from a session.

Objects implement this interface so that they can be notified when they are being bound or unbound from a HttpSession. When a binding occurs (using HttpSession.setAttribute()) HttpSessionBindingEvent communicates the event and identifies the session into which the object is bound. Similarly, when an unbinding occurs (using HttpSession.removeAttribute()) HttpSessionBindingEvent communicates the event and identifies the session from which the object is unbound.

This interface has two methods, that are notified when the status of the object has changed:

  • public void valueBound(HttpSessionBindingEvent event) : Notifies the object that it is being bound to a session and identifies the session.
  • public void valueUnbound(HttpSessionBindingEvent event) : Notifies the object that it is being unbound from a session and identifies the session.

Note, this listener will not be declared in the deployment descriptor as the same as HttpSessionActivationListener interface. The container at runtime will introspect this object to see if it implements the HttpSessionActivationListener and/or HttpSessionBindingListener and fires appropriate events to the object.

These methods have a HttpSessionBindingEvent parameter that can be used to retrieve the session that the object was bound to and the name it was given in the session.

Class HttpSessionBindingEvent

Events of this type are either sent to an object that implements HttpSessionBindingListener when it is bound or unbound from a session, or to a HttpSessionAttributeListener that has been configured in the deployment descriptor when any attribute is bound, unbound or replaced in a session.

The session binds the object by a call to HttpSession.setAttribute and unbinds the object by a call to HttpSession.removeAttribute.

The methods of this object that are used to get the name that's assigned to the object, the session it's bound to, and the actual object:

  • public String getName() : Returns the name with which the attribute is bound to or unbound from the session.
  • public Object getValue() : Returns the value of the attribute that has been added, removed or replaced. If the attribute was added (or bound), this is the value of the attribute. If the attrubute was removed (or unbound), this is the value of the removed attribute. If the attribute was replaced, this is the old value of the attribute.
  • public HttpSession getSession() : Return the HttpSession that the object was bound to or unbound from.