1 Reply Latest reply on Oct 22, 2007 9:21 AM by Roger Martin

    DropListener NoClassDefFoundError

    K J Newbie

      My setup

      Richfaces 3.1.0
      Seam 1.2.1
      JBoss 4.0.5


      I am trying the richfaces drag and drop example with code included below.

      I was able to compile the source code and deploy it.
      The application renders fine and I can drag the framework from source list to destination area.

      But the moment I drop it , I get the following error .

      java.lang.NoClassDefFoundError: org/richfaces/event/DropListener
      


      I checked for this class in the richfaces jars and found it in the richfaces-api jar.
      I have already packaged the richfaces libraries (the 3 richfaces jars i.e ui, impl and api) in the WEB-INF/lib .



      //////////////////////////////// DndBean.java //////////////////
      
      package org.richfaces.demo.dnd;
      
      import java.util.ArrayList;
      import org.jboss.seam.annotations.Name;
      
      @Name("dndBean")
      public class DndBean {
       private ArrayList containerPHP;
       private ArrayList containerCF;
       private ArrayList containerDNET;
       private ArrayList frameworks;
      
       public ArrayList getContainerCF() {
       return containerCF;
       }
       public void setContainerCF(ArrayList containerCF) {
       this.containerCF = containerCF;
       }
       public ArrayList getContainerDNET() {
       return containerDNET;
       }
       public void setContainerDNET(ArrayList containerDNET) {
       this.containerDNET = containerDNET;
       }
       public ArrayList getContainerPHP() {
       return containerPHP;
       }
       public void setContainerPHP(ArrayList containerPHP) {
       this.containerPHP = containerPHP;
       }
       public ArrayList getFrameworks() {
       if (frameworks == null)
       initList();
       return frameworks;
       }
       public void setFrameworks(ArrayList frameworks) {
       this.frameworks = frameworks;
       }
      
       public void moveFramework(Object fm, Object family) {
       ArrayList target = null;
       if ("PHP".equals(family)) target = containerPHP;
       else if ("DNET".equals(family)) target = containerDNET;
       else if ("CF".equals(family)) target = containerCF;
      
       if (target != null) {
       int ind = frameworks.indexOf(fm);
       if (ind > -1) {
       target.add(frameworks.get(ind));
       frameworks.remove(ind);
       }
      
       }
       }
      
       public String reset() {
      
       initList();
       return null;
      
       }
      
       private void initList() {
       frameworks = new ArrayList();
       frameworks.add(new Framework("Flexible Ajax", "PHP"));
       frameworks.add(new Framework("ajaxCFC", "CF"));
       frameworks.add(new Framework("AJAXEngine", "DNET"));
       frameworks.add(new Framework("AjaxAC", "PHP"));
       frameworks.add(new Framework("MonoRail", "DNET"));
       frameworks.add(new Framework("wddxAjax", "CF"));
       frameworks.add(new Framework("AJAX AGENT", "PHP"));
       frameworks.add(new Framework("FastPage", "DNET"));
       frameworks.add(new Framework("JSMX", "CF"));
       frameworks.add(new Framework("PAJAJ", "PHP"));
       frameworks.add(new Framework("Symfony", "PHP"));
       frameworks.add(new Framework("PowerWEB", "DNET"));
      
       containerPHP = new ArrayList();
       containerCF = new ArrayList();
       containerDNET = new ArrayList();
       }
      
      }



      ///////////////////////////// EventBean.java ///////////////
      
      package org.richfaces.demo.dnd;
      
      
       import org.richfaces.component.Dropzone;
       import org.richfaces.event.DropEvent;
       import org.richfaces.event.DropListener;
       import org.jboss.seam.annotations.Name;
      
       import org.jboss.seam.annotations.Name;
      
       @Name("eventBean")
      
       public class EventBean implements DropListener {
       private org.richfaces.demo.dnd.DndBean dndBean;
      
       public void processDrop(DropEvent dropEvent) {
       Dropzone dropzone = (Dropzone) dropEvent.getComponent();
       dndBean.moveFramework(dropEvent.getDragValue(), dropzone.getDropValue());
       }
      
       public org.richfaces.demo.dnd.DndBean getDndBean() {
       return dndBean;
       }
      
       public void setDndBean(org.richfaces.demo.dnd.DndBean dndBean) {
       this.dndBean = dndBean;
       }
       }



      
      ///////////////////// Framework.java ////////
      
      package org.richfaces.demo.dnd;
      
      public class Framework {
       private String name;
       private String family;
       public String getFamily() {
       return family;
       }
       public void setFamily(String family) {
       this.family = family;
       }
       public String getName() {
       return name;
       }
       public void setName(String name) {
       this.name = name;
       }
       public Framework(String name, String family) {
       super();
       this.name = name;
       this.family = family;
       }
      
      
      }



      ///////////// faces-config.xml /////////////
      
      <?xml version="1.0" encoding="UTF-8"?>
      <!-- JSF 1.1 -->
      <!DOCTYPE faces-config
       PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
      <faces-config>
      
      <managed-bean>
       <managed-bean-name>eventBean</managed-bean-name>
       <managed-bean-class>org.richfaces.demo.dnd.EventBean</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
      
       <lifecycle>
       <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
       </lifecycle>
       <application>
       <message-bundle>messages</message-bundle>
       </application>
      
      </faces-config>
      



      Can somebody please help me on this ?

      Regards,
      KJ

        • 1. Re: DropListener NoClassDefFoundError
          Roger Martin Newbie

          Hi,

          Even though you think the jars are there it is worth checking where they get deployed to be sure. Which server?

          Glassfish
          C:\glassfish\domains\domain1\applications\j2ee-modules\[yourwebapp]\WEB-INF\lib
          Tomcat
          C:\Program Files\apache-tomcat-6.0.14\webapps\[yourwebapp]\WEB-INF\lib
          other?