Archive for January, 2011

January 30, 2011

ClassNotFoundException: org.objectweb.asm.ClassVisitor

by Jay Jonas

Yes! I’m a Jetty Server and Vaadin newbie. But that was a pain try to run Address Book Demo Vaadin tutorial with EclipseLink JPA 2.0 support. I tried with Jetty 7 and Jetty 8 and got all sort of errors using Eclipse WTP. I tested so many configurations and I restarted from ground zero many many times without any success.

Frustrated I installed Apache Tomcat 7 server and automagically all worked as expected on the first strike.

But I really like Jetty and I will give it a new try as soon as I solve this error:

2011-01-30 01:09:50.590:WARN::Unable to reach node goal: started
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
 at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(
 at org.eclipse.jetty.webapp.WebAppContext.configure(
 at org.eclipse.jetty.webapp.WebAppContext.startContext(
 at org.eclipse.jetty.server.handler.ContextHandler.doStart(
 at org.eclipse.jetty.webapp.WebAppContext.doStart(
 at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
 at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(
 at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(
 at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(
 at org.eclipse.jetty.deploy.DeploymentManager.addApp(
 at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(
 at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(
 at org.eclipse.jetty.util.Scanner.reportAddition(
 at org.eclipse.jetty.util.Scanner.reportDifferences(
 at org.eclipse.jetty.util.Scanner.scan(
 at org.eclipse.jetty.util.Scanner.start(
 at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(
 at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
 at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(
 at org.eclipse.jetty.deploy.DeploymentManager.doStart(
 at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
 at org.eclipse.jetty.server.Server.doStart(
 at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
 at org.eclipse.jetty.xml.XmlConfiguration$
 at Method)
 at org.eclipse.jetty.xml.XmlConfiguration.main(
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.eclipse.jetty.start.Main.invokeMain(
 at org.eclipse.jetty.start.Main.start(
 at org.eclipse.jetty.start.Main.parseCommandLine(
 at org.eclipse.jetty.start.Main.main(

[Updated: 20111013 | from the Juuso Backman’s comment. Thanks, Juuso!]

The problem was that Eclipse hadn’t added all the necessary .jars into the Jetty classpath.

The jars can be added to the classpath for Jetty via Eclipse like so:

  • Open the Servers view
  • Open your server’s config (right-click -> Open, or F3)
  • On the Overview tab, click “Open launch configuration”
  • Classpath tab -> add external jars

// Adding JPA based persistence to the Address Book Demo

January 26, 2011

ClassNotFoundException: org.mortbay.start.Main

by Jay Jonas

I was trying to set up Eclipse to run and deploy my projects to a Jetty 7 server. I have downloaded it and unpacked it, and I  installed the Jetty plugin from the available server adapters list, but when I try to configure a new Jetty server, the server type list only contains “Jetty 6”. If I use this and point it at my server runtime, when I try to start it I get the following error:

java.lang.NoClassDefFoundError: org/mortbay/start/Main
Caused by: java.lang.ClassNotFoundException: org.mortbay.start.Main
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main"

The problem is that the package name changed with the migration from Codehaus to Eclipse. So, we need a new WTP Adaptor for Jetty 7.x/Jetty 8.x that can be downloaded from the update sites as follows:

To install the WTP Adaptor, complete the following steps.

  1. Open Eclipse.
  2. In the taskbar at the top of your screen, click Help -> Install New Software. The Available Software dialog box opens.
  3. In the Work with: field, type one of the URLs provided above.
  4. Press Return.
  5. In the Name/Version box below, select the box for Jetty WTP Adaptor Site.
  6. Click Next.
  7. The Install Details dialog box opens.
  8. Click Next again.
  9. The Review Licenses dialog box opens.
  10. Accept the terms and click Finish.
  11. The Installing Software dialog box opens, displaying progress for installing the WTP adaptor. When it completes, the Software Updates dialog box opens with a message that you need to restart Eclipse to complete the installation.
  12. Click Restart Now.

Next step will be create a Jetty WTP Server.  Stay tuned as I will show it in the next post.

Tags: , ,
January 25, 2011

The real Adapter Design Pattern

by Jay Jonas

The Brazilian authorities have recently adapted a new standard for plugs and outlets and they chose a new standard incompatible with the existing Brazilian outlets and with the standards of the rest of the world.

The new outlet looks like the one on the image at the end of this post. It has three round holes.  Plugs with two round holes (like the ones found in some European countries) will work when inserted in the new outlet and they can have either two or three pins (for grounded plugs).

Brazilian outlet: NBR14136-2002 standard.

Brazilian plug: new NBR14136-2002 standard.

But Brazilians developers always can use the Adapter Design Pattern from GoF to plug in their notebooks.  Do not try this at home, childrens!

// Photos from

January 20, 2011

Splash Screen of the Day: Eclipse 1.0

by Jay Jonas
Eclipse 1.0

Eclipse 1.0 Splash Screen - version 1.0

Released at November 7, 2001.  (c) Copyright IBM Corp. 2000, 2001. All Rights Reserved. It can be downloaded in Eclipse Foundation following this link here.

January 19, 2011

PDE build: Bundle failed to resolve

by Jay Jonas

When exporting a feature, or a product based on features you get an error like:

Processing inclusion from feature <your feature here>: Bundle <version here> failed to resolve.:

This is caused by a missing window system/operating system/architecture filter on the fragment’s inclusion in the feature.xml. This can easily be set in the Plug-ins Tab of the feature editor by selecting the fragment on the left and specifying the Operating System, Window System and Architecture on the right.

Plugins and Fragments

Plugin details in Plugins and Fragments editor

Quoted from Eclipse PDE Build FAQ.

January 19, 2011

Animation by GoogleDocs

by Jay Jonas

You are bored with Powerpoint presentations? Try Google Docs and take chances to be nominated for next Oscar for best animated film.  Three animators (Tu+, Namroc and Metcalf), three days, three locations and 450 slides after,  simply made the animation “Google Demo Slam: Epic Docs Animation” .

Watch the demo:

Wait a little for it to load  and see the presentation right from Google Docs: |

Just impressive!

January 19, 2011

SQuirreL SQL Client

by Jay Jonas

As a developer I’m always wondering how much time I’ve got connect to databases and interacting with way more them then I’d prefer. My tool for these moments is SQuirreL, a Universal SQL Client.

SQuirreL SQL Client is a program written in Java that allows me to view the contents of a database, execute SQL commands and perform a number of other functions. The list of supported JDBC-compliant databases is so impressive:

SQuirreL’s default language is English and the contributors has added translation packages for several others. With a plugin architecture, new functionalities are released to each new version. Did I mention it is Hibernate HQL supported too? Does not matter what database I will be connected, this simple front end open source application makes my day a bit more easier.

[repost from my old blog]

January 17, 2011

Eclipse: Import cannot be resolved

by Jay Jonas

Eclipse suddenly, and everyone is against you (or some) of its import are displaying the error message:

 import MyClassName cannot be resolved.

Do not panic yet. Before, you could try the following tips:

  • Clean Project command is your friend: go to Project > Clean menu.
  • If using Ant or Maven, use – clean option to clean your builds.
  • Refresh your project folder:  right click on your project folder  and click Refresh command.
  • Re-build your project.
  • Create a new Workspace and Import your project there.
  • ‘Switch’ Workspace – go to other Workspace the return back.
  • Double-check your JRE. Remove and re-add as follows:
  1. right click on your Project and click on  Properties from context menu;
  2. click on the Libraries tab;
  3. next, click on the JRE;
  4. click Remove, then OK;
  5. repeat 1-3 again, but this time add the JRE.
  • Finally, if your Target Plataform is divided into components in various folders, double check for duplicate plugins, ie plugins with same ID and version. If find one, remove it  mercilessly.

The tips can be followed in the order you prefer because not have a specific order and can work or not. Do not blame me if not. And make a backup before start.

January 15, 2011

How do you pronounce Ubuntu, Pooh?

by Jay Jonas

Quoted from the About Ubuntu page:

ubuntu |oǒ’boǒntoō|

Ubuntu is an ancient African word meaning ‘humanity to others’. It also means ‘I am what I am because of who we all are’. The Ubuntu operating system brings the spirit of Ubuntu to the world of computers.

But how do you pronounce Ubuntu?

Forvo is a the largest  pronunciation guide in the world and there you can hear the word Ubuntu pronounced. Click on the link as following:

Could you do it better?

// audio source: thanks to
Tags: , ,
January 14, 2011

Dishonest Programming

by Jay Jonas

David Brady, from Javalobby News, their weekly newsletter, wrote a interesting article about Dishonest Programming. I took this excerpt, wrote it down and put it on my desk. If you are a developer, you should read it too.

Honesty Tip #1:
Name functions for what they really do. You’ve been taught to write foo munging code by drawing a box on the paper and labeling it fooMunger() and then writing the code. Okay, but when you’re done, go back and read your code. Is it really fooMunging code, or does it also do something else? If you’re spending 80% of your method checking error conditions, your method is clearly less concerned with munging foos than determining whether it should munge foos. Congratulations! — you’ve written an event handler. Rename it to onMungeFoo() or handleFooMungeRequest() or whatever, and extract the code that ONLY munges foos to mungeFoo().

Honesty Tip #2:
Let your yea mean yea and your nil mean nil. Don’t set up code to cleverly create side effects. EVERY effect is a side effect! Name your code for the intended side effect and document any other side effects. Don’t name your code for the unintended effect, especially if you think you’re cleverly creating an abstraction. (If the abstraction is really good AND other code will use it unchanged, you may create an abstracted method but you should still not use the abstraction in your other code. Write a wrapper method that explains your intended effect, like:

bool isLegalOverride(Foo a, Bar b) { return !areSimilar(a, b); }

Honesty Tip #3:
Don’t pee on my leg and tell me it’s raining, and don’t write a public accessor to a private member and tell me that member is still private. If an object is completely and utterly accessible from anywhere in the application, it’s a global variable.

Honesty Tip #4:
Don’t try to trick the compiler into giving you what you want. You’ll only trick your coworkers (and probably yourself). Tell the compiler what you want and write code that makes it give it to you.