atc » .net http://blog.alexcollins.org Musings of technology, sport, life et al Thu, 10 Jun 2010 10:24:24 +0000 en hourly 1 http://wordpress.org/?v=3.0.5 Learning Scala – first impressions http://blog.alexcollins.org/2009/09/03/learning-scala-first-impressions/ http://blog.alexcollins.org/2009/09/03/learning-scala-first-impressions/#comments Thu, 03 Sep 2009 18:45:08 +0000 atc http://blog.beplacid.net/?p=74 So every year I learn a new language. It’s fun, insightful and leaves me feelin’ a fresh for new challenges in my new found religion.

This time round I’ve been learning Common LISP and now Scala. Being a Java programmer professionally it makes sense to try the latter. I love the idea of it being its own language – for scripting as well as fully-fledged development – that can run inside the JVM (or if you’re evil, the .NET CLR).

First impressions are that it’s exciting to learn. I love its simplicity, and its productivity. One thing I do hate: the syntax of array indexes. I can’t for the life of me think why it’s a good idea. I like the [] syntax because it makes it explicit as to what you’re working with. Doing array(1) looks like a method call, not great. Sure I’ll find out soon enough as to why it’s done that way.

I wrote the following today whilst waiting for my Grilled Mackerel to finish soaking :)

#!/bin/sh
exec scala $0 $@
!#
args.foreach(arg => for (c <- arg) println(c))

]]>
http://blog.alexcollins.org/2009/09/03/learning-scala-first-impressions/feed/ 2
Apache Axis Woes – Return Code (0)null http://blog.alexcollins.org/2008/03/17/apache-axis-woes-return-code-0null/ http://blog.alexcollins.org/2008/03/17/apache-axis-woes-return-code-0null/#comments Mon, 17 Mar 2008 12:40:41 +0000 atc http://blog.beplacid.net/2008/03/17/apache-axis-woes-return-code-0null/ The latest project at work is using a service tier setup. We have the web front-end that’s using Struts 1.2 (yes, old!), Weblogic 9.2, Apache Axis 1.3, JSON & jQuery. The back-end web services are written in .Net (and how difficult it seems to be for developers to work in .Net). Things at least work, up until you receive very strange errors such as this:

java.lang.NullPointerException
at weblogic.xml.jaxp.ChainingEntityResolver.popEntityResolver(ChainingEntityResolver.java:75)
at weblogic.xml.jaxp.RegistryDocumentBuilder.setEntityResolver(RegistryDocumentBuilder.java:179)

and this:
AxisFault
faultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (0)null
faultActor:
faultNode:
faultDetail:
{}:return code: 0

The worst thing about this error is that it’s completely non-descriptive. You can’t get a damn thing from your code (the WS call looks good; no connectivity errors). I spent in total 1 and a half days debugging this issue, and got nowhere. Google was returning red-herrings and forum posts with no solution and desperate coders saying ‘plz help me’. Painful stuff.

The fix as I see it, is to ensure the services are in sync. with the client.

  1. Make sure your web service is deployed correctly – the issue we discovered is that the client was sending extra objects that the service wasn’t expecting
  2. Regenerate your client – the client must be talking to the right methods and sending the correct object types. It looks like because the web service didn’t like our objects, it wasn’t returning a result (errors such as ‘There was an error while trying to serialize parameter X with data contract name Y’). The response therefore cannot be parsed, and you’ll get XML parsing errors caused by null pointers
  3. Check your logs; both server & client – we only found the true cause of our particular error because the service developer opened up the log directory in IIS. From that, I tail’d the log file when making a call and noticed the serialization errors.
  4. Don’t panic – yes it’s true, HHGTTG is right: panicking doesn’t help.

I first encountered this error well over a year ago when developing some web services myself. I’m no expert and I didn’t have the time to add logging (and indeed rebuild Axis) to Axis itself, but I’m sure the response returned from the service is totally unusable by the XML parser in your Application server and thus Axis itself.

I hope this helps someone. I spent so much time searching Google and pulling my hear out with no real solution…

]]>
http://blog.alexcollins.org/2008/03/17/apache-axis-woes-return-code-0null/feed/ 4