Wednesday, June 27, 2007

JDK 1.6 + JBoss 4.2.0 + EJB3 Web Service + Axis2

Few days ago I started to implement web service in current project.I exposed a few methods in existing EJB.The deployment of WS to JBoss server and generating WS client using Axis2 are ok.But when the client trying to invoke the WS at server,exception was thrown at server side.

java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at javax.xml.soap.SOAPMessage.setProperty(SOAPMessage.java:424)
at org.jboss.ws.soap.SOAPMessageImpl.(SOAPMessageImpl.java:65)
at org.jboss.ws.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:115)
at org.jboss.ws.binding.soap.SOAP11BindingProvider.createMessage(SOAP11BindingProvider.java:59)
at org.jboss.ws.binding.soap.SOAPBindingProvider.bindRequestMessage(SOAPBindingProvider.java:89)
at org.jboss.ws.binding.soap.SOAP11BindingProvider.bindRequestMessage(SOAP11BindingProvider.java:65)
at org.jboss.ws.jaxrpc.CallImpl.invokeInternal(CallImpl.java:645)
at org.jboss.ws.jaxrpc.CallImpl.invoke(CallImpl.java:404)
...

Same problem was reported at JBossWS Jira .click here

After I googling,I found that this problem only arise when we use JDK 6. I tried to switch back to JDK5,and it works. Then I tried various methods, such as trying to deploy on JBoss 5.0 beta yet it still doesn't work. According to some forumers, the reason for this is the SAAJ classes being used in Sun JDK 1.6.0 are not compatible with JBossWS since they use their own SAAJ jar named jboss-saaj.jar. So,we will need to make sure that jboss-saaj is loaded before default one.

The solution to this is modifying JBoss lib folder structure.
1.Move all the jar file from ${JBOSS_HOME}/lib into ${JBOSS_HOME}/lib/endorsed except getopt.jar, jboss-system.jar, jboss-jmx.jar
2.Make sure the jboss-saaj.jar and jboss-jaxrpc.jar is in it.

It works for me after I modified the structure. :)

Wednesday, June 20, 2007

Strange Generic Problem

Today my colleague asked me a question about generic in Java.
Here's the code

package test;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class TestGeneric {
public static void main(String[] args)throws Exception{
List list = new ArrayList();
list.add("test");
List newList = list;
newList.add(4);
System.out.println(list.get(1));

List list2 = new ArrayList();
list2.add(new Date());
List newList2 = list2;
newList2.add("test");
System.out.println(list2.get(0));
}
}

And an exception was thrown when executing it.
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at test.TestGeneric.main(TestGeneric.java:13)


But if I commented out line 13,it works.The thing is quite weird as if the type casting rule is applied list,why doesn't it applied on list2?Obviously,we put an integer into a list which is expecting Date object,and when we print it,it wasn't cast to Data object.Then I decompiled the class file and this is what i get.

package test;

import java.io.PrintStream;
import java.util.*;

public class TestGeneric
{

public TestGeneric()
{
}

public static void main(String args[])
throws Exception
{
List list = new ArrayList();
list.add("test");
List newList = list;
newList.add(Integer.valueOf(4));
System.out.println((String)list.get(1));
List list2 = new ArrayList();
list2.add(new Date());
List newList2 = list2;
newList2.add("test");
System.out.println(list2.get(0));
}
}

We look at line "System.out.println((String)list.get(1));" ,value in list was typecast to String object,where as "System.out.println(list2.get(0));" the value in list2 wasn't typecast to Date object.

Any idea?

Thursday, May 17, 2007

Of course cannot apologize la...leaking only ma

So,lately there are few topics related to same issues - leaking.

Mr Samy said that its not contractor's fault that the water is leaking all over the parliament building.The contractor only make sure the building is built,that's all.Hey,what do you expect then?You only paying like 90 millions to the contractor to build this,ok?You expectation is totally not reasonable.Look at Proton,they just make sure that the car can hit the road and the rest is not their responsibility adi.You only pay for the car,not the quality of it.Please understand that,malaysian.Plus,who will be attending meeting at parliament everyday?If this issue was not reported in the news,I think most of the parliament members won't even aware of that.Thanks god they are alive and no one is hurt.

Then,come to the other leaking problem.There are 2 parliament members giving some statements which practically insulted all the women in the world.I can't disclose their name,because I don't know who these small potatoes are.So sorry,guys.So after their giving such statements,they still being stubborn and not apologizing.Please forgive them,guys.They just want to get some attention thats all.They just forget that their mother,wife or daughter are women.And the main reason i think is because,they are probably a retard.God bless them,really,malaysian should really forgive them two.Even their head,Mr Najib already said its ok to joke sometime.He probably know that these 2 guys are simply retard but he just cover it up for them.What a good leader he is.

So,let's review the morales we learned from these incidents.
  • Malaysia's government is very generous and willing to pay RM90 millions for a Parliament building,which is good looking and water leaking.
  • Water leaking is probably an attribute of government building,wherever you see water leaking in the building,90% that it is a government building.This includes Parliament,High Court etc.
  • If you are a retard,find a leader who is just a bit smarter than you.Since you guys are in the same group(retard group) ,he will sure cover your ass no matter what.
Viva Malaysia

Wednesday, May 9, 2007

Final decision - SCBCD

So after few days of researching and considering,I decided to take Sun Certified Business Component Developer(SCBCD) exam around September this year.The reason is because this certificate is all about Java EE 5,which is what I am using in my work now.Also I planned to pursue my Sun Certified Enterprise Architect(SCEA) next year.So after the next certificate,I will spend the next 6 to 12 months to prepare for my SCEA.You might wondering,do I need that many months to prepare for a SCEA certificate.Yes,I do.I will need to know everything from UML, Design pattern, Enterprise Architecture and some general knowledge on Enterprise application.I suck big time on UML,seriously.Now have to pick everything up again.Anyway,at the moment I will just focus on SCBCD and spend more time in learning Java EE 5.

Monday, May 7, 2007

Thursday, May 3, 2007

Passed my exam and life goes on!!

So I passed my SCJP exam.After a few days of studies during my holiday,and this is what I get.The passed score is 59% and I scored 59%.So close,LOL.Anyway,I could have score better if I spend more time to take more mock exam.But passed is passed,I still able to claim my exam fees,and also an increment promised by my company.What my next plan?I am actually thinking to take another certificate,is either SCBCD or SCWCD.SCBCD is more on EJB3.0 where SCWCD is more one JSP and Servlet.Most probably I will take SCBCD cos' I am doing Java EE now.Also I will like to start my open source project soon.Still in the planning stage,and if there are any updates,I will post it here.Basically I've got some ideas on what to do.Just need to do more research and planning including road map,time line,technologies applied etc.

Anyway,I will like to wish 2 of my friends who are switching to their new job this week.Hope they will like the new job and enjoy it.Cheers