RSS Feed
15
October
2003

iTunes 4 tips by Apple

Posted by woeye | Comments: 0

Apple has posted a nice article about various iTunes tips in their knowledge base :
Read

15
October
2003

Restarting a webapp via RMIAdapter: why doesn't it work for me?

Posted by woeye | Comments: 0

Restarting a webapp via HTMLAdapter (jmx-console) works fine. Restarting a webapp via RMIAdapter, however, produces a lot of errors, mostly javax.management.InstanceAlreadyExistsException. Reading through the sources I could not find any serious differences between the way the HTMLAdapter invokes an operation on the MBean and the way RMIAdaptor does. The provided Ant task (jbossjmx-ant.jar) doesn't work either. Perhaps someone has a good hint or tip for me?

15
October
2003

Writing into multiple files with log4j

Posted by woeye | Comments: 0

Using log statements for low-tech debugging is generally a good thing. Using only one file however may become chaotic especially if you want to trace third party frameworks as well. I faced the problem during the development of my system. When I set the threshold in log4j to DEBUG my logfile was exploding (Struts and Tiles are very talkative).

Thanks to log4j it is possible to use different files for different packages (and their children). First you have to declare the appenders you want to use, e.g. an appender called HIBERNATE:

<appender name="HIBERNATE" class="org.apache.log4j.FileAppender">
  <param name="Append" value="false"/>
  <param name="File" value="${server.home}/logs/log4j-hibernate.log"/>
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
  </layout>
</appender>
Afterwards you can attach a category to these appenders. This way you can log all statements from Hibernate into one log file, all statements from Struts into another log file and so on:
<category name="cirrus.hibernate">
  <priority value="DEBUG" />
  <appender-ref ref="HIBERNATE"/>
</category>

15
October
2003

Tips 'n' Tricks: Prevent NullPointerException in string comparison

Posted by woeye | Comments: 2

Very often I read the following statement:

if (someString.equals("foo")) ...
Now if someString is null this code would produce a nasty NullPointerException. One solution might be:
if ((someString != null) && someString.equals("foo")) ...
But there's a better way:
if ("foo".equals(someString)) ...

Very easy =)

15
October
2003

Tips 'n' Tricks: How to keep JSP compilation results with JBoss/Jetty

Posted by woeye | Comments: 2

If you want to keep your JSP compilation results between server restarts you have to tell Jetty where to put the results. Otherwise Jetty will use a different directory on each restart. The simplest way is to add an init-parameter in webdefault.xml: [code] jsp org.apache.jasper.servlet.JspServlet scratchdir /tmp/jetty 0 [/code]

« 1 2 3 ...  25 26 27 28 29 30 »