Sunday, August 9, 2009

Stale Connection in WebSphere Application Server 6.1

Well, a customer of mine has a very weird bug. Sometimes he gets a StaleConnection exception when executing a statement against his Oracle Connection. The client runs WebSphere App Server 6.1, Oracle Database 10g, and uses EJBs and an XA datasource.
Finally, we discovered that there is a scenario that always raises the Stale Connection Exception, and we started investigating the root of the problem.

First of all, WebSphere throws the Stale Connection exception as a wrapper to specific SQL Exceptions received from the JDBC connection.
But why is the connection suddenly closed? A step-by-step following with the debugger found that we get the connection open from the datasource, and then, suddenly, the connection is closed.
We tried to convert the datasource to a non-XA datasource, and received allot of exceptions. This showed us that the process in question needed the XA capabilities of WAS.
We then wrote wrappers over Oracle's XA connection manager (oracle.jdbc.xa.client.OracleXADataSource) and Oracle's Connection (oracle.jdbc.pool.OraclePooledConnection), and seen the debug messages.
We still have no solution, but there can be 2 options:
1. There is a bug with the WAS XA handler.
2. When using statement.getConnection().close(), we close the physical connection, and not the logical connection coming from the datasource. The customer now changes his code, to see if he can get away without the statement.getConnection() bit, and close the logical connection received from the datasource.

I'll post more details later.

Sunday, August 2, 2009

WebSphere ESB Invalid Content Length

Well, turns out I was mistaken in my previous post. Invalid Content Length can occur when using MTOM in .net C# clients with WebSphere ESB, but that was not the case in our customer.
Invalid Content Length appeared when the client closes the socket before sending the entire request. This can happen when the process is halted during send time. WESB will sysout Invalid Content Length, but you can usually ignore it.

However, we still faced a problem with very large service calls (over 1MB in size - only XML, no attachments). Turns out that our synchronization code was messed up, and for some reason - our cache was not correctly initialized, and so we received allot of NPE (NullPointerExceptions).
So - we synched our cache, and voilla - all works.

That teaches me to blog before I see everything working in my own eyes.

One last important issue. Sending large service calls can take time. Allot of time. And so, each C# client has a Timeout property, that sets that Timeout for the service call, in milliseconds. Use it well, since you are very likely to get a Timeout exception before you get the web service response.

Thursday, July 23, 2009

WebSphere Integration Developer issues

Well, it was a while since I've posted - mainly since my partner (Doron) is in Japan, and I have to do the work of two.
But there is a 10 minutes break now, and I really wanted to blog these issues:
1. If you need WAS 6.1 to work with WS-Security and C# clients - drop it. The built in web services support in WAS - JAX-RPC or JAX-WS, just doesn't work.
2. If you send WAS web services, with large content from C# and get SRVE0080E: Invalid content length - you need to set the sendChunk=false property on the .net request client. This will fix it.

Thursday, July 2, 2009

WebServices Versions

Well, just read this. It's an article by IBMers on versioning of web services and schemas. I got this URL from @kfrion after a phone call we had together concerning the versioning of APIs.

The article highlights the same problem I'm presenting in my SOA classes and to my customers. Generating WSDL is great. Whether you're using VS.Net or AXIS/CXF/Metro - WSDL is automatically generated and it works just fine.
However, if you want to use company standard XSDs (from your repository of business objects), to enforce policies, or anything like that - you're stuck. The reason - WSDL editing tools are just not good enough.
And if you need to upgrade your WSDL version - changing the target URL, the schema and so on - then you're on the road to hell, since it requires so much low level understanding of the schema and WSDL specs that your chance of getting it right is slim.

So, what we really need are tools that will allow us to set everything in the WSDL from our code annotations (schema locations, policies, etc.), and can understand changes we made to our programming language code, and generate a backward compatible WSDL according to all versioning best practices.
I've developed something like that (very very limited) in C#. If someone is interested - reply or mail me.

Wednesday, July 1, 2009

Technorati

Well, time to join Technorati. So here is the code - hbsqcxpkyg... Hope all goes well.

Monday, June 29, 2009

WPF and Silverlight

Wow. 2 weeks since my last post. Had about 100 twits since then. Just goes to show you.
Anyway, I was asked to give a presentation to a customer concerning Microsoft new technologies. I told them that I'm a Java guy - but they just asked me to do it anyway. What could I do?

So, I opened my VS.Net2010, and my PowerPoint 2007, and started making some slides. Talked about cloud (from Yahoo presentations), VSTS, SQL Server 2008 and more.

But the technology I'm most impressed with is Silverlight and WPF. Now, I've seen my share of WPF and Silverlight applications, and development demos. But working on these technologies using VS2010 is a great experience. I've developed 2 demos (on technologies I hardly know) in like 5 minutes. And comparing it to my VB6 experience way back, I had to say WOW. WPF is clean, organized, very well documented and understandable. Compared to SWING/AWT/SWT - it is much simple to use, the applications run faster, and the development tool is much much better.
For short - the old best practice - of building client UIs in MS technologies, and backend systems with Java technologies, and connecting the dots with Web Services/REST/JSON - seems to still be in place.

Monday, June 15, 2009

Facebook App Development

So, preparing to my alphageeks lecture, I started building a demo facebook application. As always, I try to set the standard high - probably too high for my free time. So, mining facebook data is not interesting enough for me. Instead - I want to build a facebook applicaiton, that will be hosted on my page.
Not an easy task - let me tell you that.
  1. I started by downloading Apache-Tomcat 6, hoping it will run my application.
  2. Downloaded the Google Java Facebook API, and the web application that comes along with it. (See here)
  3. Deployed the web-app in Tomcat.
  4. Got tons of DB related problems - but I don't care.
  5. Fixed params in the facebook.properties file (api_key, secret and callback)
  6. Got a static IP.
  7. Changed the facebook app call-back URL
  8. Added my custom code to the web-app.
  9. Voila - all works.