Friday, October 31, 2014

Enable J2EE project or Java Web Project for Scala Code

Now a days, it has been very common to use SCALA programming language in Java based project. This may be chosen to get advantage of SCALA's multithreaded nature or this can also be done to slowly migrate Java based Web application from Java to Scala.

Recently, I had to integrate scala in a J2EE web project having JSP pages and Java classes. Here is what I could find out about integrating scala in J2EE project in Eclipse:

Pre-requisites:
1.) You have Eclipse platform with J2EE project setup.
2.) Your eclipse is enabled for SCALA

How to enable your J2EE project so that it can also run SCALA code?

Right click your Dynamic Web project --> Configuration --> Add Scala Nature.




Once you do this, the Eclipse will add SCALA libraries to your web project and your project will be able to compile and run the SCALA code just like Java Code.

Good Luck!

Tuesday, October 28, 2014

MDB did not pick message from queue with error: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2010' ('MQRC_DATA_LENGTH_ERROR')

You have a Message Driver Bean (MDB) which is not picking up message arriving on MQ queue and it gives following error?

MDB did not pick message from queue with error: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2010' ('MQRC_DATA_LENGTH_ERROR')


Caused by: com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ2002: Failed to get a message from destination 'EVENT.OUT'. WebSphere MQ classes for JMS attempted to perform an MQGET; however WebSphere MQ reported an error. Use the linked exception to determine the cause of this error.


I also got this error. This error occurs because the default message length for any Queue or Channel is set to be 4194304 bytes. And this needs to be changed to accept messages of bigger size.

So, I changed the size to 100MB for my Channel (I was using SYSTEM.DEF.SVRCONN) and restarted the MQ server.



The MDB started picking up message. Let me know if this doesn't work.