Wednesday, November 30, 2005

Misc : George Best

Sadly, one of the all-times greats has gone.

When I was a kid, George Best was my hero. He was cool and fitted in with the whole 60's era - Carnaby Street, Twiggy, Mary Quant, the Beatles, Sergeant Pepper ... He was almost the fifth Beatle with his good looks and long, flowing hair. He was the epitome of what people aspired to - talent, youth, fame, fortune and a blond on each arm.

And he could play football! He had the support around him. In Man U's previous great era, George, Denis Law and Bobby Charlton were each voted European Footballer of the Year over a five year period. Show me another English club with that sort of record.

He was the master of the feint and the dribble. He leapt over tackles like a gazelle. And remember he played in an era where goalscorers were not protected as they are today. He faced such hard men as Chopper Harris, Norman Hunter, Billy Bremner and the like ... and he still scored goals.

He is the only UK player who belongs in the pantheon of the greats; Pele, Cruyff, Maradonna and Best.

He was never rated internationally because he never appeared in a World Cup. Northern Ireland last appeared in that competition in 1958 in Sweden when George was just a nipper. Maybe just as well - George in Sweden with those leggy, beautiful Swedish blondes would would been a potent distraction.

With Matt Busby as a father figure, he flowered. The pre-match instructions for George were "Go out and enjoy yourself" allowing full reign to his talent and individuality. Defenders hated him because he made them look ponderous, slow and stupid. Mostly they just saw his back, twinkling down the touchline.

The rot set in with the later managers - Frank O'Farrell, Wilf McGuinness and Tommy Docherty. They expected him to conform, to be part of the overall pattern, to be part of the common herd. It was never going to work and he walked away in disgust.

He left a massive hole at Man. U. Succeeding generations of footballers were always given the curse - "He's the new George Best". That "compliment" was a hospital pass. Ryan Giggs is a good example - a brilliant footballer, a great team man but the next Best? That's simply not achievable no matter how hard Giggs or anyone else tried - George was a one-off and we'll never see his like again.

Sadly, he forget that he was famous because of football, not in spite of it. He seemed to live on the tabloid's front page. Surrounded by sycophants and diverse hangers-on, he opened night clubs, advertised rubbish, partied and declined.

In his famous words, "I spent my money on booze, birds and fast cars. The rest I just squandered." The incredible talent that made him such a star also destroyed him. This seems to be a common theme - just look at Gazza. Perhaps Rooney should have been taken to the hospital at the end and told "Look - this is your life if you don't wake up"!

George has gone and an era has passed. Shakespeare wrote "the good men do is interred with their bones... but, their evil lives on and on". The "good" George did on the football field is certainly not interred and the genius and the memories will always remain. And what glorious memories - look here for a brief reminder:

http://video.google.com/videoplay?docid=6000929952097818068&q=%22george+best%22

R.I.P.

Friday, November 25, 2005

Eclipse : Writing java snippets in a scratchpad

For web server development, especially when the code is in a jar file, you need to write some code, stop the application inside the server, deploy the new one, start it all up etc. That takes time - and then you find that the code doesn't work so you try something else which takes more time and so on ...

It's much easier to write the snippet inside an Eclipse scrapbook first and test it.

"File / New / Other / Java / Java Run/Debug / Scrapbook Page

Then just write some code in the editor e.g.

System.out.println("Hello");

Then highlight the snippet, right click, "Display"

Bingo!

Enjoy!

Friday, November 18, 2005

Eclipse : Where's my console output?

Debugging my Java program inside Eclipse 3.1, I noticed that the console output which had tons of debugging statements was missing a large swathe of the initial output.

A bit of digging around found the option under Window / Preferences / Run/Debug / Console.

Uncheck "Limit console output" and you'll get the output you were expecting!

Enjoy!

Thursday, November 17, 2005

Java : String input to Digester

Every one of the gazillion examples out there use an XML file to demonstrate how to use Digester.

But what if you need to hand Digester some XML which is actually a String input.

Problem! The only String constructor needs a URI.

Well, you could write it to a file and then use the File constructor as input.

Yeah - right!

Use the StringReader class which converts a string to an input stream e.g.

StringReader sReader = new StringReader (AXmlString);
myResponse = (Response) digester.parse (sReader);

Enjoy!

Java : Digester debug logging

So you are trying to figure out why Digester won't parse the XML correctly.

You need the debugger!

Just apply the following run-time switches:

-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester=debug

-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester.sax=info

where the levels (e.g. debug / info) at the end at the line are the levels you require.

(Note: the

-
D

is actually -D.

The console will spit out exactly what Digester is doing and it's all a whole lot easier to figure out.

Enjoy!

Monday, November 14, 2005

Misc : Martins Bay - just north of Auckland (2)



And another one - this time looking north.

Enjoy!

Misc : Martins Bay - just north of Auckland (1)



Quiet and peaceful!

Enjoy!

Thursday, November 10, 2005

WL : Using wsdl2service to create the Java classes for servicegen

In the previous post, it talks about a_service.service.Java_ServiceImpl.

But where does this java class come from?

The answer is that it's created by Weblogic's wsdl2service. In the build.xml file, you would add:

wsdl2service
packageName="a_service.service"
keepGenerated="True"
generateimpl="True"

This utility reads the WSDL and then creates the classes.

Enjoy!

WL : servicegen and javaClassComponents

Weblogic's servicegen "takes as input an EJB JAR file or list of Java classes, and creates all the needed Web Service components and packages them into a deployable EAR file".

javaClassComponents has as input a "Comma-separated list of Java class names that implement the Web Service operation. The Java classes must be compiled and in your CLASSPATH"

This comes under the service element of servicegen so part of the build.xml would be:

service
serviceName="a_service"
javaClassComponents="a_service.service.Java_ServiceImpl"

So in the CLASSPATH, you would have:

set CLASSPATH=%CLASSPATH%;C:\...\a_service\service\Java_ServiceImpl.class;

and Java_ServiceImpl.java would than have a:

package a_service.service;

Note the "a_service.service" in javaClassComponents. If that's missing, servicegen will invoke javac which will then throw a "Class not found" exception.

But where does the Java class come from in the first place? See this

Enjoy!

Wednesday, November 09, 2005

WL : The task doesn't support the "generateimpl" attribute

Running Ant on Weblogic SP2 wsdl2service.

Get this weird message.

file:.../build.xml:xx: The task doesn't support the "generateimpl" attribute.

What?

The Weblogic 8.1 documentation specifically states that it IS an option:

"generateImpl - Specifies that the wsdl2Service Ant task should generate an empty implementation Java class file."

Pull hair out. Turn to best friend Mr. Google. Turns out this is a bug which has been fixed in SP3.

Download latest SP4 - problem solved.

Enjoy!

SOAP : Debugging Axis with Tomcat and Eclipse

Using Tomcat 5.0 and Eclipse 3.1.

In your Tomcat/bin directory, there is a file called catalina.bat. From the command prompt, just run catalina to see the options. You'll see one option called:

jpda start Start Catalina under JPDA debugger

That's the one you need. I had endless problems running this until I changed the relevant part of the bat file to:

%_EXECJAVA% -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %ACTION%

i.e. the address and transport are specified in the command line rather than in environment options.

Now start Tomcat with this option.

In Eclipse, the project is set up in the normal way with java classes etc.

Breakpoint where you want the code to stop inside Tomcat (e.g. inside a web service)
and then select Run / Debug / Remote Java Application.

You only need to worry about the Connect tab. "Connection Type" is "Standard (Socket Attach)", host is e.g. "localhost" and the port is the port specified in the command line above under the "address" option i.e. 8000. Then press the "Debug" button.

Now invoke whatever to force your Tomcat code to execute e.g. running a web service client which invokes the web service you want to debug.

Bingo - Eclipse will catch the breakpoint and change to the Debug perspective.

Enjoy!

Thursday, November 03, 2005

SOAP : Compiling Axis WSDL2Java

So you've run Axis WSDL2Java and got all the Java files in their package and are battling to compile it all.

Don't sweat.

Add the following construct to the command line for WSDL2Java:

--buildFile

This constructs the build.xml file for you and then it's as simple as running "Ant".

Enjoy!

SOAP : Administer Axis

The "Administer Axis" feature is disabled by default for security reasons. To enable it, navigate to:

C:\Tomcat 5.0\webapps\axis\WEB-INF\web.xml

(This assumes that Axis is running inside Tomcat 5.0)

Then uncomment the section with the comment:

-- uncomment this if you want the admin servlet --

Enjoy!

SOAP : Watch the obvious

From the Axis SOAP install documentation:

set AXIS_HOME=/usr/axis
set AXIS_LIB=$AXIS_HOME/lib
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar;
%AXIS_LIB%\commons-logging.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;
%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar

So you cut and paste and make a .bat file that does this and nothing works. Pull out hair. Hang on, lets have a look at the \lib directory. Ah!

It's not "commons-logging.jar" but rather "commons-logging-1.0.4.jar" and so on.

Sometimes it's the obvious that screws you!

Enjoy!