Archive for the 'Java' Category

Glassfish custom log handler woes

I’ve been trying to do some “custom” logging in Glassfish the last week and am completely stuck. It would appear, based on not being able to find anything, that nobody has run into the same problem but I find it hard to believe that nobody has wanted to use the java.util.logging.SocketHandler.

My application used to use log4j but since changing to Sun AS/Glassfish it seemed pointless to keep using log4j given that Glassfish uses Sun’s java.util.logging framework internally. I want to be able to set logging levels via the administration console and that simply isn’t possible with log4j. Since the app does use Commons Logging it was a simple matter to get the application logging plugged into the app server and have the logging levels set via the console. I thought it would be as easy to add SocketHandler into the mix so that I could use Chainsaw (or Logfeeder).

The administration console lets you add an additional, “custom”, log handler. I am supposed to specify the full class name which I did - java.util.logging.SocketHandler. In “regular” java.util.logging you can set additional handlers in logging.properties as well as the various setttings like java.util.logging.SocketHandler.port for setting the port (which is required). From what I could see it looked like I could set these properties in the same console screen where I set the “custom” handler. I set them and saw that they were set in the domain.xml.

Problem is when the server boots I get BadPort (0) which means it isn’t picking up the property I set for the port (java.util.logging.SocketHandler.port=4446). This same behavior also happens in Sun ES 8.2.

I can not find any documentation anywhere as to how to set this stuff to get the port set. I also can’t find anything anywhere else for that matter. I posted in the Glassfish forum on java.net and nobody has responded. Is it possible that nobody trying to use Glassfish has successfully done this? Seems impossible to me. Going to search through the source to see if I can spot anything there but if anyone who reads this can help out please let me know.

Share/Save/Bookmark

JBoss documentation drives me *nuts*

We are in the process of setting up a JBoss application server cluster at work using Apache as the load balancer in front of a cluster of JBoss servers running Tomcat.

One thing we are not doing is running in the “all” configuration that ships with the JBoss archive as one of the pre-built configurations.   We want clustering but we don’t want to use everything else that is part of the “all” configuration.  Sounds reasonable right?  Apparently JBoss doesn’t think so.

Little bit of history here.  Between release 4.0.3 of JBoss AS and 4.0.5 they changed the way Tomcat clustering works and how it’s packaged.   In 4.0.3 you would edit a file called tc5-cluster-service.xml and put it in your deploy directory.  In 4.0.5 they have a .sar “file” (it’s really an exploded archive) that has a file call jboss-service.xml, which takes the place of tc5-cluster-service.xml, as well as another file called tc5-cluster.aop, which in turn requires the folder jboss-aop.deployer.

All that is fine.   However in the situation where you want to run release 4.0.5 in the config of “default+clustering” where do you find out what you need to add to “default”?  The quick answer is that you need both the 4.0.3 AS Guide and chapter 16 which is the clustering guide as well as the 4.0.5 Clustering Guide.  Why do you need both?  Because JBoss apparently assumes that in 4.0.5 you are running in the “all” configuration, or that you used the installer, neither of which situation fits us.   The following short note, which is in the 4.0.3 documentation, is no longer present in the 4.0.5 documentation:

Note

If you are not running from the all configuration, session replication can be enabled by copying deploy/tc5-cluster-service.xml, lib/jgroups.jar and lib/jboss-cache.jar from server/all into your server configuration directory.

I’m still trying to figure out why they would remove this.  I can understand updating it since the reference to tc5-cluster-service.xml is no longer valid but the rest of it is still valid and very useful.

At any rate I have now created a document in our internal Confluence wiki to clear this up for our Unix admins.  Its ridiculous enough that there is no “official” documention on the JBoss site that specifically talks about how to create your own configuration without using the installer.  How about adding that stuff back in guys?

Share/Save/Bookmark

Paul Graham says Microsoft is dead. Why he’s wrong.

I ran across this story with the provocative title while catching up with my Google Reader subscriptions. So after reading that uninformed post (one thing Mr. Chartier, John C. Dvorak has enough readership that he doesn’t really need to pimp pageviews as you suggest. His opinions might not always end up being correct but they are probably a lot more informed than yours) I went on and read the essay by Paul Graham.

Paul, why your article might have a few things that are correct your premise that Microsoft is dead is wrong. I think you are correct that the “shadow” Microsoft has cast over the computing industry is gone but your four reasons as to why that happened are far off the mark. Here is why.

  1. Google

    Gmail certainly showed that Google could do more than search. However what is impressive about Gmail isn’t its AJAX functionalilty. I think most people tend to be impressed by the user interface as a whole and the fact that it lets you use Google search on your email. Let’s look at a few points related to these two things.

    • The way Gmail displays emails is vastly different (not necessarily superior) to most other email applications. The way threaded discussions are displayed and can be easily traversed is always one of the major points people mention about the Gmail UI.
    • Labels are used to organize email instead of folders. I find this useful because I can easily tag messages with multiple labels which is a nicer way to organize them than folders. Labels/tags was certainly not a Gmail first but Google put it to good use. Thunderbird has this feature. Outlook has had this feature for ages. I can easily categorize email in Outlook 2003. I can also create pretty powerful search folders in Outlook 2003 and 2007 if I don’t want to use the traditional folder metaphor. Outlook 2007 has even better categorizing features as well as search (with the help of Windows Desktop Search in XP….by default on Vista). These are both more powerful than what is in Gmail.
    • Gmail lets you have a large mail store and lets you apply Google’s search technology to it. This is a great feature. I can get this just as easily with desktop tools. In fact with Google’s own Desktop Search (there is that nasty word, desktop) I can index and search lots of different document types that I can’t with Gmail. Score one for the desktop again.
  2. AJAX

    Paul goes on to dismiss the fact that while Microsoft invented the technology needed to get the first A and X part of AJAX (XMLHttpRequest) they didn’t put it to good use except for Outlook (the webmail version of Outlook that comes with Exchange Server 2003 is pretty damn powerful and that was prior to the release of Gmail). He even goes so far as to say:

    What they didn’t realize was that it would be useful to a lot of other people too—in fact, to anyone who wanted to make web apps work like desktop ones.

    For a guy who admitted in the same article that he never paid too much attention to Microsoft he seems to know quite a lot about what they were thinking.

    Isn’t it odd to think that Microsoft might think others might find it useful when they found it so useful themselves? Isn’t it also odd that people are so in love now with, what was for years, an IE-only technology? What about browser independence? Those damn Evil-Doers at Microsoft were only thinking of themselves again! Now AJAX is the darling of the web development community and Microsoft still gets slammed. It’s an amazing world.

    Paul then lays this big egg:

    And that was the second cause of Microsoft’s death: everyone can see the desktop is over. It now seems inevitable that applications will live on the web—not just email, but everything, right up to Photoshop. Even Microsoft sees that now.

    Whoa there Tex! It might seem inevitable to a guy who is funding Web 2.0 companies that all applications will live on the web but it isn’t inevitable to all of us. He links to the “Photoshop on the web”. Given that the linked application doesn’t cover even a quarter of the functionality of Photoshop it shows that Paul has either never seen or used Photoshop or that he has and he’s vastly underestimating the power of Javascript.

    Now if Paul were saying that desktop applications might be extended by using the web I would have to agree. We have already seen that happening a lot now and it’s a logical step. To conclude that all applications will be web-based is pretty naive. Not every application needs to be web-based (just as some don’t necessarily need to have a desktop version) and if the desktop is dead than how will I do anything when I’m not connected to the Internet? What happens if I don’t want to be connected to the Internet? How does Paul explain the large number of desktop blogging tools available (including a very good one from Microsoft which works with other platforms including their own)? I am typing this in the WordPress editor only because I don’t happen to have Live Writer installed on this machine yet. If I did I’d be using that instead of the WP web UI because its more powerful.

    The last area of AJAX Paul mentions is JavaScript and I’m really not sure where he came up with this:

    The other critical component of Ajax is Javascript, the programming language that runs in the browser. Microsoft saw the danger of Javascript and tried to keep it broken for as long as they could. [1] But eventually the open source world won, by producing Javascript libraries that grew over the brokenness of Explorer the way a tree grows over barbed wire.

    Certainly there have been issues in IE but JScript (they don’t call it JavaScript Paul) has been ECMAScript compliant for years. I’m not sure how that is trying to keep it broken.

  3. Broadband Internet

    The third cause of Microsoft’s death was broadband Internet. Anyone who cares can have fast Internet access now. And the bigger the pipe to the server, the less you need the desktop.

    Sure Paul but as I asked before what happens when I cannot or do not want to be connected to the Internet? I can have a network pipe 5 miles wide that won’t do me a bit of good I’m not hooked up to it.

  4. Apple

    Ah I just knew Apple had to come into this somewhere and this is where Paul goes completely off his rocker.

    Thanks to OS X, Apple has come back from the dead in a way that is extremely rare in technology.

    No. The return of Steve Jobs and the first iMac are to thank for Apple coming back from the dead. OS X was just icing on the cake. Without those two things OS X never would have happened.

    Their victory is so complete that I’m now surprised when I come across a computer running Windows. Nearly all the people we fund at Y Combinator use Apple laptops. It was the same in the audience at startup school. All the computer people use Macs or Linux now. Windows is for grandmas, like Macs used to be in the 90s. So not only does the desktop no longer matter, no one who cares about computers uses Microsoft’s anyway.

    This quote is so chock full of goodness I am almost giddy by the opportunities provided here that can be responded to. The contradictions are almost endless!

    Fact: the Mac and Mac OS X still have minuscule market share. Apple’s victory is nowhere near complete. Paul must live in a bubble if he is surprised when he runs across a computer running Windows. Paul thinks that all computer people now use Macs or Linux because in his small world its true!

    But here is the kicker of this quote: people who care about computers don’t use Windows! I’m writing this on a Windows machine and I apparently care enough that I’ve spent a fair amount of time responding to this crap he is posting. If you do Java development (if I remember correctly Paul had some post against Java as well) Windows is probably the best platform to do it on. If only the cool kids are using Mac and Linux Paul then why can I get all of the good open source stuff like Apache, MySql, PostgreSQL, etc, etc, etc in easily installable packages on Windows? Why is Python on the Mac such a mess?

It really pains me that smart guys like Paul Graham don’t seem to think before posting “essays” like this one. I realize it is his opinion but for a guy who is apparenly very smart this essay does not seem well-informed. Not only does it not seem well-informed but it is downright nasty in its implications (just as this one was in respect to Java programmers). In order to care about computers you have to use a Mac or Linux. Thanks for writing off such a large population of the computing field Paul.

Share/Save/Bookmark

Kathy Sierra, Hani Suleiman, and Tim Bray

I know this subject has been covered a lot in the last week but I’ve been on vacation and am just getting around to reading a lot of the various opinions on what happened to Kathy Sierra and other items that somehow relate.

At some point I came across this post by Tim Bray where he asks his readers the question(s):

A couple of years ago I and another person were talking this over and proposed a scenario: suppose one of Hani’s victims were mugged by four or five random hoodlums and beaten up severely, while the hoodlums made witty and amusing remarks to entertain the passers-by and watchers. Would the violence be OK because of the leavening with humor? I don’t think so. So why is what Hani does OK?

Obviously the physical violence would not be OK. What a stupid question to pose. Any rightly-thinking individual knows this situation would not be OK. Why is what Hani does OK? Because he isn’t:

  1. Committing an act of physical violence.
  2. Threatening any acts of physical violence.

At the worst he’s offending someone’s sensibilities.

Is it really that hard to understand how the Bile Blog is nothing like the situation Kathy Sierra has found herself in? The swearing is Hani’s shtick. I don’t happen to think it’s too funny but I also don’t think he needs to end it. Please Tim…think a bit before posting that stuff.

Regarding Kathy Sierra…I have been reading Creating Passionate Users for years and love what she has to say. The Head First books are also excellent. I understand that she has been really shaken up but to stop blogging because of turds like the ones responsible for the material that shook her up isn’t the right solution. Kathy you are providing a valuable service to a lot of people. Please don’t let these asshats (thanks Hani) keep you from doing the great job you’ve been doing for years now.

One last thought: if the so-called “A-listers” are all like Chris Locke God help us.

Share/Save/Bookmark

There are no dumb developers?

Just finished reading entry #3 on the javablogs.com Hot Entries page titled “Smart Developers”. What made me want to write about this particular article was the statement:

In my experience, there are no dumb developers.

Unfortunately my experience has been a lot different than this.

Maybe “dumb” is strong word. I think it’s really more along the lines of “doesn’t have the aptitude to develop”. Many of the people I have met who call themselves developers are not. In my mind the term “developer” indicates someone who is good at problem solving, design, etc. What I will term here as “coders” is what Brian McCallister is probably referring to when he talks about not-very-good-developers.

Coders are not developers. These are the people who don’t look outside of their own work to explore what else is out there in the world. No interest in languages aside from what they use at work. No interest in things like new development methodologies. The list is quite long. In controlled situations they may be able to crank out working (but not necessarily good) code but move them out of their zone of comfort and everything breaks down. This is not saying they are dumb people (maybe they’re in the wrong profession…brought to software development because it’s a good-paying job) but they simply are only able to handle clean-room situations. If something doesn’t work as advertised or they run into strange debugging situations they need hand-holding.

Lets face it: a good developer has an innate ability to see problems in a way that coders just don’t have and that is why coders get in to trouble outside of controlled conditions. That innate ability to problem solve is just as elusive as the ability to capture great photographs are write great music. It really is more akin to art than science. Good developers are born with that ability. It will take training to bring it out but the ability is already there.

Contrary to what Corporate America thinks these things can’t be learned. If you don’t have the ability to start with no amount of training will help. Tools won’t help either. That’s why good developers are expensive and hard to find.

Share/Save/Bookmark

RedHat/JBoss - does Charles Babcock know what he is actually writing about?

I just read an article titled "Red Hat Seizes An Opening" in the 4/17 issue of Information Week in which Charles Babcock talks about whether the Red Hat/JBoss merger is enough to do battle with the likes of IBM, etc. He harps on several things that annoy me because they really are non-issues. For instance:

"The JBoss stack doesn't have its own webserver"

Neither does Websphere or Oracle Application Server. They're both based on Apache. Is there some reason why Apache isn't also suitable for use as a web server in the RH/JB stack? That being said JBoss has their own web server project in the works so what is the issue?

He also notes that the JBoss stack doesn't have its own ESB. Given the open source nature of both Red Hat and JBoss I see no reason why using one of the open source ESBs such as Mule is not an option. The article claims that JBoss is writing their own. Not sure I understand why they would do that given the availability of projects like Mule but even given that there are open source ESBs available for use in the RH/JB stack.

Seems like a bunch of noise to me. I wonder why they call this garbage journalism.

Share/Save/Bookmark

My own DailyWTF

Today I was going through some Java code that was basically a straight port from VB 6 to make sure the functionality was there. During my review I came across the following:

In a private method:

int[] qtrMonths = {0,0,0,0};
for (int i=0;i<4;i++)
qtrMonths[i] = ((i+1)*3)-2;

Notice that the only variable that changes is the counter “i” :)
Wonder what the original VB guy was thinking on this one.

Share/Save/Bookmark

« Previous Page