Friday, September 29, 2006

Scaffolding isn't for Production

Rails is all very well, and you can build a CRUD application over a database in No Time Flat using the templating that Scaffolding gives you, but as this post points out:
Scaffolding isn't for production. Overcome your addiction. It shouldn't be modified to be more customizable. Developers should instead learn to write Rails code.
Which sounds like the Voice of Experience. But it leads me in an unexpected direction: I have no great desire to learn how to write proper Rails code. Using Rails make me just want to cobble things that seem to work and say Wow! that was quick! No. I want to write proper Java code. And if that's the case, I may as well write things from scratch in Java, which gives me much more flexibility with plugging in functionality, scalability, etc. And is in general a language of great beauty and expressiveness - unlike Ruby source code which to be frank looks like the bastard offspring of a BASH script and a CASE tool...
Let's face it, it's no great problem to write things properly in Java these days, there's so many things to help you do it, frameworks, IDEs, components... I think I'm going to have to take that "I Ruby on Rails" item off my blog menu - I've just fallen out of with it. I'm a Java bigot and I'm just gonna have to live with it.

Monday, September 25, 2006

JMX Clients

I needed a JMX client this morning (I want to create a Hibernate SessionFactory using JMX rather than coding another singleton), so I started having a look to see what's out there, as I haven't looked at these sort of instrumentation interfaces for Weblogic at all - apart from the main Weblogic admin console, and just scratching the surface of the weblogic.Admin command-line tool. So what is out there?

jManage: Initially I found jManage: I tried to install the webapp under Weblogic9.1 but couldn't get it to work for me - there is a command-line tool with it but haven't tried it yet.

EJTools JMX Browser: To avoid having to load a webapp into a container, with all the grief that can go with it, I tried to find a Swing-based JMX client that I could just run as a standalone app - found the EJTools JMX Browser which looked promising but I see it hasn't been updated since 2003 and although it says it works with Weblogic 7, and although it seemed to get tantalisingly close, I can't get it to work with Weblogic 9.1.

Sun tools: Sun appear to have some JMX tools - including a plugin for NetBeans, but since my fave environment is Eclipse, I am going to try EJAM which I found via some Eclipse plugin portals. Downloaded it to my Eclipse directory, restarted Eclipse and you get a new perspective called "JMX Console. Open this, you see a JMX Server Tree, to which you can add servers. I have tried, but I get some sort of screwy error suggesting it can't add the libraries I specified. Back to the drawing board.

XtremeJ: Next up, XtremeJ, which is not open-source or free, but it is an Eclipse plugin, so will give it a go.
You have to go thru a register to evaluate process, then added the downloaded ZIP to my Eclipse plugins directory (this was a guess).
This gives you a new "Java Management" perspective, and the first thing you have to do is enter the serial number that XtremeJ sends you.
Which I did. And it didn't work. Meh.


So in effect I haven't got anything working. Closest I've got so far is using the following JSR-77 parameters:
Factory=weblogic.jndi.WLInitialContextFactory
Packages=weblogic.jndi (dunno what this is for though...)
URL=service:jmx:t3://localhost:7001/jndi/
Context=weblogic.management.mbeanservers.domainruntime
Principal/Credential=same as weblogic administrator account
Need to copy wljmxclient.jar and copy weblogic.jar to where the program can see them...
That's as far as I've got.

Maybe the best hope is to use the built-in command-line tool (weblogic.Admin) which should allow me to CREATE managed beans, INVOKE methods on them, SET properties on them... etc... Try java weblogic.Admin -username uuuu -password pppp weblogic help. Except, that the command line tool is deprecated as of WLS9 - you are now supposed to use the Weblogic Scripting tool...

Labels: ,