Chariot Training Classes

Training Courses

I run Chariot's training and mentoring services. We provide training in AngularJS, HTML5, Spring, Hibernate, Maven, Scala, and more.

Chariot Education Services

Technology

Chariot Emerging Tech

Learn about upcoming technologies and trends from my colleagues at Chariot Solutions.

Resources

Chariot Conferences

Podcasts

Entries in chariot-news (45)

Tuesday
Apr192011

It's a comin' - Philly Emerging Tech

Yep, it's about that time.  The Philly ETE conference (as we like to call it on the twitter) is fast approaching.  We are all eagerly awaiting the results of our latest Frankenstein.  Or is it Frank Stein? 

Anyhoo, we have some fresh techcasts - last week we released an interview with Johanna Rothman, famed project management guru and author of ManageIt! and Manage your Project Portfolio, among other titles.  Today I released an interview with Brendan McAdams of 10Gen, the company behind Mongo DB, talking about Mongo 1.8 and the MongoPhilly conference, which is happening the day before ETE in the Sheraton Old City (same venue).

Later this week, we'll have an interview with the creator of the Javascript behavior-driven testing framework Jasmine, Davis Frank.  He was a great interview and a lot of fun to chat with.  He'll be giving a Practical Jasmine talk, and tells us it will be a good 10 minute introduction, but then 35 minutes of practical advice in writing Jasmine tests.  You may want to brush up on Jasmine with this demo talk, and also here is a 57 minute standup talk video from Davis at SFSE.  Read up, be ready, and learn a LOT of useful tips from this session.

We'll be having more content than ever coming back from ETE this year.  We've been working with a videographer who will be recording all of the sessions in Salon C, both with audio and video, and I've just secured a deal with the makers of ScreenFlow to use up to 24 licenses during the conference for anybody who presents using a Mac, so we can have screencasts of other presentations.  It should prove to be a great time.

I'll be there, both sitting at the training table and presenting my Roo talk.  Roo 1.1.3 has really begun to mature, and playing with the recently released version I'm very happy - I think it will be a great working session.

Anyway, I hope to see you all there at ETE, and I'll be bringing my handheld recorder around, so if you want to talk about anything ETE related, please speak into the mic!

Best,

Ken

 

Tuesday
Mar152011

Build a better Roo exception page

Ok, Roo fans. This is a quick post, in response to a forum post on the Manning Roo in Action forum. Wanna get Root Causes in your exceptions page? Do this!

Build an Exception Resolver

Start by building a class that extends SimpleMappingExceptionResolver. This example uses the Apache commons-lang utility class, ExceptionUtils, to get the root cause exception and push it to the page. I suspect I may need to check for nulls here so if you get a chance to debug this before me, post a message and I'll update the blog post:

public class FullTraceMappingExceptionResolver extends
  SimpleMappingExceptionResolver {

  @Override
  protected ModelAndView getModelAndView(String viewName, Exception ex) {
    ModelAndView modelAndView =  super.getModelAndView(viewName, ex);
    String stackTrace = ExceptionUtils.getFullStackTrace(ExceptionUtils.getRootCause(ex));
    modelAndView.addObject("rootCause", stackTrace);
    return modelAndView;
  }
}

Add commons-lang 2.5

Add this to your pom.xml file, in the dependencies section... A Roo shell command can do this for you, but here is the fragment:

<dependency>
  <groupId>commons-lang</groupId>
  <artifactId>commons-lang</artifactId>
  <version>2.5</version>
</dependency>

Install it!

Next, install it in the webmvc-config.xml file, by replacing the mounted class SimpleMappingExceptionResolver with the FullTraceMappingExceptionResolver.  Just swap the value in the class property below and leave the rest alone:

<bean class="package.path.to.FullTraceMappingExceptionResolver"
           p:defaultErrorView="uncaughtException">
  <property name="exceptionMappings">
    <props>
      <prop key=".DataAccessException">dataAccessFailure</prop>
      <prop key=".NoSuchRequestHandlingMethodException">resourceNotFound</prop>
      <prop key=".TypeMismatchException">resourceNotFound</prop>
      <prop key=".MissingServletRequestParameterException">resourceNotFound</prop>
    </props>
  </property>
</bean>

Modify unhandledException.jspx

Ok, the final step - just add the unhandled exception to the jspx for the uncaught exceptions, WEB-INF/views/uncaughtException.jspx:

<c:if test="${not empty rootCause}">
  <util:panel id="_fullStackTrace" 
        title="Full Stack Trace" openPane="false">
    <h4>Full Stack Trace</h4>
    <br/>
    <div style="overflow: auto;" 
         dojoType="dijit.layout.ContentPane">
      <pre><c:out value="${rootCause}"/></pre>
    </div>          
  </util:panel>
</c:if>

Want more Roo in Action goodness? Subscribe to the MEAP!

Monday
Feb282011

Adding deeper logging to Webflow Exceptions

If you've been using Roo and the JSPX views with WebFlow, you've probably noticed that you don't get the embedded stack trace in the errors that result.  You can fix this with a lifecycle listener:

First, define the class:

package mypackage;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.webflow.execution.FlowExecutionException;
import org.springframework.webflow.execution.FlowExecutionListenerAdapter;
import org.springframework.webflow.execution.RequestContext;

public class LoggingFlowExecutionListener extends FlowExecutionListenerAdapter {
  Logger logger = LoggerFactory.getLogger(getClass());
  @Override
  public void exceptionThrown(RequestContext context,
    FlowExecutionException exception) {	
    super.exceptionThrown(context, exception);
    logger.error("Webflow " + context.getActiveFlow().getId() + 
          " threw exception in " + context.getCurrentState().getId(), exception);
    }
}

Then, in webflow-config.xml, replace

  &lt;webflow:flow-executor id="flowExecutor" /&gt;

with

&lt;webflow:flow-executor id="flowExecutor"&gt;
   &lt;webflow:flow-execution-listeners&gt;
     &lt;webflow:listener ref="loggingListener"/&gt;
   &lt;/webflow:flow-execution-listeners&gt;
&lt;/webflow:flow-executor&gt;

&lt;bean class="mypackage.LoggingFlowExecutionListener" id="loggingListener" /&gt;

 

Now you can enjoy useful logging from your Webflow exceptions.

Monday
Jan242011

Bug fix in 1 day?? WOW, ROO TEAM!

I wanted to give a shout out to the Roo dev team.  I put a feature request in to JIRA last week while I was working on good JUnit examples for Roo in Action, chapter 3.  I wanted to make sure the persistence context was cleared between persisting data and re-loading it, so that we could force the SQL statements to be called.  I had written that I'd like a entityName.clear() method, to match the entityName.flush() method.  

Literally ONE day later, Alan Stewart had the code for ROO-1989 added and committed to trunk.  I immediately updated the chapter document to add that feature to the list, and modified my test code.  WOW!

 

Saturday
Nov202010

Roo Flex add-on is ALIVE!

It's always good to ask.  The Roo Flex add-on had been incompatible with Roo 1.1.0, and I've been working on the rich web chapter.  I had checked in with Jeremy Grelle, the lead on the Spring Flex Integration framework, and he let me know that he got everything going again with a recent snapshot.

If you'd like to play with the Roo Flex integration libraries before they come out in mid-December, here's what you need to do:

Download it!

Download the latest snapshot jar for the add-on here (can't guarantee that it will work the same way for you, but the one 11/20 worked fine for me).

Install the JAR

Put the add-on JAR in the roo-1.1.0/bundle directory

Install the snapshot repository

Edit your project's <repositories> section and add:


  spring-snapshot
  Spring Portfolio Snapshot Repository
  http://maven.springframework.org/snapshot
  
    false
  
  
    true
  

You have to do this for now, because the Blaze DS 4.0 integration libraries aren't checked in to a final repository.

Install it in your project

Now, just use the flex setup command to install the Flex scaffolding engine. When you want to build a scaffold, experiment with the flex remoting command to generate a scaffold View class for your Scaffold, such as:

flex remoting all --package ~.model

Running it

Just use mvn package jetty:run-exploded to kick off your application (Tomcat is fine but I am partial to Jetty for embedded maven runs). When the server starts, make sure to hit http://localhost:8080/appname/appname_scaffold.html to view your scaffolded UI.

Page 1 ... 2 3 4 5 6 ... 9 Next 5 Entries ยป