Monday, March 27, 2006

Property/Variable reference in

environment variable

In your file a relative reference to a folder is fine as long as you start the program (eg tomcat) the same way from the same location every time.
Eg: log4j.appender.LOGGER.File=../logs/slide.log
(Ok if you're starting tomcat from CATALINA_HOME/bin/catalina.bat)

If not, you will get FileNotFound exceptions when the parent folder can't be found. In the above example, starting tomcat from a windows service will have the user.dir=C:\WINDOWS\SYSTEM32, so ../logs is C:\WINDOWS\logs & doesn't exist.

Make explicit file references using system properties in the file. Note, you can not use environment variables (that's a platform specific concept).

System properties can be set in code or for this purpose should be set with the "-D" JVM option.

With the above tomcat example, most of the important environment variables to tomcat are copied into corresponding system properties if you use the standard scripts.
Eg: in catalina.bat: -Dcatalina.home=%CATALINA_HOME%

This allows you to reference the property using ${...} notation
Eg: log4j.appender.LOGGER.File=${catalina.home}/logs/slide.log

Sunday, March 26, 2006

Missing JAAS Config

"Unable to locate a login configuration" JAAS Tomcat

Starting up tomcat as a service on Windows the above error message with stack trace displayed. The file it's referring to as missing is in the folder %CATALINA_HOME%/conf/jaas.config

You need to make sure the system property ""
is defined & this should be a full path to the file. This can be via the -D JVM option. eg:\conf\jaas.config

Depending on whether you run tomcat via "catalina.bat" or the windows service will determine the best place to put this option.

Ok, not a profound solution to start with but it's a solution with a problem description that will hopefully come up in a similar keyword search. I had to scroll to the 6th search result on
which actually isn't too bad.

Monday, March 20, 2006

Tired of googling questions with no answers

As a Developer/Architect, questions are almost an everyday part of life. Particularly working with Java and Open Source technologies; limited documentation, weird stack traces, unexpected behaviour typically lead me to the web for help. I'm not alone ...

The typical sequence of problem solving goes as follows:

  1. Putting question/error message/keywords in a web search.
  2. This will almost always find results - in the hundreds & thousands - great!
  3. Follow links to the search results and I'll find at least one if not dozens of descriptions of the exact same problem scenario.
  4. Scroll down, follow the links to posted comments/replies. I'll find heaps of people saying they have the same problem ... but no solution. If I'm really unlucky, I'll find the last comment from the original poster saying "Oh forget it, I've resolved the issue ... thanks".
  5. The wording/phrasing of someone's comment may lead me to thinking about my problem differently, inspire me to try something else and alleluia! The problem is solved and I move on the next one.

If I'm conscientious I'll note this in my trusty notebook for future reference. On the (very) rare occasion I'm feeling good will toward all people-kind I'll try to see if I can put at least my take on the solution on one of the websites I saw the exact same question. Inevitably they’ll only allow posts from "members" or the site will be an extract from some mailing list that I'm not on or that stopped existing months or even years ago. Then I go back to work.

The web is a great place for collaboration ... but I can't help but feeling that when it comes to the specific field of developer problems we're collaborating our questions very well but not the solutions.

Hence the Dev-Answers blog is born.

I really wouldn't expect people to read this regularly ... I expect this to be the longest post. My only hope is that if you search for a specific problem and end up being directed here, the specific solution (for me at least) will be here.

Comments are welcome as long as they add to the understanding of the problem/solution described. If you have a question use one of the various other forums to post it and then when you have an answer, post it here.

If no one uses this at all then at least it's an online version of my notebook ...

No Questions!