Tuesday, November 6, 2007

Frustrating: GWT InvocationException

I am having some success with GWT - but here's one that took me a couple hours to figure out. I created an asynchronous RPC service. Pretty much straight from the "book". Wouldn't work - wouldn't work. Tore everything back to the bare bones. (OK - the service was taking a user-defined class as an argument and returning a list.) I changed it to take a String and return a String. Still always got the InvocationException - with no cause. Finally also ripped the RemoteServiceServlet back to the basics -- did I mention I implemented the init and service methods to allow setting up other stuff I needed? Lo and behold it started working! Doh!
In the simple minded version I originally wrote it wasn't going to actually service anything, just initialize. By calling super.service(request, response) things went much better. Sometimes it IS just the simple problems.

Interesting: IntelliJ

My IDE travels have taken me back to IntelliJ for a tour with the EAP version of IntelliJ 7.0. So far - very nice! Great Maven integration. Great GWT integration! Only locked up on me once - I had three projects open and went to debug one of them.

Monday, November 5, 2007

Frustrating: Java on Mac OSX

As you probably know, Leopard came out recently. Lots of us have been waiting to upgrade. But it turns out that one of the things *NOT* coming in Leopard is Java 6! Java 6 has been out for other platforms for quite a while. Apple used to be way behind, then caught up, but now is dropping behind again! I got a note from another news group that there is a grass-roots movement going on to demonstrate to Apple that there is a LOT of interest in this. It is in that spirit that I post this secret message to Apple: 13949712720901ForOSX.

Thursday, November 1, 2007

More Frustrating: Eclipse

Why does a "Dynamic Web Project" require javax.persistence? And it seems, therefore can't be deployed to the HTTP Preview (which is Jetty under the covers, right?)? And what is different between HTTP Preview and HTTP Server?

Only two facets are defined on the project: "Dynamic Web Project" and "Java", neither of which it will let me remove. I really *don't * want persistence...

Interesting: Why's (Poignant) Guide to Ruby

If you're interested in languages, learning languages, or Ruby - you have to check this out.

Frustrating: Subversion / Interesting: Bash

So in the process of messing around with IDEs, I used NetBeans (most likely) to check out my project from Subversion. No problem - I edit my code, actually get my JSP page to work. Let me check it in and deploy! We're sorry - you can't check that in - Permission Denied. We're using svn+ssh protocol and the remote user is wrong - it is my local userid which is not the remote userid. Ok, how could that happen? And what to do?

Turns out the URL is stored in .svn/entries - just have to edit it. Sed to the rescue.
> find . -name entries -exec sed /host/s//user@host/ {} > {} \;
Ran fine - no change. All 'entries' files are read-only.
> find . -name entries -exec chmod u+w {} \;
Re-run sed. No change. Redirect is going somewhere else. Seem the second brace pair is not replaced with the file name. So put the sed command into a script. ~/bin/runsed.sh:
sed /host/s//user@host/ $1 > $1
Ok, let me try this on one file...
> ~/bin/runsed.sh src/main/java/.svn/entries
> ls -l src/main/java/.svn/entries
rw-r--r-- 0 entries
Zero!?? Oops. Change runsed.sh:
sed /host/s//user@host/ $1 > $1.fix
Re-run fine:
> find . -name entries -exec ~/bin/runsed.sh {} \;
Now I just have all these entries.fix files. Let's get rid of the old ones:
> find . -name entries -exec rm -f {} \;
Hmm... now if the curly braces only expand once, we're going to need a new bash script... And I recall there's a bunch of clever stuff bash will do with variables and file names... oh - here it is: "${1%\.fix}" will get rid of that...
mv $1 ${1%\.fix}
> find . -name entries.fix -exec ~/bin/mvname.sh {} \;
Put them back to r/o:
> find . -name entries -exec chmod u-w {} \;

Done! Subversion now works again! Phew.

Interesting: Artifactory

We all know, and I'm even having some luck convincing people how cool Maven is... but there is that issue of libraries not published in repositories that have to be installed by hand. Ok, and there is the issue of everybody having their own repository and installing all those in each one. But wait - Artifactory to the rescue!

I just installed it - and it just works! Way cool. And a browser even! And even better, what a cool interface... an AJAX-ish tree, dialogs, progress bars...wow! How did they do that? Looks like Wicket.

Frustrating: NetBeans 6.0 Beta

So I've heard great things about NetBeans - especially that it is now doing Ruby (as I hear on the JavaPosse podcast). I'll give it a try.

Plus: the Maven integration is way ahead of Eclipse.
Con: after doing a Maven build, the errors don't seem to get updated in the editors - i.e. the editor and the project still show errors even though the Maven build went fine (internal or external)

Con: the cursor disappears regularly - the IDE isn't hung; the mouse still works; just no keystrokes. After restarting NB, it works fine... for a while. (I'm on Mac OSX 10.4.10)

I used to be an IntelliJ user - it was fantastic. Let me go see if I can still get the EAP version for free... Wait - what's this in the comments? Artifactory... cool!

Frustrating: Eclipse

I have been using Eclipse for several years now and it has treated me generally very well. There are so many plugins that the only real hassle has been the few occasions where the plugins collide. However, since appetite grows while dining - I have recently come very close to declaring a divorce! Why?

Upgrading to a J2EE project
One cool thing about Eclipse is being able to deploy a web app and debug your servlets, etc. Eclipse knows how to run Tomcat (and others) and deploy your web app to that server. The trick to all this is that your project must be a 'Dynamic Web Project' (in Eclipse 3.3) or thereabouts. Fine. The problem arises when an existing project grows into a web project. No! We're sorry - you can't add the 'Dynamic Web Project'(DWP) facet to a POJP (Plain Old Java Project). No problem - I'll just make a new project that is a DWP. Now let me get the code from Subversion - let's see: run "Team->Share Project". We're sorry, you must specficy a NEW subversion folder. But I want the one that's already there!
[Actually I just remembered there's now something like "Import from SVN"]
Ok - yes, you can create a new project which is "Check out existing project from SVN" AND even run the "New project wizard" on it to make it a dynamic web project, or whatever you need.