Tom Janofsky Consulting

Welcome.

Welcome to the home of Tom Janofsky Consulting. I provide services in enterprise architecture, design, and implementation. I specialize in Java based development and education, particularly using J2EE.

     Thursday, July 15, 2004     On switching

So I was reading this about switchers and would totally agree with James. I switched from a Linux laptop to a PowerBook last fall.

All of the applications I depend on work great on my PowerBook. IntelliJ works great on OS X, Office is a native app, Java has great support, WebLogic runs great and Oracle was an easier install than Linux. Iterm is a nice replacement for a terminal, and of course Mozilla/FireFox are first class.

I used to run Linux on a Dell Lattitude, and before that on a Toshiba laptop, and while I miss some of the flexibility of a Linux box, I don't miss the maintenance.

Of course one of the biggest benefits is they way it JustWorks(tm). While it's certainly likely that someone with a Windows laptop can run an Ant build a few seconds faster than I can, the fact that I can hop on an unknown network, find a printer via Rendezvous, and print a diagram for a client without calling their IT line, or set up a quick ad-hoc wireless net in a training room to pass around some files, or just flip it open on the train and be working in a second more than make up for that second for me, and I think, make me that much more productive.

I do a lot of presentations and I no longer worry about fooling around with resolutions to get some unknown projector to work correctly, now I just worry about losing my dongle.

If there's anything I miss it's that I still haven't found a replacment for straight-up text editing. I was a huge SlickEdit fan on Windows and on Linux, but they don't sell it on OS X (even as an X app. I've tried SubEthaEdit and BBEdit, but nothing has measured up. I might be best off running Kate or even gedit under fink. Maybe I'm doomed, because I think I really like an MDI interface for a text editing tool. For now I just end up dropping into vi.



     # posted by tomjanofsky @ 11:16 PM 0 comments links to this post


     Wednesday, July 07, 2004     A helpful tip

When you're delaing with ClassCastExceptions or ClassNotFoundExceptions in J2EE code, it's usually because your class is getting loaded from the wrong place. To figure out where it's coming from:


System.out.println("someObject.getClass()." +
"getProtectionDomain().getCodeSource().getLocation() = " +
someObject.getClass().
getProtectionDomain().
getCodeSource().
getLocation());

     # posted by tomjanofsky @ 3:34 PM 0 comments links to this post


     Friday, July 02, 2004     Communicating back from a JAAS LoginModule

Along the lines of things that are simple and you never realized...

I was trying to figure out how a JAAS LoginModule could communicate back to a JSP login page that was named in a login-config. I wanted to be able to let a user know when a specific login was disabled and they would need to contact a system admin.

It's obvious enough if you are doing the login programatically, you can catch an exception from the login and use that. But it wasn't obvious to me how it would work when logging in through j_security_check. There are various ways you could do it with posting first to another page, then forwarding back around to the login, or using an unsecured filter or an AuthFilter
in WebLogic.

Well, surprisingly to me, it's just as easy as the programatic way. Just throw a LoginException in your LoginModule when you detect the condition:


throw new javax.security.auth.login.FailedLoginException("User is disabled");


and in your jsp that is your form-error-page:


<%@ page isErrorPage="true" %>
...
<%
if (exception != null) {
out.println( exception.getMessage() );
}
%>


And it's as easy as that. If you're running this in WebLogic, you'll also need to make sure that your LoginModule is the first, or you'll just get an exception from the default LoginModule.

     # posted by tomjanofsky @ 9:33 AM 0 comments links to this post


straight to the top