<?xml version="1.0"?>
<rss version="2.0">
<channel>
  <title>simplericity - glassfish tag</title>
  <link>http://simplericity.com/tags/glassfish/</link>
  <description>Reducing software entropy</description>
  <language>en</language>
  <copyright>Eirik Bjørsnøs</copyright>
  <lastBuildDate>Fri, 02 Jan 2009 11:02:56 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  
  
  <item>
    <title>Slf4j on Glassfish: When smart ideas collide</title>
    <link>http://simplericity.com/2009/01/02/1230894176938.html</link>
    
      
        <description>
          Have you ever noticed how two ideas can seem really smart one by one, but not all that great when combined?&lt;br /&gt;
&lt;br /&gt;
I recently tried to install &lt;a href=&#034;http://nexus.sonatypa.org&#034;&gt;Nexus&lt;/a&gt;, the excellent Maven repository manager from &lt;a href=&#034;http://sonatype.com&#034;&gt;Sonatype&lt;/a&gt;. (And by the way: Every organization using Maven needs a repository manager and Nexus is the best one out there!)&lt;br /&gt;
&lt;br /&gt;
A secondary goal of the project I was working on was to get some exerience using &lt;a href=&#034;https://glassfish.dev.java.net/&#034;&gt;Glassfish&lt;/a&gt;. But sadly, Nexus failed to deploy on Glassfish:&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&#034;http://simplericity.com/images/glassfish_slf4j/stackoverflow.png&#034; alt=&#034;&#034; /&gt;&lt;br /&gt;
&lt;br /&gt;
All I got was this error message in the admin console. A closer look in the Glassfish logs didn&#039;t reveal any stacktrace or relevant messages. Since my project was a pretty busy one, I soon gave up and found another way to run Nexus.&lt;br /&gt;
&lt;br /&gt;
A couple of days ago however, I decided to find out what caused the StackOverflowError. I restarted Glassfish with debugging enabled and attached IntelliJ IDEA&#039;s debugger to it. After setting an exception breakpoint it was easy to see what was really happening under the hood.&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&#034;http://simplericity.com/images/glassfish_slf4j/exceptionbreakpoint.png&#034; alt=&#034;&#034; /&gt;&lt;br /&gt;
&lt;br /&gt;
I redeployed and got a stacktrace starting with this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;httpWorkerThread-4848-1@1033 daemon, priority=10, in group &#039;Grizzly&#039;, status: &#039;RUNNING&#039;&lt;br /&gt;at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:491)&lt;br /&gt;at java.lang.StringBuffer.append(StringBuffer.java:302)&lt;br /&gt;at org.apache.log4j.helpers.ISO8601DateFormat.format(ISO8601DateFormat.java:132)&lt;br /&gt;at java.text.DateFormat.format(DateFormat.java:314)&lt;br /&gt;at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)&lt;br /&gt;at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64)&lt;br /&gt;at org.apache.log4j.PatternLayout.format(PatternLayout.java:503)&lt;br /&gt;at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)&lt;br /&gt;at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)&lt;br /&gt;at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)&lt;br /&gt;at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)&lt;br /&gt;at org.apache.log4j.Category.callAppenders(Category.java:203)&lt;br /&gt;at org.apache.log4j.Category.forcedLog(Category.java:388)&lt;br /&gt;at org.apache.log4j.Category.log(Category.java:853)&lt;br /&gt;at org.slf4j.impl.Log4jLoggerAdapter.log(Log4jLoggerAdapter.java:597)&lt;br /&gt;at org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:169)&lt;br /&gt;at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:242)&lt;br /&gt;at java.util.logging.Logger.log(Logger.java:452)&lt;br /&gt;at java.util.logging.Logger.doLog(Logger.java:474)&lt;br /&gt;at java.util.logging.Logger.logp(Logger.java:590)&lt;br /&gt;at com.sun.common.util.logging.LoggingOutputStream.flush(LoggingOutputStream.java:90)&lt;br /&gt;at java.io.PrintStream.write(PrintStream.java:414)&lt;br /&gt;at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)&lt;br /&gt;at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(StreamEncoder.java:395)&lt;br /&gt;at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)&lt;br /&gt;at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:146)&lt;br /&gt;at java.io.OutputStreamWriter.write(OutputStreamWriter.java:204)&lt;br /&gt;at java.io.Writer.write(Writer.java:126)&lt;br /&gt;at org.apache.log4j.helpers.QuietWriter.write(QuietWriter.java:47)&lt;br /&gt;at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)&lt;br /&gt;at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)&lt;br /&gt;at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)&lt;br /&gt;at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)&lt;br /&gt;at org.apache.log4j.Category.callAppenders(Category.java:203)&lt;br /&gt;at org.apache.log4j.Category.forcedLog(Category.java:388)&lt;br /&gt;at org.apache.log4j.Category.log(Category.java:853)&lt;br /&gt;at org.slf4j.impl.Log4jLoggerAdapter.log(Log4jLoggerAdapter.java:597)&lt;br /&gt;at org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:169)&lt;br /&gt;at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:242)&lt;br /&gt;at java.util.logging.Logger.log(Logger.java:452)&lt;br /&gt;at java.util.logging.Logger.doLog(Logger.java:474)&lt;br /&gt;at java.util.logging.Logger.logp(Logger.java:590)&lt;br /&gt;at com.sun.common.util.logging.LoggingOutputStream.flush(LoggingOutputStream.java:90)&lt;br /&gt;	 &lt;br /&gt;&lt;/pre&gt;
and then about 1000 more lines of the same. There was clearly some kind of loop in the logging system that eventually caused the StackOverflowError. How could this happen?&lt;br /&gt;
&lt;br /&gt;
I knew Nexus was using SLF4J, the &lt;a href=&#034;http://www.slf4j.org/&#034;&gt;Simple Logging Facade for Java&lt;/a&gt;. SLF4J was set up to log to &lt;a href=&#034;http://www.slf4j.org/&#034;&gt;Log4J&lt;/a&gt;. And Log4J was set up with a &lt;a href=&#034;http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/ConsoleAppender.html&#034;&gt;ConsoleAppender&lt;/a&gt;. From the stracktrace I could tell that Log4J wasn&#039;t printing its output to the console, but to a LoggingOutputStream. Some googling revealed that LoggingOutputStream is set up by Glassfish &lt;a href=&#034;http://blogs.sun.com/nickstephen/entry/java_redirecting_system_out_and&#034;&gt;to catch any output to System.out&lt;/a&gt; and redirect it to the Java Logging API (JUL).&lt;br /&gt;
&lt;br /&gt;
So Log4J was obviously feeding its log lines into what it thought was the console while it was actually fed into the Java Logging API instead. But why did this cause a loop?&lt;br /&gt;
&lt;br /&gt;
The answer is found a few lines up the stacktrace in a class called &lt;a href=&#034;http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html&#034;&gt;SLF4JBridgeHandler&lt;/a&gt;. This class installs a bridge that will redirect all logs from the Java Logging API back to SLF4J. Which is pretty smart thing to do if you have code logging to JUL, but you want all code to log to be handled throgh SLF4J instead. Combined with Glassfish&#039;s LoggingOutputStream however, it caused an infinite loop:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;The Nexus application code logs to SLF4J&lt;/li&gt;
    &lt;li&gt;SLF4J logs to Log4J&lt;/li&gt;
    &lt;li&gt;Log4J writes its log lines to System.out through the configured ConsoleAppender&lt;/li&gt;
    &lt;li&gt;The log lines are processed by Glassfish&#039;s LoggingOutputStream and sent to Java Logging&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Java Logging sends its logs to SLF4J because of the SLF4JBridgeHandler.&lt;/li&gt;
    &lt;li&gt;SLF4J logs to.. Wait.. Houston, we have a problem!&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
So the next time you come up an idea you think is really smart, take a minute or two to consider the possibility that right now, somewhere else in the world, someone else might be thinking about an equally smart idea that when combined with yours will make the world explode.&lt;br /&gt;
&lt;br /&gt;
This issue is reported in the Nexus issue tracker as &lt;a href=&#034;https://issues.sonatype.org/browse/NEXUS-1307&#034;&gt;NEXUS-1307&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&#034;http://simplericity.com/images/glassfish_slf4j/served.jpg&#034; alt=&#034;&#034; /&gt;
        </description>
      
      
    
    
    
    <category>Java</category>
    
    <comments>http://simplericity.com/2009/01/02/1230894176938.html#comments</comments>
    <guid isPermaLink="true">http://simplericity.com/2009/01/02/1230894176938.html</guid>
    <pubDate>Fri, 02 Jan 2009 11:02:56 GMT</pubDate>
  </item>
  
  <item>
    <title>Exploring the Glassfish commit history with SVNSearch</title>
    <link>http://simplericity.com/2008/08/16/1218895920000.html</link>
    
      
        <description>
          &lt;br /&gt;
I recently added the &lt;a href=&#034;https://glassfish.dev.java.net/&#034;&gt;Glassfish&lt;/a&gt; Subversion repository to &lt;a href=&#034;http://svnsearch.org/&#034;&gt;SVNSearch.org&lt;/a&gt;. &lt;a href=&#034;http://blogs.sun.com/psterk/&#034;&gt;Paul Sterk&lt;/a&gt;, the community manager for Glassfish, asked if I could provide some background on SVNSearch.org and the benefits of having Glassfish indexed there. So, here are some ways to use SVNSearch:&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Who changed what, when?&lt;/h2&gt;
SVNSearch helps you keep track of, understand and learn from changes in version control systems. The basic interface shows you the most recent commits. Here&#039;s a screenshot from the Glassfish project:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#034;http://svnsearch.org/svnsearch/repos/GLASSFISH/search&#034;&gt;&lt;img src=&#034;http://simplericity.com/images/glassfish/search.png&#034; alt=&#034;&#034; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
But SVNSearch can do better than that. You can limit your search by log message, path, file name, file type, date, author or a referenced issue number. The following screenshot shows all commits done by &lt;a href=&#034;http://weblogs.java.net/blog/kohsuke/&#034;&gt;kohsuke&lt;/a&gt; last year in the /gfsvn directory having the word &amp;quot;fixed&amp;quot; in the log message:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#034;http://svnsearch.org/svnsearch/repos/GLASSFISH/search?logMessage=fixed%20bug&amp;amp;path=%2Fgfsvn&amp;amp;author=kohsuke&#034;&gt;&lt;img alt=&#034;&#034; src=&#034;http://simplericity.com/images/glassfish/fixed_kohsuke.png&#034; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
You might have noticed the charts on the left side of the screen. These statistics show commit distribution by path, time and&amp;nbsp; author and they are generated for each search you make.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;What changes were made to file X in revision Y?&lt;/h2&gt;
Once you&#039;ve find the commit you&#039;re looking for you might be interested in see what changes were actually  made in the files affected by the commit. By clicking on the a path SVNSearch shows you a side-by-side colored diff of the change, including inline changes:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#034;http://svnsearch.org/svnsearch/repos/GLASSFISH/search?p=/trunk/v3/distributions-prelude/distributions.xml&amp;amp;rev=21955&amp;amp;&#034;&gt;&lt;img alt=&#034;&#034; src=&#034;http://simplericity.com/images/glassfish/diff.png&#034; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Which developers work on the same part of the project?&lt;/h2&gt;
For each file in the repository, SVNSearch knows who made any change to that file. It also knows who else have touched that file and uses this information to provide a reasonably sophisticated collaboration graph. This graph will have one node for each developer in the project and there will be an edge between any two developers that have worked on the same code. Developers tend to be placed near closely if they&#039;ve worked on lots of common files.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#034;http://svnsearch.org/svnsearch/repos/GLASSFISH/search?view=graph&#034;&gt;&lt;img src=&#034;http://simplericity.com/images/glassfish/collaboration.png&#034; alt=&#034;&#034; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Developers who have committed recently are red while people who haven&#039;t committed in a while gets a more blue color. The Glassfish shows a group of developers in the upper left part of the graph, so let&#039;s zoom in on them and show their names:&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&#034;http://simplericity.com/images/glassfish/collaboration-zoomed.png&#034; alt=&#034;&#034; /&gt;&lt;br /&gt;
&lt;br /&gt;
The collaboration graph can be also useful for identifying parts of the code base that have been abandoned or for learning about the knowledge flow in the project. Sometimes two groups of developers are connected by a single developer, that means this developer is probably important for the flow of knowledge in the project since he&#039;s the only one who&#039;s worked on both parts of the code base. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;When do people commit?&lt;/h2&gt;
Say you want to get an overview of who is or has been involved in a project. You don&#039;t care about the details what actually changed so a detailed change list doesn&#039;t actually help you. For these cases, SVNSearch provides a timeline plot of all changes in the project, grouped by author.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#034;http://svnsearch.org/svnsearch/repos/GLASSFISH/search?view=plot&amp;amp;plotsort=commits&#034;&gt;&lt;img alt=&#034;&#034; src=&#034;http://simplericity.com/images/glassfish/timeline.png&#034; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Every red dot in this plot is a commit. The X axis is the timeline of the project and the Y axis actually show time of day of the commit. The list of authors can be ordered by name, first commit, last commit, total lifespan or number of commits which is the ordering used in the above example from Glassfish.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Developer turnover&lt;/h2&gt;
Long lived software projects always experience a certain degree of developer turnover. People leave the project and new developers join. SVNSearch includes a developer turnover chart that is based on &lt;a href=&#034;http://libresoft.es/downloads/developer-turnover-14pages.pdf&#034;&gt;the work of Gregorio Robles and Jesus M. Gonzalez-Barahona&lt;/a&gt; of Universidad Rey Juan Carlos, Spain.&lt;br /&gt;
&lt;br /&gt;
The idea is to track the 20% most active active developers in each one of ten intervals of the total timeline of the project and then track how active these developers are in the rest of the time intervals of the project.&lt;br /&gt;
&lt;br /&gt;
While the theory is interesting, you don&#039;t really have to understand it all to make use of it. A rule of thumb is that many horizontal lines indicates a stable core group, while diagonal lines signals that the core group is being replaced.&lt;br /&gt;
&lt;br /&gt;
The Glassfish project has a quite stable core group according to SVNSearch:&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&#034;&#034; src=&#034;http://simplericity.com/images/glassfish/turnover.png&#034; /&gt;&lt;br /&gt;
&lt;h2&gt;&amp;quot;Let me know when it&#039;s committed&amp;quot;&lt;/h2&gt;
Dependencies is something we have a lot of, not only in our software but also in software development. Have you ever had to wait for someone else to make a change in &amp;quot;their&amp;quot; code before you can continue with &amp;quot;your&amp;quot; coding? &lt;br /&gt;
&lt;br /&gt;
Any search in SVNSearch has an RSS feed, so if you&#039;re waiting for a specific change, why not just search for that and then subscribe to the feed? Here&#039;s an example show recent changes in Glasshfish using the RSS Screen Saver in OS X:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#034;http://svnsearch.org/svnsearch/repos/GLASSFISH/search?rss&#034;&gt;&lt;img alt=&#034;&#034; src=&#034;http://simplericity.com/images/glassfish/notifications.png&#034; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Background and future of the SVNSearch project&lt;br /&gt;
&lt;/h2&gt;
I started working on SVNSearch about four years back. The company I worked for at the time used CVS and suggested we started using Subversion instead. There tool support for Subversion wasn&#039;t all that good at the time but I was able to find alternatives for most of our tool chain. The CVS tool that I couldn&#039;t find a replacement for was the query interface in ViewCVS. So that&#039;s how I started working on SVNSearch.&lt;br /&gt;
&lt;br /&gt;
Over the years I&#039;ve added the features you&#039;ve seen here and more,&amp;nbsp; but I&#039;ve spent most of the time making sure SVNSearch is really, really fast and making it scale to millions of revisions. SVNSearch.org today indexes over 3.3 million revisions with the largest repository being &lt;a href=&#034;http://svnsearch.org/svnsearch/repos/KDE/search&#034;&gt;KDE&lt;/a&gt; with over 840.000 commits alone.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#034;http://svnsearch.org&#034;&gt;SVNSearch.org&lt;/a&gt; is a free service I provide to the open source community. My plan is to offer SVNSearch as a product on a commercial basis and I have a few customers in a private beta round now. I can&#039;t promise any public release date yet, but if you&#039;re interested in joining the beta, let me know.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve recently added enterprise features such as LDAP integration, Kerberos / Active Directory Single Sign-On, and role based security. But those features are more interesting when using SVNSearch inside a company firewall and probably not that interesting for an open source project like Glassfish :-)&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;h2&gt;Oh, just one more thing: I &lt;em&gt;always&lt;/em&gt; enjoy feedback!&lt;br /&gt;
&lt;/h2&gt;
&lt;br /&gt;
Whether you like SVNSearch or not, I&#039;d love to hear your thoughts. Perhaps you&#039;ve found a bug, have an idea for a new feature or just want to let me know you&#039;re using it. In any case don&#039;t hesitate to use the &lt;a href=&#034;http://svnsearch.org/svnsearch/sendfeedback&#034;&gt;feedback form&lt;/a&gt; on SVNSearch.org or just send me an email. (feedback at svnsearch dot com)
        </description>
      
      
    
    
    
    <category>Java</category>
    
    <comments>http://simplericity.com/2008/08/16/1218895920000.html#comments</comments>
    <guid isPermaLink="true">http://simplericity.com/2008/08/16/1218895920000.html</guid>
    <pubDate>Sat, 16 Aug 2008 14:12:00 GMT</pubDate>
  </item>
  
  </channel>
</rss>
