Wednesday, August 16, 2006

Resin AIX nightmare

Hi all,
After developing a medium sized web application, I wanted to enable https:// for my aplication.
How difficult that could be? I started with Windows and making few configuration changes in resin.conf (yes, I am using Resin for my application) things started working.

Happily, I used the same war file and deployed it on AIX with Resin 3.0.19 installed on it. Made similar changes that I made on Windows' resin.conf and restarted Resin.
(If you are using 3.0.19, you might want to know why we add <jsp jstl="false"> in resin.conf)
Things didn't work as smoothly as expected. :(
I got following error on console when I restarted Resin:
"[org.apache.commons.digester.Digester] - Begin event threw exception"
It was also making ActionServlet Unavailable by giving following message
SEVERE: Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency.

I was totally clueless about all this. I had no idea why this was happenening.
For some reason, Resin was not able to get depedent classes/jars for ActionServlet.
After wandering on net for few hours, I went to home at 7:00 in morning.
Collegue of mine worked on that and found that RESIN ON AIX CANN'T READ COMPRESSED JAR FILES. :O :O :O

This was like a shock to me. How this could be a possibility?
Who would guess this? I don't think it is documented at all.
We used uncompressed jar files for this and everything is working as expected.
We concluded that, this is the only reason why it was not working before.

If someone has some different experience or doesn't agree that this could be the reason for errors, please let us know.
Till then, others, please keep it in mind
RESIN ON AIX DOESN'T WORK WITH COMPRESSED JAR FILES.

Thanks.

Wednesday, July 19, 2006

Calendar bug in Java

Hi all,
While extending a FileAppender class in Log4j, for some reason, I just did not want to use timestamp [%d] given by Log4j while logging the messages.

In my appender, I declared one Calendar instance which was an instance variable for the appender class. I used "Calender.getTime()" method to get current time for the logging message.

Compiled code, put the war file in container, started the application.
Things went fine and log messages were getting written to the file properly. Only problem I faced was about "DATE" in my log messages.
All the messages were showing same timestamp as a log time. :O

Went to appender and saw my code where I was putting CurrentTimestamp in the message before writing it to the file.
Went to check the documentation for Calendar.getTime() and documentation says the right thing as well.
Gets this Calendar's current time.
I was lost.. what could be the problem??

Was looking for some help/hint/thread but nothing was found.
Finally, somebody told me about the bug with Id #4479408. Sun claims that they have fixed this bug, but it doesn't look like that.
You can have a look at it by accessing following link.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4479408

So, for now, I am making a new instance of Calendar everytime I want to have get a Current Timestamp.
I am not very sure about this approach, how efficient is that, but we all know: "Deadline is sole responsible for bad software quality" and hence I had to put it in my code.

I hope this time Sun not only claim that they have fixed this bug, but really look into the issue and test the fix. :)

Thanks.

Wednesday, June 21, 2006

Eclipse - new discovery

Hi,
After a long time I am updating my blog.
Something really new to me, encouraged me to do so.

ECLIPSE - we all use it for developing Java applications.
We all use Build, Build All, Clean while developing applications.

Well.. did you know that we can change the default behaviour of Build and Clean?
i.e. when I say clean, I can ask Eclipse to use my ANT target instead of its default behaviour? (deleting generated class files)
Same is the case with Build.

This is achieved by something called "Builder" in Eclipse.
I know it was always there infront of my eyes, but I never noticed it.
I never bothered to go into it to see what it is all about.

I hope that this blog help other ignorant users like me to explore more into Eclipse.. or atleast into Builders. :)
Have a look at it, its really amazing.

Thanks,
Viraj K. Turakhia