The Writing is on the wall (The initial conclusion)

As a contractor you know in the back of your mind that nothing can last, but humans tend to prefer a warm fluffy feeling and try to forget this fact, however my largest client has taken on a large outsourced company (its pretty much a run of the mill outsourcing, nothing that reflects badly on the company, I’m presuming its being done so that someone somewhere gets a tidier company org chart as in the long term it sure as hell is not going to save them money, i heard the phrase “strategic partnership” and thats never a good sign), unsurprisingly said company has moved to ‘acquisitive’ mode as soon as they had their foot in the door (to be fair they would be daft if they did not), this means that i suspect that time is limited (hence the countdown timer on the side of this page).

I however have more time (hopefully) to cater to this movement than lots of other people do in similar situations, and my CV is nearly as i would want it, but it could do with a bit more shinning, will therefore be trying to get the following down pat in the next few months, even if I’m wrong such a exercise wont do any harm at all.

Need to get a grip on
Granite Dataservices
Flex 4
get better at Xpages (compared to my other domino dev, i suck)
get better at Jquery (i use it but don’t UNDERSTAND it)
get better at Spring (i have practical knowledge but would suck at a formal interview)
Adobe illustrator (im ok in a “its C.A.D in colour” way, but want it for the flex 4 skinning and chibi images which means i need to be better)

Time Permiting
Android dev
Adobe Air

Its a lot of work but i have 160 days, now i just have to stop working for clients all the time so i have time to learn something (mixed blessing)

Client webservice timeout on CXF webservice on Jboss

What a riveting blog title, but this one is mainly for people to find for a solution via google.

Problem: you have a JBoss server with a webservice CLIENT talking to a webservice somewhere else, and you keep getting timeouts, most likely with the following error

org.apache.cxf.phase.PhaseInterceptorChain doIntercept 
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)

If this happens after 60 second (the CXF default timeout), then it is most likely not the target server refusing you, but your client timing out (if your luckily you can get to the target server logs and confirm). Sooo lets extend the client timeout period, personally i like doing this via server configs and indeed that was my first port of call (do a google search for CXF.xml for more details), however even after i figured out what to call the file (cxf.xml, jbossws-cxf.xml, or jboss-cxf.xml) and got it in the right place (inside the WEB-INF of the project for access via POJO’s) the darn thing just ignored me, incidentally the following is the “meat” of the file which should change the timeout (in fact the “*.http-conduit” changes the timeouts on all webservice clients on that app.

<http-conf:conduit name="*.http-conduit"> 
<http-conf:client ConnectionTimeout="120000" /> 
</http-conf:conduit> 

After a prolonged swear, and discovery that i was not the only person who had had this problem on JBoss for CFX clients, I binned that and went into the code, now if your getting this problem then your all ready making a web service client call so you will already have a line like this

Service client = service.yourwebservice();

if you cant find one, and make all you “client stubs” with something like WSDL2Java or via your IDE, do a search for “extends Service”, you are now looking for a line like this

public class myfunkyservice_Service extends Service { 

when you find it, it will tell you what you should go back and look for ie

funkyservice = new myfunkyservice_Service(URL);
myfunkyservice_Service client = funkyservice.yourwebservice();

well something like that anyway, now bung the following code in after it (changing ‘myfunkyservice_Service’ to what ever you client service is called, and not forgetting that the timeout is in milliseconds)

Client cl = ClientProxy.getClient(myfunkyservice_Service);
HTTPConduit http = (HTTPConduit) cl.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(120000);
httpClientPolicy.setReceiveTimeout(120000);
http.setClient(httpClientPolicy);

that’s the code done, it should all work swimmingly, one exception to this is if you get the error

java.lang.ClassCastException: com.sun.xml.ws.client.sei.SEIStub
at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)

What this bundle of joy means is that sun’s library is loading with a higher priority that the CFX lib, if this is on a server its time to get dirty with your config, if this is on your IDE then, go to your projects properties –> Java build path –> Order and export, and bump the CXF lib up (try it at the top)

there you go, now wasn’t that fun 🙂
Old Comments
————
##### Nancy(15/11/2011 20:01:02 GMT)
Thank you very very VERY MUUUUUUUCHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Really
##### Mark Myers(16/11/2011 19:58:48 GMT)
@Nancy your welcome, glad it helped
##### Mark Myers(27/11/2011 21:48:18 GMT)
@Anneta no prob
##### lucky7175(20/12/2011 06:27:43 GMT)
It works this way

webClient = WebClient.create(URI);
HTTPConduit conduit = WebClient.getConfig(webClient).getHttpConduit();
conduit.getClient().setConnectionTimeout(120000);
##### lucky7175(20/12/2011 06:08:44 GMT)
I dont have control on server code and we use cxf webclient. Can u Pls. let me know how i can set only in client side
##### Mark Myers(22/12/2011 14:42:50 GMT)
yup thank you luckly, isn’t that snippet of code already in the blog at the bottom?

Making any ISO

While building a new win7 VM, I discovered that some of my software was still on DVD/CD only (the horror), I figured that there must be a easy linux way of making an iso image, and diddle me so there is, its called dd The ultimate frenzy guide to how to use this amazing command can be found at How To Do Everything With DD but for me it boiled down to

dd if=/dev/scd0 of=DVDBACKUP.iso

you just need to know where your dvd drive is mounted

$ mount

/dev/sda1 on / type ext3 (rw,noatime,errors=remount-ro)
/dev/sda3 on /home type ext3 (rw,noatime)
/dev/sda1 on /media/SecondHDD type ext3 (rw)
/dev/scd0 on /media/cdrom0 type udf (ro,nosuid,nodev,user=myers) <– This One looks Right

Sooo

myers@EX-L1:~$ sudo dd if=/dev/scd0 of=DVDBACKUP.iso

7816384+0 records in
7816384+0 records out
4001988608 bytes (4.0 GB) copied, 312.694 s, 12.8 MB/s

Cooooor, instant .iso or any order disk copy you might like (its built into all good OS’s, and by that i mean all with a Unix core { yes yes the turtle neck fruit boys can even be included on this one})

Fitness Week 1 AGAIN

Back at it again, this time I’m dragging a fellow member of LDC with me, Mr green and i are having a double competition, each with a prize (a slap up meal):

First person to win 250 squash games
Kieran: 0 Games
Mark: 3 Games

First person to loose 2 stone
Kieran ( Initially 15 Stone, 8 pounds) : 15 8″
Mark ( Initially 16 Stone, 8 pounds) : 16′ 8″

MAY THE BATTLE BEGIN!!!