Posts Tagged ‘java’

Weird Jenkins Error: java.lang.NoClassDefFoundError: hudson/model/ComputerSet

Wednesday, May 30th, 2012

I finally got passed that Jenkins NoClassDefFound error when managing nodes… Now no such errors and the system was back. The slave machines are back to work and projects are building now!

The Jenkins error message (the log jenkins.log is under /var/log/jenkins/ in a standard standalone Linux installation) does not make sense and was misleading:

May 29, 2012 3:03:32 PM hudson.triggers.SafeTimerTask run

SEVERE: Timer task hudson.model.LoadStatistics$LoadStatisticsUpdater@12c8855 failed

java.lang.NoClassDefFoundError: hudson/model/ComputerSet

at hudson.model.LoadStatistics$LoadStatisticsUpdater.doRun(


at java.util.TimerThread.mainLoop(

The class was there. We just need to remove nodeMonitor.xml when migrating Jenkins instance.

nodeMonitors.xml: when migrating to another instance of Jenkins, remove the old nodeMonitors.xml to solve that NoClassDefFound erroe/issue as follows:

sudo  mv /var/lib/jenkins/nodeMonitors.xml /var/lib/jenkins/nodeMonitors.xml.old

nodeMonitors.xml will be automatically generated.

During the time I tried to resolve the issue, I also tweaked the JDK setting in Jenkins config. I added a jdk named jdk1.6-/usr/java/default/bin/java with JAVA_HOME: /usr/java/default

Be sure to take this out in Jenkins config if you are using slaves; it depends on slave machines env varianle JAVA_HOME. Adding this only confuses the salve machine as this overrides its local JAVA_HOME setting. If your master machine is Linux and your slave machine is Windows(like for building .net applications we we also are doing, in addition to Java jobs), this will definitely cause an error: incorrect JDK home.

Finally, got osgi hot deployed in Glassfish V3!

Thursday, November 11th, 2010

The tricky part is, no matter what the online tutorials say (/opt/SUNWappserver/domains/domain1/autodeploy/bundles), the default hot deploy folder out of box for Glassfish V 3.0.1 for osgi auto deployment is:


as indicated below:

[#|2010-11-11T16:53:20.863-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|{felix.fileinstall.poll (ms) = 2000, felix.fileinstall.dir = /opt/SUNWappserver/domains/domain1/config/./load, felix.fileinstall.debug = -1, = true, felix.fileinstall.tmpdir = /tmp/fileinstall--5626012334122035867, felix.fileinstall.filter = null}|#]

After I did the following,

cp  /opt/SUNWappserver/domains/domain1/autodeploy/bundles/plugins/HelloOSGi_1.0.0.jar  /opt/SUNWappserver/domains/domain1/config/load/

all works as expected:

[#|2010-11-11T16:53:20.857-0500|INFO|glassfish3.0.1||_ThreadID=11;_ThreadName=Thread-1;|Hello World!!|#]

[#|2010-11-11T16:53:20.863-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|{felix.fileinstall.poll (ms) = 2000, felix.fileinstall.dir = /opt/SUNWappserver/domains/domain1/config/./load, felix.fileinstall.debug = -1, = true, felix.fileinstall.tmpdir = /tmp/fileinstall--5626012334122035867, felix.fileinstall.filter = null}|#]

[#|2010-11-11T16:53:20.868-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|Goodbye World!!|#]

[#|2010-11-11T16:53:20.876-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|Hello World!!|#]

[#|2010-11-11T16:53:20.876-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|Updated /opt/SUNWappserver/domains/domain1/config/load/HelloOSGi_1.0.0.jar|#]

[#|2010-11-11T16:53:22.882-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|A bundle with the same symbolic name (HelloOSGi) and version (1.0.0) is already installed.  Updating this bundle instead.|#]

[#|2010-11-11T16:53:22.883-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|Goodbye World!!|#]

[#|2010-11-11T16:53:22.893-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|Hello World!!|#]

[#|2010-11-11T16:53:22.893-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|Installed ./load/HelloOSGi_1.0.0.jar|#]

[#|2010-11-11T16:53:22.894-0500|INFO|glassfish3.0.1||_ThreadID=17;_ThreadName=Thread-1;|Started bundle: file:/opt/SUNWappserver/domains/domain1/config/./load/HelloOSGi_1.0.0.jar|#]

Open-source solutions commonly used in Java UI development

Friday, October 29th, 2010

Format is:

For each third party library:

1) Name of all the third party software used in your components.

2) Version

3) Website where I can get that tool.

4) One line summary.

Here is the list:

Simple Logging Facade for Java (SLF4J)


The Simple Logging Facade for Java or (SLF4J) serves as a simple facade or abstraction for various logging frameworks, e.g. java.util.logging, log4j and logback, allowing the end user to plug in the desired logging framework at deployment time.



PrimeFaces is a lightweight open source component suite for Java Server Faces 2.0 featuring 100+ rich set of JSF components. Additional TouchFaces module features a UI kit for developing mobile web applications.



Hibernate an open source Java persistence framework project. Perform powerful object relational mapping and query databases using HQL and SQL.

click framework


Click Framework is a modern JEE web application framework, providing a natural rich client style programming model.

Apache Tomcat


Apache Tomcat (or Jakarta Tomcat or simply Tomcat) is an open source servlet container developed by the Apache Software Foundation (ASF).

JSP/JSF Expression Language Implementation


A JSP/JSF Expression Language Implementation

How to enable Eclipse/Glassfish remote debugging

Monday, March 22nd, 2010

You would normally enable jdb by adding debug options into your Java start up command by attaching debugging into JVM process, like the following:

DEBUG_OPTS=”-Xdebug -Xrunjdwp:transport= dt_socket,address=1044,server=y,suspend

You would consider adding this into your Glassfish’s(V2, in my case) start up script asadmin as below:

“$AS_JAVA”/bin/java “$DEBUG_OPTS” -Dcom.sun.aas.instanceName=server -Djava.libra
ry.path=”$AS_NSS”:”$AS_INSTALL/lib”:”$AS_ICU_LIB” -Dcom.sun.aas.configRoot=”$AS_
CONFIG” -Djava.endorsed.dirs=”$AS_INSTALL/lib/endorsed” -Dcom.sun.aas.processLau
ncher=”SE” -cp “$AS_DERBY_INSTALL/lib/derby.jar”:”$AS_INSTALL/jbi/lib/jbi-admin-
ib/install/applications/jmsra/imqjmsra.jar” -Dcom.sun.appserv.admin.pluggable.fe
n.enterprise.cli.framework.CLIMain “${@}”

Actually this will not work.

You have to log into the Glassfish admin console, under:

Application server

JVM General Settings

Enabled (check it)

Hit save

Restart Glassfish.

You’ll see Glassfish start up script spits the following message:

Listening for transport dt_socket at address: 9009
Application server is listening at address 9009 for debugger to attach using transport dt_socket

It started to listen at port 9009 by default instead of 1044.

You’ll configure your Eclipse accordingly to do remote debugging. Remember the port number 9009 instead of 1044.

Click Framework And Jsp: Notes

Wednesday, July 1st, 2009


Rendered page example:

customer-table.jsp (src code) ==============>when accessing from browser: it should be accessed AS

customer-table.htm—this auto mapped to

customer-table.jsp-map to

(if accessing it as .jsp, page is not rendered correctly)

This will first invoke customer-table.jsp,

-then invoke

-then invoke border-template.jsp as indicated in getTemplate method in above .java

- then render customer-table.htm (mapped to .jsp) via ${forward} in border-template.jsp when rendering border-template.jsp

(template is also a .jsp file.


<%@taglib prefix=”c” uri=””%>
<%@taglib prefix=”fmt” uri=””%>

<style type=”text/css”>
th { color: white; }

Example JSP customers table.

<table style=”border: 1px solid black;” cellpadding=”6″ cellspacing=”0″>
<tr valign=”baseline” bgcolor=”404060″>
<th align=”center”> ID </th>
<th align=”left”> Name </th>
<th align=”left”> Email </th>
<th align=”center”> Age </th>
<th align=”left”> Category </th>
<th align=”center”> Portfolio </th>
<th align=”right”> Date Joined </th>
<th align=”center”> Active </th>

<c:forEach var=”customer” items=”${customers}” varStatus=”lineInfo”>

<c:when test=”${lineInfo.count % 2 == 0}”> <tr bgcolor=”#f7f7e7″> </c:when>
<c:otherwise> <tr bgcolor=”white”> </c:otherwise>

<td align=”center”> ${} </td>
<td align=”left”> ${} </td>
<td align=”left”> <a href=”${}”>${}</a> </td>
<td align=”center”> ${customer.age} </td>
<td align=”left”> ${} </td>
<td align=”right”> <fmt:formatNumber value=”${}” type=”currency”/></td>
<td align=”right”> <fmt:formatDate value=”${customer.dateJoined}” pattern=”dd MMM yyyy”/> </td>

<td align=”center”>
<c:when test=”${}”> <input type=”checkbox” checked=”checked”/> </c:when>
<c:otherwise> <input type=”checkbox”/> </c:otherwise>





The <tt>CustomerTable</tt> page is automatically mapped to the request:

<pre class=”codeConfig”>
GET customer-table.htm </pre>

When pages are configured to use automapping the <tt>ClickServlet</tt>
will automatically associated the file path <tt>customer-table.jsp</tt>
with the page class <tt>CustomerTable</tt>.



import java.util.List;


* Provides JSP Page example where a JSP page and JSP border template is used to
* render a table.
* @author Malcolm Edgar
public class CustomerTable extends BorderPage {

public List customers = null;

* @see
public void onRender() {
customers = getCustomerService().getCustomersSortedByName(10);

* Returns the name of the border template: &nbsp; <tt>”/border-template.jsp”</tt>
* @see
public String getTemplate() {
return “/border-template.jsp”;


This is the template file:

<!doctype html>
sabob 724639 3 <!–
4 Licensed to the Apache Software Foundation (ASF) under one
5 or more contributor license agreements.  See the NOTICE file
6 distributed with this work for additional information
7 regarding copyright ownership.  The ASF licenses this file
8 to you under the Apache License, Version 2.0 (the
9 “License”); you may not use this file except in compliance
10 with the License.  You may obtain a copy of the License at
14 Unless required by applicable law or agreed to in writing,
15 software distributed under the License is distributed on an
17 KIND, either express or implied.  See the License for the
18 specific language governing permissions and limitations
19 under the License.
20 –>
malcolm_edgar 715468 21
sabob 787399 23 <%– Menu –%>
24 <table id=“menuTable” border=“0″ width=“100%” cellspacing=“0″ cellpadding=“0″ style=“margin-top: 2px;”>
25 <tr>
26 <td>
27 <div class=“menustyle” id=“menu”>
28 <ul class=“menubar” id=“dmenu”>
29 <c:forEach items=“${rootMenu.children}” var=“topMenu”>
30 <li class=“topitem”>${topMenu}
31 <ul class=“submenu”
32 <c:forEach items=“${topMenu.children}” var=“subMenu”>
33 ><li>${subMenu}</li
34 </c:forEach>
35 ></ul>
36 </li>
37 </c:forEach>
38 <li class=“topitem”><a target=“_blank” href=“${context}/source-viewer.htm?filename=WEB-INF/classes/${srcPath}” title=“Page Java source”><img border=“0″ class=“link” alt=“” src=“${context}/assets/images/lightbulb1.png”/> Page Java</a>
39 </li>
40 <li class=“topitem”><a target=“_blank” href=“${context}/source-viewer.htm?filename=${path}” title=“Page Content source”><img border=“0″ class=“link” alt=“” src=“${context}/assets/images/lightbulb2.png”/> Page HTML</a>
41 </li>
42 </ul>
43 </div>
44 </td>
45 </tr>
46 </table>
47 </div>
malcolm_edgar 715468 48
sabob 787399 49 <%– Page Content –%>
50 <div class=“content”>
51 <h2>${title}</h2>  <============ from
52 <p/>
sabob 782056 53 <jsp:include page=${forward} flush=“true”/>  <============= htm equivalent of path; the .htm page requested, in this case it renders requesing .htm page: customer-table.htm
sabob 787399 54 </div>
56 </div>
malcolm_edgar 715468 57
sabob 757699 58 ${jsElements}
malcolm_edgar 715468 60 </body>
malcolm_edgar 716421 61 </html>

=========imports for jsp==========

public class PageImportsextends Object

Provides a utility object for rendering a Page’s HTML header imports and its control HTML header imports.

A PageImports instance is automatically added to the Velocity Context for Velocity templates, or as a request attribute for JSP pages using the key name “imports“.

PageImports Examples

To use the PageImports object simply reference it your page header section. For example: <html>
imports” include all javascript and stylesheet imports.
PageImports also provides a way of including the javascript and stylesheet separately using the key names “cssImports” and “jsImports“.

You should follow the performance best practice by importing CSS includes in the head section, then include the JS imports after the html body. For example:

Please also see Page.getHtmlImports() and Control.getHtmlImports().

Tip of the day: Click Framework: variables in JSP

Wednesday, July 1st, 2009

A variable in a JSP should be included in bracelets, otherwise it will not be traeted as variables, although it works with .htm with Velocity engine. So $path works in .htm, in JSP it should write as ${path} if you wnat it to be teated as a variable instead of a literal.