<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Felipe Leme&apos;s Blog</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/" />
<modified>2008-06-27T03:28:09Z</modified>
<tagline></tagline>
<id>tag:weblogs.java.net,2008:/blog/felipeal/87</id>
<generator url="http://www.movabletype.org/" version="3.01D">Movable Type</generator>
<copyright>Copyright (c) 2008, felipeal</copyright>
<entry>
<title>Configuring Eclipse TPTP (a.k.a PQP) profiler on Linux</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2008/06/configuring_ecl.html" />
<modified>2008-06-27T03:28:09Z</modified>
<issued>2008-06-27T03:23:44Z</issued>
<id>tag:weblogs.java.net,2008:/blog/felipeal/87.10043</id>
<created>2008-06-27T03:23:44Z</created>
<summary type="text/plain">After struggling for weeks and almost giving up, I finally managed to have the Eclipse TPTP profiler working on my Ubuntu 64bits box!

As this was a painful and unbelievably hard experience (because of Eclipse TPTP, not Ubuntu/Linux, BTW), I&apos;m going to share a few tips here.</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>Eclipse</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[After struggling for weeks and almost giving up, I finally managed to have the Eclipse TPTP profiler working on my Ubuntu 64bits box!<br>
<br>
As this was a painful and unbelievably hard experience (because of Eclipse TPTP, not Ubuntu/Linux, BTW), I'm going to share a few tips here.<br>
<br>
<br>
First of all, this is going to be a quick and dirty blog. I don't have the time, patience, or motivation to do a detailed step-by-step tutorial - there are plenty available (Got google?). The problem is, you follow them and something just is not there or does not work, then you got stuck - the idea here is to provide clues on why you got stuck and how to get going.<br>
<br>
So, let's assume you installed TPTP and try to profile a web application (which is already configured and can be ran as 'Run As -> Run on Server'). You right-click in the project, do a 'Profile As -> Profile on Server')  and then... nothing. No exception, no error, no frogs failing from sky, nothing. Actually, there is one symptom: the monitor dialog opens, but empty.<br>
<br>
I knew from previous (and frustrated) attempts that the profiler needs to run an agent (which is OS-specific) and if the agent is not running, it pops up an error message (stating that the agent is not running - when I first got that message a few weeks ago, I google for it and figure that out). As the message didn't pop up this time, I figured some exception has been just ignored by Eclipse's UI, so I decide to do a tail -f on the .log file (located on WORKSPACE_DIR/.metadata), and bingo: got a message saying that the script could not be executed. (PS: I don't have the log messages anymore, so I won't be able to copy and paste the exact message).<br>
<br>
I will ignore for now the fact that when you download a linux tarball the proper files necessary to run the application should have all necessary executable bits turned on and jump to the point where I had to cd to 
 ECLIPSE_INSTALL/plugins/org.eclipse.tptp.platform.ac.linux_em64t_4.4.1.v200804021410/agent_controller/bin and do a 'chmod +x *'. Once I did it, I tried to run again and got:<br>
<pre>
<i>
[: 46: ==: unexpected operator
</i>
</pre>
<br>
Looking at those lines, I found some marvels of modern shell spripting:<br>
<pre>
<i>
if [ x$TEMP == x ]; then
	export TEMP=/tmp
fi
</i>
</pre>
<br>
As a lazy bum with a 10GB /tmp partition, I just commented it to:<br>
<pre>
<i>
#if [ x$TEMP == x ]; then
	export TEMP=/tmp
#fi
</i>
</pre>
<br>
Running it again, I got a new error now, something like (again, I don't have the output anymore):<br>
<br>
<pre><i>
ACServer: error while loading shared libraries: ../lib/libtptpUtils.so: short file 
</i></pre>
<br>
Sounded weird, so I decided to take a look on that file:<br>
<pre><i>
# file ../lib/libtptpUtils.so
ASCII Text
</i></pre>
<br>
Very nice: not only the files on bin are not executable, but the libraries that should be a symbolic link are text files which the name of the real libraries! Never saw such think, whoever did that deserves a Duke Award! Specially because I could fix it with a quick shell command:<br>
<pre>
<i>
for i in `file *|grep  -i ascii|cut -f 1 -d : `; do new=`cat $i`; rm $i ;ln -s $new $i; done
</i>
</pre>
Now that I fixed the broken files provided in the tarball, I got an 'easy' problem:<br>
<pre>
<i>
# ./ACStart.sh 
ACServer: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory<br>
</i></pre>

After I couple of minutes googleing and apt-cache searching: 
<pre><i>
<br># sudo apt-get install libstdc++5 <br>
</i></pre>
And now:
<pre><i>
# ./ACStart.sh 
Starting Agent Controller.
ACServer started successfully.

# ./ACStop.sh 
Shutting down the Agent Controller...
ACServer stopped.
</i></pre>
<br>
In other words, at this point I knew the non-java (the agent) part of the profiler will work, so I could try it again in the UI (notice that the only Ubuntu-specific issue here was the missing libstdc++5; all the rest was bad packaging by the PTPT project).<br>
<br>
Back to Eclipse, I did the "Profile As" again, and... nothing. I mean, know I saw same status bar messages saying the profiler received events and such, and a 'ps -aef|grep AC' shows the agent running. But I couldn't figure out how to get the results in real time (I could export a report in HTML, which is not useful for the kind of profiling I was going to do). After googleing around, it looked like I should be able to right click the profiler elements in the Monitor view and select a 'Opening With -> Execution Statistics' editor (see? I'm even using the correct Eclipse terms at this point :-). But looks like the bastard is not available, even though when I installed the TPTP/Web project I select the option to install all the dependencies.<br>
<br>
At this point, I thought that the only plausible issue was some missing plugin to visualize the results. I triggered the Eclipse update panel again and expanded all TPTP options to see if I found something with a reasonable name that could solve the issue... and nothing. So, as a last and desperate resource, I decided to install all remaining TPTP plugins (including some BIRT stuff), and... voilà, it worked!<br>
<br>
Seriously, I finally got the execution statistics, method statistics, etc. I was so thrilled that I almost cried! But instead, I decided to write this quick block.<br>
<br>
And for those non-believers (I was such one), here is a screenshot:<br><br>
<br>
<img alt="pqp.png" src="http://weblogs.java.net/blog/felipeal/archive/pqp.png" width="1000" height="600" />
<br><br>
PS: regarding the meaning of PQP, I will leave the explanation to the Brazilian readers :-)






]]>

</content>
</entry>
<entry>
<title>Spring, ICEFaces, and the dreaded thread-bound request issue</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2008/03/spring_icefaces.html" />
<modified>2008-03-06T19:50:28Z</modified>
<issued>2008-03-06T08:21:56Z</issued>
<id>tag:weblogs.java.net,2008:/blog/felipeal/87.9320</id>
<created>2008-03-06T08:21:56Z</created>
<summary type="text/plain">In this blog, I provide a quick solution for a nasty issue that arises when you use ICEFaces server-push technology combined with Spring/JSF integration.
</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>Web Applications</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[In this blog, I provide a quick solution for an issue that arises when you use ICEFaces server-push technology combined with Spring JSF integration.<br>
<br>
Normally, I would provide a detailed context of the issue at hand (with links to relevant pages like the java.net blog entitled "Sample Application using JSF, Spring 2.5, and Java Persistence APIs", forum posts, etc), and would spend more time polishing the text (specialyty for grammar erros that mades I luke lick a idiotic :-), etc.. But, unfortunately, I'm in a rush, so I will provide just the bare details.<br>
<br>
Long story short, a nice feature of Spring 2.5 is that you can eliminate almost completely the XML configuration hell, replacing it by annotations. And I mean not only the Spring XML files, but also faces-config.xml. Instead of defining your managed beans on faces-config.xml, you delegate the task to Spring, and your "face" is reduced to:
<pre><code>
&lt;faces-config&gt;   
&lt;application&gt;
&lt;el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver&lt;/el-resolver&gt;
  &lt;/application&gt;
&lt;/faces-config&gt;
</code></pre>
This setup works fine with "normal" requests served by JSF pages, but if you use ICEFaces, once it pushes an event to your page, you get a nasty exception similar to this:<br>
<pre><code>
Mar 5, 2008 11:51:14 PM com.sun.faces.lifecycle.LifecycleImpl phase
WARNING: executePhase(RENDER_RESPONSE 6,com.icesoft.faces.context.BridgeFacesContext@9b774e) threw exception
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myBean': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request? If you are actually operating within a web request and still receive this message,your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:293)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:888)
	at org.springframework.web.jsf.el.SpringBeanFacesELResolver.getValue(SpringBeanFacesELResolver.java:94)
	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
	at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:58)
	at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
	at org.apache.el.parser.AstValue.getValue(AstValue.java:86)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
	at com.sun.faces.application.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:95)
	at com.icesoft.faces.component.tree.TreeRenderer.encodeBegin(TreeRenderer.java:142)
	at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:809)
	at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:536)
	at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
	at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
	at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
	at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:543)
	at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:519)
	at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:161)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
	at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:152)
</code></pre>
I googled for it and found some developers complaining about the same issue, but didn't find any solution. After some further research and debugging, I realized what the problem is. Normally, Spring intercepts each request (through the org.springframework.web.context.request.RequestContextListener, which must be added to web.xml), and add its BeanFactory to the request thread context (using a ThreadLocal reference). But when ICEFaces does a server push,  RequestContextListener interception is not triggered.<br>
<br>
The solution? First, adding a JSF phase listener that mimics RequestContextListener behavior:<br>
<pre><code>
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import javax.servlet.http.HttpServletRequest;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import static org.springframework.web.context.request.RequestContextHolder.*;

/**
 * This class is necessary to set the Spring context on ICEFaces server pushes.
 * 
 * @author felipeal
 *
 */
public class SpringICEFacesIntegrationPhaseListener implements PhaseListener {

  public void afterPhase(PhaseEvent event) {
    // do nothing
  }

  public void beforePhase(PhaseEvent event) {
    if ( getRequestAttributes() == null ) {
      final FacesContext context = event.getFacesContext();
      final HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
      final ServletRequestAttributes attributes = new ServletRequestAttributes(request);
      LocaleContextHolder.setLocale(request.getLocale());
      RequestContextHolder.setRequestAttributes(attributes);
    }
  }

  public PhaseId getPhaseId() {
    return PhaseId.RENDER_RESPONSE;
  }

  /**
    * This method must be explicitiy called by Managed Beans after they
    * rendered ICEFaces stuff.
    */ 
  public static void releaseContext() {
    if ( getRequestAttributes() != null ) {
      RequestContextHolder.setRequestAttributes(null);
      LocaleContextHolder.setLocale(null);
    }
  }

}
</code></pre>

Then on your managed bean, clean up the context after ICEFaces rendered the page. For instance:

<code><pre>
protected class AbstractManagedBean {

  private PersistentFacesState persistentFacesState = null;

  public AbstractManagedBean {
    persistentFacesState = PersistentFacesState.getInstance();
  }
  
  /**
   * Initiates server-push
   */
  protected void render() throws RenderingException {
      try {
        persistentFacesState.render();
      } finally {
        SpringICEFacesIntegrationPhaseListener.releaseContext();
      }
  }
}
</code></pre>

And the final step, adding the listener to faces-config.xml:
<pre><code>
&lt;faces-config&gt;
  &lt;lifecycle&gt;    
&lt;phase-listener&gt;SpringICEFacesIntegrationPhaseListener&lt;/phase-listener&gt;
  &lt;/lifecycle&gt;
&lt;application&gt;
&lt;el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver&lt;/el-resolver&gt;
  &lt;/application&gt;
&lt;/faces-config&gt;
</code></pre>

The solution is relatively simple and straightforward; hopefully this blog will help others facing the same issue.<br>
<br>
On a side note, it would be nice to add a test case for such class, something like this:

<code><pre>

public class SpringICEFacesIntegrationPhaseListenerTest {
  
  private final SpringICEFacesIntegrationPhaseListener listener = new SpringICEFacesIntegrationPhaseListener();
  
  public void testBeforePhase() {
    // set mock context
  final PhaseEvent event = new PhaseEvent(context,PhaseId.RENDER_RESPONSE,lifecycle);
  assertNull( "context was already set", getRequestAttributes() );
    final PhaseEvent event = new PhaseEvent(context,PhaseId.RENDER_RESPONSE,lifecycle);
    assertNull( "context was already set", getRequestAttributes() );
    listener.beforePhase(event);
    assertNotNull( "listener did not set context", getRequestAttributes() );
  }

  public void testCalledOnce() {
    // set mock context
    assertNull( "context should be set before", getRequestAttributes() );
    final PhaseEvent event = new PhaseEvent(context,PhaseId.RENDER_RESPONSE,lifecycle);
    listener.beforePhase(event);
    // verify mocks to assert listener didn't call methods
  }
}
</code></pre>

The problem is, setting a mock FacesContext is not trivial. Initially, I thought I could use Easymock, but it would require half-a-dozen mocks, and I wasn't in the mood for that. Then I tried to use Spring Mock, but looks like it doesn't provide a MockFacesContext anymore. Other options might be Shale or JSFUnit, but I haven't had the time to play with these tools yet.<br>
<br>
So, I'd like to finish this blog with a question - which tool/framework would you recommend for such test case?

]]>

</content>
</entry>
<entry>
<title>JSP is not dead!</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2007/07/jsp_is_not_dead.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-07-09T16:35:31Z</issued>
<id>tag:weblogs.java.net,2007:/blog/felipeal/87.7812</id>
<created>2007-07-09T16:35:31Z</created>
<summary type="text/plain">Once in a while people blog about JSP being a dead technology. Well, it&apos;s alive and well, as I show in this blog.</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>Web Applications</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[Once in a while people blog about JSP being a dead technology. Well, that's not true, it is so alive that it is even being sold in the streets of San Francisco, as shown below:<br>
<br>
<img alt="jsp-sf-small.png" src="http://weblogs.java.net/blog/felipeal/archive/jsp-sf-small.png" width="1096" height="602" /><br>
I saw that place yesterday night, when I was walking home, after watching a movie. Unfortunately I didn't have a good camera with me (my cell phone does not have a flash), but thanks to Google Maps Street View I could find the place online and get a screenshot.<br>
<br>
Notice that some parts of the picture are blurred, and I did not provide a link to Google's page.  I will leave it as an exercise for the reader: find where this place is!<br>. 
<br>
I will post the answer in another blog (along with some comments about Google and Yahoo maps), but can give some tips over the week - let's see how the comments go. Also, if you find the place, please don't reveal it (to not spoiler the quest of the others - assuming someone will have the curiosity and time to look for the answer :-) - just post a comment saying you found it, and send me the answer in private. I will publish then name of the 'winners' in the next blog.... 

]]>

</content>
</entry>
<entry>
<title>My suggestion for Servlet 3.0</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2007/06/my_suggestion_f_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-06-25T17:52:38Z</issued>
<id>tag:weblogs.java.net,2007:/blog/felipeal/87.7733</id>
<created>2007-06-25T17:52:38Z</created>
<summary type="text/plain">The Servlet 3.0 JSR is out. I have a simple - yet very useful - suggestion for improvement.</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>J2EE</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[I have taught Java and web-tier (Servlets/JSP/taglibs) development to about 10 classes over the last 3 years. And everytime I teach servlet attributes, I face the same situation: first I explain what request attributes are, why they are useful, and which methods you use to manipulate them. Then, when I teach session, I have to explain that it has a similar concept, with the <b>exact</b> same methods. And when I get to the ServletContext topic - well, you got the picture...<br>
<br>
Now, to make things worse, the Servlet API is taught a couple of weeks after the OO concepts, like interface. It's already hard to explain interfaces for people coming from non-OO backgrounds (you have to explain many concepts and analogies, like 'interfaces are contracts', 'an interface defines methods signatures that classes must implement', and so on...), and when they are finally understanding it, they face a situation where an interface would make sense, but it's not used.<br>
<br>
So, putting A and B together, there should be an interface defining an object that handles user attributes, and both ServletRequest, HttpSession, ServletContext, and PageContext (from JSP) would implement it. Something like <b>AttributeContainer</b> (which is a bad name as container has zillions other meanings on Java EE), <b>AttributeHolder</b>, <b>AttributeStore</b>, etc (I honestly cannot think about a nice name for it).<br>
<br>
This is a very simple change, as the classes already have the methods - it's just a matter of <i>"making the contract official"</i>  by defining such interface. In fact, it's so simple that I believe the previous EG didn't think it would worth the effort (I had suggested it before, I believe in the 2.5 timframe) - they might think it doesn't bring enough value.<br>
<br>
But I can guarantee it would help in at least 3 scenarios:<br>
<ol>
<li>Teaching attributes on Servlet courses</li>
<li>Teaching interfaces (once you reach the attributes class, this is a good example of interface use)</li>
<li>Provide an easy (although not necessarily more efficient) way to write code that store attribute in many different scopes (like JSTL set tag):

<pre>
<code>

public void set( String var, String scope, Object value ) {
  AttributeHolder holder = attHolders.getHolder( scope );
  if ( holder == null ) {
    throw new BlaBlaException( "invalid scope: " + scope );
  }
  holder.setAttribute( var, value );
}

</code>
</pre>

</li>
</ol>
<br>
I know the EG has more serious issues to handle, but this is a minor one, which would not hurt anyone. Besides, this is a new major spec release (3.0), so that's a good time to include some change (it could even deprecate the method that return the attribute names in an Enumeration, and provide an additional method that uses a Set<String>, for instance).<br>
<br>



]]>

</content>
</entry>
<entry>
<title>The stress is over, time to enjoy the conference...</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2007/05/the_stress_is_o.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-05-10T08:26:34Z</issued>
<id>tag:weblogs.java.net,2007:/blog/felipeal/87.7340</id>
<created>2007-05-10T08:26:34Z</created>
<summary type="text/plain">We presented our technical session earlier today, so now we can finally enjoy the conference - too bad I have to work tomorrow :-(

Anyway, I&apos;d like to talk a little bit about our presentation...
</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>JavaOne</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[We presented our <a href="http://www28.cplan.com/sb158/session_details.jsp?isid=286235&ilocation_id=158-1&ilanguage=english">technical session</a> earlier today, so now we can finally enjoy the conference - too bad I have to work tomorrow :-(<br>
<br>
Anyway, I'd like to talk a little bit about our presentation...<br>
<br>
The room was quite packed (541 seats of 800 available), and the session was kind of fun, besides our problems with the demo. In fact, we took a look on the evaluations after we left, and most of them were good. We received some bad feedback though, some valid, some not, so I'd like to comment about some complaints we received...<br>
<br>
<b>They should have tested the laptop setup</b> - well, we did, but it didn't work :-(. There is a 10 minute technical rehearsal in the day before the session, exactly for this purpose. We went there yesterday at 7:00 PM, and could not make it work (thanks to the wonderful video card work Dell does on its laptops), besides the effort of the JavaOne crew and even the help with another speaker (a guy who is a WTP committer). We tried hard for almost 1 hour, but had to leave before the 8:00 PM BOF. Then we tried again this morning, and apparently it worked - apparently, because we did not try to login (once I logged in during the technical session, the problem happened again :-(. What made me really angry is that I didn't install Linux on that laptop (I just got it Friday) because I didn't want to mess it around before our session...<br>
<br>
<b>The speaker should have practiced more, so the demo should not fail</b> - I don't think that critic was fair, I did practice a lot. I agree I should not have had the errors with the proxy server, but when I practiced, I got other errors (like swing elements not being displayed correctly), so I opted for removing the minimum number of elements. Also, some errors I had were <b>on purpose</b>, as the idea was to show the right way demonstrating the wrong way first. So, in summary, the errors were:<br>
<ul>
<li><i>not saving test plan before running a test</i>: on purpose, so I could talk about the extension (.jmx)
<li><i>failure due to lack of cookie manager</i> - on purpose</i>
<li><i>failure because of ViewStage</i> - on purpose
<li><i>big mess as proxy was not stopped</i> - my bad :-(
<li><i>forget to add ${viewState}</i> - my mistake again, although not a big deal
</ul>
<br>
<br>
<b>Session was supposed to be about tools, but they just talked about JMeter</b> - that's fair. When we planned the presentation, we intended to show other tools, specially the integration of JMeter with profilers and build. Unfortunately, as we developed the presentation, we realized we would not have time to show everything we had in mind, so we opted to just explain - in a practical way - how JMeter works. So, our biggest flaw in that point was not being clear about it in the abstract - sorry about that...<br>
<br>
<b>Speakers had an accent hard to understand</b> - we are sorry about that as well - we are not native English speakers, but tried our best (I, in particular, tried to speak slower than I normally do). In fact, we had a couching session before our presentation, and we told the coach the accent was one of our main concerns, so he gave us some tips. Looks like they were not enough though :-(<br>
<br>
<b>It was a total waste of time</b> - I don't think it was that bad, at least it was funny - I've been to sessions that just were not a total waste of time because I could take a nap and get some rest while on it...<br>
<br>
But we also received some very good feedback, most of them regarding the fact that we had trouble with the demo but could work around it.<br>
<br>
So to finalize, I'd like to apologize for those who didn't like the session, and to thank those who enjoyed. In particular, I'd like to thank:<br>
<ul>
<li>the JavaOne crew (the stage guys, the speaking coach, etc...)
<li>the guy who suggested I should stop the proxy
<li>everyone that helped me find a red request in the screen
<li>Ed Burns
<li>and a special thanks to Dell - had the laptop worked smoothly, the presentation wouldn't be half that funny!
</ul>

]]>

</content>
</entry>
<entry>
<title>Firefox, profiles, and Linux</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2007/02/firefox_profile.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-02-28T04:18:30Z</issued>
<id>tag:weblogs.java.net,2007:/blog/felipeal/87.6475</id>
<created>2007-02-28T04:18:30Z</created>
<summary type="text/plain">Have you ever spent hours trying to run 2 instances of Firefox on Linux, using command-line arguments (like -ProfileManager) that *used* to work, but now simply open a window in the same Firefox process? If you did, this blog is for you...</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>Linux</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[Have you ever spent hours trying to run 2 instances of <a href="http://getfirefox.com">Firefox</a> on Linux, using command-line arguments (like <code>-ProfileManager</code>) that <b>*used*</b> to work, but now simply open a window in the same Firefox process? If you did, this blog is for you...<br>
<br>
First of all, <a href="http://mozilla.org">Mozilla</a>-based products like <a href="http://getfirefox.com">Firefox</a> use profiles. That feature is so useful that it deserves a blog of its own (no, I won´t <a href="http://lifehacker.com/software/firefox/geek-to-live--manage-multiple-firefox-profiles-231646.php">reinvent the wheel</a>). But basically speaking, it means you can create different profiles, each with its own mozilla data (like cookies, bookmarks, passwords, etc...), and use them simultaneously. This is quite useful when you are developing web applications and must test it as different users. Or in a more mundane (and less development-based) situation, when you need to access a website using 2 different accounts (for instance, I have 2 main <a href="http://gmail.com">GMail</a> accounts, <i>felipeal</i> and <i>felipealists</i>, the former being my main user, and the latter used only for managing mailing lists).<br>
<br>
So far, so good - no big news in the scenario I described above. The problem is, the CLI (<i>command-line interface</i>) seems to be broken in more recent versions of Firefox and/or <a href="http://fedora.redhat.com/">Fedora Core</a>. I.E., if I have a running firefox instance using the default profile, and type the following command in the shell:
<pre><code>
firefox -P sidekickProfile
</code></pre>
or even:
<pre><code>
firefox -ProfileManager
</code></pre>
it opens a new window using the same <code>firefox</code> process (and hence using the same profile), instead of starting a new process (with a different profile, or popping up the profile manager window, respectively)!<br>
<br>
That issue has been hunting me for many months, but as I just needed that feature a couple of times during this period (and being a professional procrastinator :-), I never had the patience to figure it out what was wrong - I just <code>su</code>-ed to a new user and ran a different instance of <code>firefox</code> (which is an ugly hack).<br>
<br>
Well, last week, I finally got ashamed of myself, decided to fight the laziness, and figured out what the problem was! Looks like somewhere in the Firefox/Mozilla evolution (I guess it was Firefox 1.5), the startup scripts assumed the responsibility of deciding if a new process should be started, or if the CLI parameters should be passed to an existing (remote) instance.<br>
<br>
Long-story short, in order to achieve the desired (for me, at least) behavior, you must set the variable <code>MOZ_NO_REMOTE</code>, to any value (or even none, as seem in the second example below - don't ask me why, I've never seem such behavior before!). For instance:

<code><pre>
MOZ_NO_REMOTE=hell,yes firefox -P sidekickProfile
MOZ_NO_REMOTE= firefox -ProfileManager
</pre></code>

Or, in a nice Unix way, create aliases to do the job:

<code><pre>
alias ff2=`MOZ_NO_REMOTE= firefox -P sidekickProfile`
alias pm=`MOZ_NO_REMOTE= firefox -ProfileManager`
</pre></code>

As a final note, I will leave here my 2-cents rant: why have this behavior changed in recent versions of Firefox? I mean, I´m fine with the script taking the responsibility of reusing existing process (I guess that burden was taken care off by the Linux/Unix integration before), but once you <b>*explicitly*</b> pass CLI arguments to invoke the profile manager, why the hell should the script pass them to a running process???








  


]]>

</content>
</entry>
<entry>
<title>Final? Not yet...</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2007/02/final_not_yet_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-02-13T16:11:31Z</issued>
<id>tag:weblogs.java.net,2007:/blog/felipeal/87.6515</id>
<created>2007-02-13T16:11:31Z</created>
<summary type="text/plain">Now that the pandora box is open, it is my turn to suggest a (possible worthless) change to the Java language: the semifinal modifier!
</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>J2SE</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[Now that the <a href="http://blogs.sun.com/jag/entry/compiler_fun">pandora box is open</a> is open, it is my turn to suggest a (possible worthless, I know) change to the Java language: the <b><code>semifinal</code></b> modifier!<br>
<br>
I had this idea on my way home last week, after teaching the <b><code>final</code></b> keyword for my current <a href="http://globalcode.com.br">Globalcode</a> class. The idea was basically this: <b><code>final</code></b> is a well designed modifier, as it has a similar meaning on the many places it can be used (variable, method and class definitions). So wouldn't it be nice if there was a similar modifier for definitions that are not quite final?<br>
<br>
Enters the <b><code>semifinal</code></b> modifier - too bad I didn't have this idea during the World Cup :-(.<br>
<br>
The first and most useful case (if not the <b>*only*</b> useful case at all) is when defining a class: a class (or interface) marked as semifinal can be extended, but its public behavior cannot change. In other words, you can override any method of this class (as long as you do not make then more accessible than the original), but you cannot add any public method (or attribute).<br>
<br>
The reasoning? I think such classes could be useful when defining APIs, frameworks, or components, where you do not want to allow extended classes to be more capable than its superclass (a side effect of this new class modifier is that the compiler could generate warnings when a subclass of a semifinal class is used as the type of a reference, parameter or method return). For instance, say you have an interface <code>I</code> that has methods <code>mA()</code> and <code>mB()</code>, and one implementation <code>X</code> that adds a method <code>mC()</code>. Over time, <code>mC()</code> becomes so popular and necessary that the clients of <code>I</code> always cast it to <code>X</code>, in order to call <code>mC()</code>. Well, if this method is so necessary, it should be part of <code>I</code>, and not an implementation detail - declaring <code>I</code> as <code>semifinal</code> would force it (i.e., <code>X</code> could not add a new public method <code>mC()</code>).<br>
Here is an example:<br>
<code><pre>
semifinal class SuperClass {
   protected void m1() { 
   }
   protected void m2() { 
   }
   public void m3() {
   }
}

class SubClass extends SuperClass { 

   // declaration below is valid: same access level (protected)
   protected void m1() { 
   }

   // declaration below is not valid: more accessible (public)
   public void m2() { 
   }

   // declaration below is valid: overriding public method
   public void m3() { 
   }

   // declaration below is valid: new method, but private
   private void myMethod() { 
   }

   // declaration below is not valid: new public method
   public void myExtendedMethod() { 
   }
} 
</pre></code>
To be honest, I never designed a long-lasting API, so I am not sure it makes sense at all - but if you make an analogy to Java EE specification and vendor-specific features, it might...<br>
<br>
Now, if this new modifier is as orthogonal as final, it could be applied to variables and methods as well. In the case of a variable, it means its value must be defined at least once, and at most twice (and not exactly once, as it happens with <code>final</code>). I can see at least two situations where this is helpful:<br>
<br>
<i>1.When there is an optional assignment for an nonexistent value</i> . Example:<br>
<pre><code>
semifinal MyObject o = getMyObject();
if ( o == null ) {
  o = new MyObject();
}
// from this point on, o is final and cannot be changed
</code></pre>
Without <code>semifinal</code>, you have to either create a temporary reference:<br>
<pre><code>
final MyObject tmpObject = getMyObject(); // dirty hack
final MyObject o = tmpObject != null ? tmpObject : new MyObject();
</code></pre>
Or not use <code>final</code> at all:<br>
<pre><code>
MyObject o = getMyObject();
if ( o == null ) {
  o = new MyObject();
}
// o can be changed, as it is not final
</code></pre>
<i>2.Before try/catch blocks:</i>
<pre><code>
semifinal MyObject o = null;
try {
   o = getMyObject(); // getMyObject() throws NastyException, which is checked
   // from this point on, o is final and cannot be changed
} catch( NastyException e ) {
  throw new NastyRuntimeException( "o is a nasty reference. No dessert for it!", e ); 
}
// we must use o from this point on, but it should not be changed
</code></pre>
Again, without semifinal, we have to use the dirty hack or not use final at all:
<pre><code>
MyObject tmpObject = null;
try {
   tmpObject = getMyObject(); // getMyObject() throws NastyException, which is checked
   // from this point on, o is final and cannot be changed
} catch( NastyException e ) {
  throw new NastyRuntimeException( "o is a nasty reference. No dessert for it!", e ); 
}
final MyObject o = tmpObject;
</code></pre>
or<br>
<pre><code>
MyObject o = null;
try {
   o = getMyObject(); // getMyObject() throws NastyException, which is checked
   // from this point on, o is final and cannot be changed
} catch( NastyException e ) {
  throw new NastyRuntimeException( "o is a nasty reference. No desert for it!", e ); 
}
// we must use o from this point on, but it can be changed as it is not final
</code></pre>
<br>
The final (no pun intended) case is the method definition: a <code><b>semifinal</b></code> method means it can be overriden, but at most by the direct subclass (i.e., it cannot be overriden more than once). To be honest, that's the less useful of the three situations (I mean, assuming the other two are any useful at all :-), but it would allow some interesting (not to say weird) possibilities, like this:<br>
<pre><code>
protected abstract semifinal void doIt();
</code></pre>
Such definition means the method <code>doIt()</code> must be overridden by the subclass (as it is abstract), but is final after that (i.e., it cannot be overridden by a subclass of the subclass). It <b>*might*</b> be useful when implementing the <a href="http://en.wikipedia.org/wiki/Template_method_pattern">Template Design Pattern</a>, for instance.<br>
<br>
Anyway, useful or not, that's just one idea I had in a 10-minutes car ride. I have no plans (neither time :-) to implement it, and it might not be as simple as it is described above - there are probably many corner cases to consider (like inner classes and generics), decisions to be made (for instance, it is clear that a subclass of a semifinal class must be defined as semifinal or final; but what about an overridden semifinal method?) and this is not just compiler fun (it might be in the case case of variables, but for methods and classes, that information must be somehow stored in the byteclass). But if someone has the nerves to give it a try, please let me know...
]]>

</content>
</entry>
<entry>
<title>Hello, McFly?</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2007/02/hello_mcfly.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-02-12T23:26:13Z</issued>
<id>tag:weblogs.java.net,2007:/blog/felipeal/87.5274</id>
<created>2007-02-12T23:26:13Z</created>
<summary type="text/plain">I have this blog for a long time - in fact, I think I was one of the first 100 or so webloggers, as I joined it shortly after JavaOne 2003. Still, I haven&apos;t blogged that much (just 22 entries in 41 months), specially last year (only 4 semi-crappy posts). Hopefully, the situation is going to  change, as I will explain in this &apos;meta-blog&apos;...
</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>Community</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[I have this blog for a long time - in fact, I think I was one of the first 100 or so weblogers, as I joined it shortly after JavaOne 2003. Still, I haven't blogged that much (just 22 entries in 41 months), specially last year (only 4 semi-crappy posts).<br>
<br>
There are many reasons for this inactivity, but I guess the main one is lack of time, aggravated by lack of interest. But the good new is, this year I am in an overall better mood, so I  write more frequently. At least, I will try to write about some topics I've been queuing over the months, such as:<br>
<ul>
<li>suggestion for a new (useless :-) Java keyword</li>
<li>an useful Mozilla/Linux tip</li>
<li>rants about Ubuntu</li>
<li>JUnitFactory and its possibilities</li>
<li>nice-to-have Google features</li>
<li>Java EE productivity</li>
<li>Netbean issues</li>
<li>Eclipse improvements</li>
<li>cool Eclipse tips</li>
<li>Cactus and DbUnit 'state of union'</li>
<li>useful annotations usage</li>
<li>JCP, OSS and personal expectations</li>
<li>... and so on</li>
</ul>
<br>
Of course,  the fulfilment of this promise is subject to the conditions of time, mood, and good will - most likely I will procrastinate it, but I will try my best to write about at least the first 4 or 5 items....


]]>

</content>
</entry>
<entry>
<title>Who let the bugs out?</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2006/11/who_let_the_bug_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-11-22T13:00:27Z</issued>
<id>tag:weblogs.java.net,2006:/blog/felipeal/87.6017</id>
<created>2006-11-22T13:00:27Z</created>
<summary type="text/plain">I&apos;m facing an interesting situation using some sort of advanced (read: complex and ugly :-) generic mapping, where my code compiles on Eclipse but fails on Sun&apos;s javac. As I haven&apos;t blogged for a while, I decided to write about it.
Curious? Take a look in the code below...</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>J2SE</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[So, here is the deal. I've created a generic DAO class that looks like the following:<br>
<br>
<code><pre>
package net.felipeal;

import java.util.ArrayList;

public abstract class DAO&lt;EntityInterface, EntityImpl extends EntityInterface> {
  
  private final Class&lt;EntityImpl&gt; entityClass;
  
  public DAO( final Class&lt;EntityImpl&gt; clazz ) {
    this.entityClass = clazz;
  }

  public List&lt;EntityInterface&gt; getEntities() {
    return getObjects(this.entityClass);
   }

  public &lt;TInterface, TImpl extends TInterface&gt; List&lt;TInterface&gt; getObjects(Class&lt;TImpl&gt; clazz) {
    return new ArrayList&lt;TInterface&gt;();
  }

}
</pre></code>

The motivation behind this class is that the sub-classes will have the getEntities() method that would return all entities managed by the DAO, and still have the getObjects() method for other entities. So, for instance, I could have something like:<br>
<br>

<code><pre>
package net.felipeal;

import java.util.List;

public class ProductDAO extends DAO&lt;Product, ProductImpl&gt; {

  public ProductDAO {
    super(ProductImpl.class);
  }
  
  public static void main(String[] args) {
    final ProductDAO dao = new ProductDAO();
    final List&lt;Product&gt; products = dao.getEntities();
    final List&lt;Customer&gt; customers = dao.getObjects(CustomerImpl.class);
  }

}
</pre></code>
<br>
The code above works on Eclipse 3.2, but when I try to compile it with javac 1.5.0_09, it fails:<br>
<br>
<code><pre>
[felipeal@localhost src]$ javac net/felipeal/DAO.java
net/felipeal/DAO.java:15: incompatible types
found   : java.util.List<EntityImpl>
required: java.util.List<EntityInterface>
    return getObjects(this.entityClass);
                     ^
1 error
</pre></code>
<br>
So, looks like one of the two compilers is wrong: either javac should compile that code or (most likely) eclipse should have failed.<br>
<br>
I tried a small variation that fails on Eclipse as well:<br>
<br>
<code><pre>
package net.felipeal;

import java.util.ArrayList;
import java.util.List;

public class DAO&lt;EntityInterface, EntityImpl extends EntityInterface&gt; {
  
  private final Class&lt;EntityImpl&gt; entityClass;
  
  public DAO( final Class&lt;EntityImpl&gt; clazz ) {
    this.entityClass = clazz;
  }

  public List&lt;EntityInterface&gt; getEntities() {
    final List&lt;EntityInterface&gt; list =  getObjects(this.entityClass);
    return list;
   }

  public &lt;TInterface&gt; List&lt;TInterface&gt; getObjects(Class&lt;? extends TInterface&gt; clazz) {
    return new ArrayList&lt;TInterface&gt;();
  }

}
</pre></code>

In this class, Eclipse gives a similar error:<br>

<pre><code>
Type mismatch: cannot convert from List<EntityImpl> to List<EntityInterface>  bug-generics/src/net/felipeal DAOB.java line 15
</code></pre>
<br>
That makes sense, as I'm using a wildcard and so there is no way to force the returned collection to be an interface implemented by the parameterized argument.<br>
<br>
Any clue of what's wrong (with the code, not with the design itself, please :-)? As I'm not a generics expert, I'd like to hear some comments before opening an (possibly invalid) bug on BugParade or Eclipse...
<br>]]>

</content>
</entry>
<entry>
<title>The name is bound, Java EE bound</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2006/07/the_name_is_bou.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-08-01T02:53:46Z</issued>
<id>tag:weblogs.java.net,2006:/blog/felipeal/87.5281</id>
<created>2006-08-01T02:53:46Z</created>
<summary type="text/plain"><![CDATA[The previous weblog says 
JEE is The Official Acronym for Java Enterprise Edition. That's not true - the new name for the &lt;img alt="technology formerly known as J2EE"&gt; is -  and always have been - Java EE. If you don't believe me (after all, I'm not a Sun employee :-(, keep reading...]]></summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[The previous weblog says <a href="http://weblogs.java.net/blog/marinasum/archive/2006/07/jee_the_officia.html">
JEE is The Official Acronym for Java Enterprise Edition</a>. That's not true - the new name for the <i>&lt;img alt="technology formerly known as J2EE"&gt;</i> is - and always have been - <b>Java EE</b>.<br>
<br>
If you don't believe me (after all, I'm not a Sun employee :-(, read the following message, sent to all SMI licensess (I'm such a licensee because I was awarded a <a href="http://java.sun.com/scholarship/">TCK Scholarship</a> a couple of years ago) last month:<br>
<br>
<i>
<pre>
---------- Forwarded message ----------
From: SMI-JavaLicenseeEngineering 
Date: Jun 23, 2006 1:31 PM
Subject: Java Platform Naming Convention
To: SMI-JavaLicenseeEngineering 



Back in 2005, Sun Microsystems announced a new Java naming convention,
whereby future versions of the platform would be called
“Java EE 5,” “Java SE 6," and “Java ME.”

However, over the last year we have noticed that a few members of the
Java community are using “JEE” and "JME," rather than
“Java EE” and Java ME." Unfortunately "JEE" has different meanings that
are not associated with Java technology. For example, a Google search on
"JEE" returns topics unrelated to Java EE.

We'd like to encourage you to spell out “Java” - i.e. Java EE, Java SE,
and Java ME – especially in external communications, such as websites
and blogs.

Please take a few minutes to understand the reasons for the new naming
schema, which are spelled out in this article.

http://java.sun.com/developer/technicalArticles/javaone2005/naming.html

Also, take advantage of the resources available, including the FAQs, and
the 1-pager with the naming guidelines at the bottom of the page.

Additional resources: Graham Hamilton's Blog:
http://weblogs.java.net/blog/kgh/archive/2005/06/goodbye_j2se_he_1.html

Thank you, Java community, for your support! Use the Java name and keep
growing your momentum.
</pre>
</i>
So, if you are convinced now, please do your part and spread the word (I hope I have done mine :-).<br>
<br>
My 2 rants,<br>
<br>
-- Leme, Felipe Leme<br>
<br>
<b>PS:</b> the above message is reproduced here with proper authorization...]]>

</content>
</entry>
<entry>
<title>The rise and fall of the application server as product (A.K.A. app server commoditization)</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2006/06/the_rise_and_fa.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-06-16T22:37:57Z</issued>
<id>tag:weblogs.java.net,2006:/blog/felipeal/87.5044</id>
<created>2006-06-16T22:37:57Z</created>
<summary type="text/plain">Much has been talked about the commoditization of the Java EE application server, specially now that many open-source servers are available. In this blog, I show one evidence that supports that claim...</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[Much has been talked about the commoditization of the Java EE application server, specially now that 2 servers (Sun's Glassfish and Apache's Geronimo) are available under 'unrestricted' open-source licenses (JBoss and JOnAS are also open-source software and have been out there for more time, but they are licensed thorugh LGPL, and therefore cannot be modified unless the modifications are also made available as OSS).<br>
<br>
So, is the commoditization of the application server a true trend or just a speculation?<br>
<br>
Well, given the number of certified servers over the Java EE versions, looks like the trend is true:<br>
<br>
<ul>
<li>J2EE 1.2 (from <a href="http://java.sun.com/j2ee/1.2_compatibility.html">
http://java.sun.com/j2ee/1.2_compatibility.html</a>):<br>
<br>
18 companies licensed 20 implementations
<li>J2EE 1.3 (from <a href="http://java.sun.com/j2ee/compatibility_1.3.html">
http://java.sun.com/j2ee/compatibility_1.3.html</a>):<br>
<br>
21 companies licensed 29 implementations

<li>J2EE 1.4 (from <a href="http://java.sun.com/j2ee/compatibility_1.4.html">
http://java.sun.com/j2ee/compatibility_1.4.html</a>):<br>
<br>
13 companies/organizations* licensed 13 implementations<br>
<br>
<i><b>*</b>This release had several open-source implementations delivered by non-profit organizations (such as Apache Software Foundation).</i><br>

<li>JavaEE 5 (from <a href="http://java.sun.com/javaee/overview/compatibility.jsp">
http://java.sun.com/javaee/overview/compatibility.jsp</a>):<br>
<br>
2 companies licensed 2 implementations
</ul>
<br>
<br>
So, we had a rise up to J2EE 1.3 and a fall afterwards, with only 13 J2EE 1.4 and so far only 2 Java EE 5 application servers available (even though Glassfish - the Reference Implementation - was developed under the <a href="http://opensource.org">OSI</a>-approved <a href="http://sun.com/cddl/">CDDL license</a>).<br>
<br>
I know it's too early to analyze the JavaEE 5 arena (I'm sure JBoss, IBM and WebLogic will come with their implementation as well), but the J2EE 1.4 numbers show the trend is true: the <a href="http://jcp.org/en/jsr/detail?id=151">JSR-151</a> specifiation has been out there for almost 3 years and the total number of servers available is less than 50% of its predecessor, J2EE 1.3 - not to mention that many servers took years to be ready.]]>

</content>
</entry>
<entry>
<title>Installing Netbeans 5.5 &quot;some large Sun-style name for stuff that changes name on each release&quot; Preview on Mac OS X</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2006/03/installing_netb_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-03-09T05:36:15Z</issued>
<id>tag:weblogs.java.net,2006:/blog/felipeal/87.4279</id>
<created>2006-03-09T05:36:15Z</created>
<summary type="text/plain">After struggling for a desnecessary while (and they said Mac OS X is the better platform for Java developers...) I&apos;ve figured out how to install NetBeans 5.5 Enterprise Preview on Mac OS X...</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>Community: Mac Java Community</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[<h1>Intro</h1>
I'm writing the web services material for <a href="https://globalcode.dev.java.net">Globalcode</a>'s brand new course on Java Enterprise development, so I decided to give NetBeans 5.5 Preview/Glassfish a try (after all, WS with annotations is one of the ease-of-development promisses of Java EE 5).<br>
<br>
Currently, I have 2 systems: a Pentium III Linux desktop and a G4 Powerbook; I'm trying to use the Powerbook as primary development machine, so I went to NetBeans' site but for my (not so) surprise, there was no Mac OS X version (as there is no Mustang build as well...); OTOH, the release notes (http://www.netbeans.org/community/releases/55/relnotes.html) said:<br>
<pre>
NetBeans Enterprise Pack is also known to run on the following platforms:

*some unmentionable OS*
Solaris™ 8 OS (SPARC and x86/x64 Platform Edition) and Solaris 9 OS (SPARC and x86/x64 Platform Edition)
Mac OS X 10.4
Various other Linux distributions
</pre>
<h1>The problem and its solution</h1>
Well, when something is 'also know to run' on something not supported and the Release Notes doesn't say how, you gotta feel lucky. So, googling for it, I found a <a href="http://jole.fi/?p=11">blog</a> where the guy managed to extract the files from the Linux version, but got a NoClassDefFoundError exception when running the script; I followed the same steps, got the same error and so decided to figure it out how to do it...<br>
<br>
So, after changing the shell scripts (putting an echo here and an exit there), I found the problem: all the jars were not there as .jar, but saved as xxx.unpack.jar.gz. My first reaction was to google for unpack.jar.gz, but no lucky feelings this time. Fortunately though, thanks to G(nu)od, I typed 'unpack' + TAB, and realized there was an 'unpack200' on my path (which I then realized is a Sun's utility to handle the new JAR format, defined in some JSR and included on Tiger).<br>
<br>
After a few more minutes of shell scripting (hint to whoever is responsible to the unpack tool: it should optionally take just one file as input and extract the jar names as input-pack.gz...), I came to the solution:<br>
<pre>
for i in `find . -name *.pack.gz|xargs`; 
do 
  unpack200 $i `echo $i | sed ’s/\(.*\).pack.gz/\1/g’`; 
done
</pre>
<br>
Once you run that for command, you're done - all you have to do is running netbeans from the bin directory.<br>
<br>
<h1>Final thoughts</h1>
* After spending about 2.5 hours solving a problem that I shouldn't and blogging about it, I got the application running (and the delivery of the web services material 1 day delayed, as it's past 2AM now and I won't be able to test it - I can barely write the blog in a decent English... :-(<br>
<br>
* This is not the first issue I had with Java/Mac OS since I bought my Powerbook (on last year's JavaOne) - I had trouble running almost any Java application (mevenide, maven continuum, some eclipse plugins and others that I don't remember), not to mention stuff that takes a while to be supported (like Tigger, NetBeans Profiler and Mustang).<br>
<br>
* There's been a lot propaganda (not only by companies, but also from developers) that Mac is the perfect Java development platform, but I have to disagree, due to all these issues. Some people blame Apple, others Sun, others Eclipse or whatever project, but I - as developer - don't care: I think these companies (specially Apple) are missing a window of opportunity here (I wouldn't be surprised if someone created a 'switch' page relating stories of people migrating from Mac OS to Linux - there's been some blogs about it here at java.net already, but I'm too sleepy to search them for a link).<br>
<br>
* Sorry for the sarcasm, but I should really being sleeping (after doing some real work on the material :-( by now...<br>
<br>
* No <a href="http://www.jroller.com/page/fate">Hani</a>, I don't <a href="http://www.jroller.com/page/fate/?anchor=to_sun_java_net_is">work for NetBeans neither Glassfish</a> (not that I wouldn't like to...)<br>
<br>
* And finally: did I mention Mustang is not available on Mac OS X yet?<br>
<br>
-- Felipe]]>

</content>
</entry>
<entry>
<title>Things to do in San Francisco when your schedule is dead</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2005/06/things_to_do_in.html" />
<modified>2008-01-02T17:42:16Z</modified>
<issued>2005-06-24T00:14:12Z</issued>
<id>tag:weblogs.java.net,2005:/blog/felipeal/87.2647</id>
<created>2005-06-24T00:14:12Z</created>
<summary type="text/plain">In a few hours I&apos;m leaving Sao Paulo headed to San Francisco, for the JavaOne conference.

As I have to wait for the departure time, I&apos;m blogging about some things I&apos;m probably doing in the conference.</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[I'm going to the JavaOne conference for the 3rd consecutive year and this year I'm planning to write more about it (on blogs or even articles).<br>
<br>
In fact, I've seen many blogs and forum posts where people complain about the conference not being as cool as before, because it's more marketing than geek, etc.<br>
<br>
I can't say it was worse than before, but considering my experience in the last 2 years, I still think the conference is worth going, at least for the following reasons:<br>
<ul>
  <li>networking: that's more important than the technical side</li>
  <li>partying: there is no better way to network than drinking a beer or playing pool :-)</li>
  <li>tourism: it's always nice to visit another country, specially one where you lived before</li>
  <li>marketing: the marketing is not really that evil and you can get good swag at the conference, mainly books and t-shirts.
  <li>sessions and BOFs: sure, they're important also...
</ul>
<br>
So, considering those aspects (no pun intended), here are a few things I'm probably doing over there:<br>
<ul>
  <li>watch Batman Begins at IMAX - IMAX is awesome and we don't have it in Brazil, so it's mandatory to watch whatever is showing there (although I didn't watch Harry Potter last year). Besides, Christopher Nolan is a good director and the cast is first class.</li>
  <li>watch Episode III again - I haven't watched it for the second time yet because I was hoping IMAX was showing it...</li>
  <li>go to the Borland party - I missed most of the party in the last 2 years because of BOFs (last year, for instance, my BOF was at the same day and from 10:30-11:30). This year I checked the schedule and I'm good to go.
  <li>go to other Java parties as well - there are so many this year is hard to remember all: Communities, Maven/JuG, JXTA, Sun Certified, JBoss, Pavillion, etc. I even got accidently invited to a JavaOne Wireless & Entertainment Summit Dinner...</li>
  <li>Broadway night live - well, the conference is not the only places where you can party...</li>
  <li>drink different beers - I really enjoy the variety of beers available in California: Guiness, Sierra Nevada, Stella Anchor (?), Pyramid, etc... It's hard to find these beers in Brazil and even when you find then, they're expensive</li>
  <li>eat Thai and Indian food - they're also rare/expensive here</li>
  <li>go to "The House of the Nanking" - that's a classic Chinese restaurant (although my Chinese friends don't like it too much)</li>
  <li>meet old friends and make new ones - as I said, networking is one of the main reasons the conference is worth your grants</li>
  <li>play "The Creature from the Black Lagoon" - that's a classic pinball and I used to play it daily when I worked in a startup in the Valley. Since I left the company, I have never found that machine again, until last year's conference. I don't need to say I had spent a whole morning playing it...</li>
  <li>get an Eclipse T-Shirt on the Treasure Hunt - that's as classic as spinning the wheel</li>
  <li>watch the parade - last year I didn't plan to, but had to cross market on my way to the JCP Licensee day. This year it's going to happen the same, as there is a Netbeans day on Sunday. But in the end, the parade is fun.</li>
  <li>visit the Fisherman's Wharf - that's the ideal place to have dinner after the conference is over.</li>
  <li>buy a pre-paid mobile card - it's good to be reachable, specially with so many parties to go!</li> 
  <li>take a picture with Duke - my son loves it</li>
  <li>write about the conference - I did an article for Java Magazine in 2003, but last year I wasn't in the mood. This year is going to be different and I'm planning to blog/write about the conference daily (well, this blog is already a good start :-)</li>
  <li>watch a handful of sessions - every year it's the same drill: I spend hours selecting dozens of sessions to fulfill my whole schedule, but in the end I watch just a couple or two, expending most of the time in the pavillion (or playing the Creature :-)</li>
  <li>win a Java jacket - well, that's something I haven't controll of, but I'm confident I will get one at the spinning wheel or in a raffle :-)</li>
</ul>
Well, the list could go on and on, but it's time to catch the flight.<br>
<br>
See you there...<br>]]>

</content>
</entry>
<entry>
<title>SOIA - Specfiy Once, Implement Anywhere</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2005/06/soia_specfiy_on.html" />
<modified>2008-01-02T17:42:16Z</modified>
<issued>2005-06-23T14:36:53Z</issued>
<id>tag:weblogs.java.net,2005:/blog/felipeal/87.2638</id>
<created>2005-06-23T14:36:53Z</created>
<summary type="text/plain">Have you ever wondered how hard it is to switch the implementation for a JCP-based technology? Here is my recent experience on the JSF arena...</summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>Community: Java Specification Requests</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[Have you ever wondered how hard would it be to switch the implementation for a JCP-based technology? Theoretically, it should be easy as changing the skin of your MP3 player. Unfortunately, that has not being the case for most of the J2EE technologies, specially EJBs.<br>
<br>Last Monday I finished the JSF port of the application we are usign for our <a href="https://www28.cplan.com/javaone05_sb_93_1/session_details.jsp?isid=271535">BOF</a> at JavaOne. Our originally plan was to port an existing webapp to different MVC frameworks, including JSF RI and MyFaces. As the clock was ticking (our presentation is a week away and we are departuring today) and I hadn't even finished the JSF RI version, we pratically gave up the MyFaces port.<br>
<br>
Anyway, last night I decided to give it a try while watching a soccer game (that's one of the best uses of a laptop system :-). And how wasn't my surprise to finish the job just before the half time (and that becuase most of time was spent downloading the software!): all that it took to switch RI for MyFaces was to add a few lines on web.xml and replace half a dozen jars!<br>
<br>
That's right: no changes on JSPs, backing-beans or even faces-config.xml; just add a listener on the deployment descriptor (and replace the jars, of course) and you're done!br>
<br>
Still don't believe me? Well, take a look on the <code>diff</code> between the 2 projects then:<br>
<br>
<code>
<pre>
[felipeal@localhost webapps]$ diff -r jsf-project myfaces-project
Only in myfaces-project/WEB-INF/lib: commons-el.jar
Only in myfaces-project/WEB-INF/lib: commons-validator.jar
Only in myfaces-project/WEB-INF/lib: myfaces.jar
Only in jsf-project/WEB-INF/lib: jsf-api.jar
Only in jsf-project/WEB-INF/lib: jsf-impl.jar
Only in jsf-project/WEB-INF/lib: jstl.jar
Only in jsf-project/WEB-INF/lib: standard.jar
diff -r jsf-project/WEB-INF/web.xml myfaces-project/WEB-INF/web.xml
27a28,33
><!-- Listener, that does all the startup work (configuration, init). -->
><listener>
>  <listener-class>
>    org.apache.myfaces.webapp.StartupServletContextListener
>  </listener-class>
></listener>
</pre>
</code>
<br>
Of course, we have to take in account that our application was very simple: just 3 JSP pages and 2 backing beans. Still, the transition from one implementation to another was very smooth, much more than we predicted.]]>

</content>
</entry>
<entry>
<title>A friendly warning about JavaOne submissions</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/felipeal/archive/2005/01/a_friendly_warn.html" />
<modified>2008-01-02T17:42:16Z</modified>
<issued>2005-01-08T15:02:29Z</issued>
<id>tag:weblogs.java.net,2005:/blog/felipeal/87.1912</id>
<created>2005-01-08T15:02:29Z</created>
<summary type="text/plain">Beware of the dog, I mean the button - this year the system has changed and once you click &quot;Submit - Finalize&quot; your submission is final. </summary>
<author>
<name>felipeal</name>

<email>weblogs@felipeal.net</email>
</author>
<dc:subject>JavaOne</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/felipeal/">
<![CDATA[As I (and many others) have mentioned earlier, <a href="http://weblogs.java.net/blog/felipeal/archive/2004/12/calling_for_jav.html">the JavaOne call for papers is open</a>.<br>
<br>
But beware of the dog, I mean the submit button - this year the system has changed and once you click "Submit - Finalize" your submission is final.<br>
<br>
Although this seems obvious for a "newbie" submitter, it is not for people that have submitted proposals in the previous years, as the old system allowed you to edit the submissions. In fact, you never actually finalized a submission, you could edit it until the last day. So I think they changed the system to speed up the selection process - once the submission is finalized, the Program Comittee could start evaluating it, without waiting for the final day.<br>
<br>
I personally preferred the old system, specially when you have co-speakers and/or peers helping to review your submission. So, if you like this approach too, be careful and do these steps externally to the system, <b>*before*</b> submitting your proposal - once they're submitted, they're done.<bre>]]>

</content>
</entry>

</feed>