Results 1 to 2 of 2

Thread: java.lang.NoClassDefFoundError: AjaxInterceptor

  1. #1
    Join Date
    Mar 2010
    Posts
    1

    Default java.lang.NoClassDefFoundError: AjaxInterceptor

    Hi, I'm trying to integrate AJAX on SpringMVC.

    I red the tutorial on this link: https://springmodules.dev.java.net/d...l/xt.html#ajax

    I created this handler
    Code:
    import java.util.LinkedList;
    import java.util.List;
    
    import org.springmodules.xt.ajax.action.ReplaceContentAction;
    import org.springmodules.xt.ajax.component.Option;
    
    import org.springmodules.xt.ajax.AbstractAjaxHandler;
    import org.springmodules.xt.ajax.AjaxActionEvent;
    import org.springmodules.xt.ajax.AjaxResponse;
    import org.springmodules.xt.ajax.AjaxResponseImpl;
    
    import springmvc.domain.Product;
    import springmvc.service.ProductManager;
    
    public class LoadProductsHandler extends AbstractAjaxHandler{
    	
    	private ProductManager productManager;
    	
    	@SuppressWarnings("unchecked")
    	public AjaxResponse loadProducts(AjaxActionEvent event){
    		 List<Product> list = productManager.getListProduct();
    		 List options = new LinkedList();
    		 Option first = new Option("-1", "Select one ...");
    		 options.add(first);
             
             for(Product product : list) {
    	         Option option = new Option(product, "description", "price");
    	         options.add(option);
             }
             ReplaceContentAction action = new ReplaceContentAction("products", options);
             AjaxResponse response = new AjaxResponseImpl();
             response.addAction(action);
             return response;
    	 }
    	
    	public void setProductManager(ProductManager productManager) {
    		this.productManager = productManager;
    	}
    
    }
    and my spring-servlet.xml is this:
    Code:
     <!-- AJAX -->
    	<bean id="ajaxInterceptor" class="org.springmodules.xt.ajax.AjaxInterceptor">
          <property name="handlerMappings">
    	      <props>
    		      <prop key="/jsp/loadProducts.jsp">ajaxLoadProductsHandler</prop>		      
    	      </props>
          </property>
    	</bean> 
    	
    	 <bean id="ajaxLoadProductsHandler" class="springmvc.ajax.LoadProductsHandler">
             <property name="productManager" ref="productManager"/>
     	 </bean>
    When I try to start the application I catch this exception:
    GRAVE: Allocate exception for servlet springmvc
    java.lang.NoClassDefFoundError: Could not initialize class org.springmodules.xt.ajax.AjaxInterceptor

    Why? I put the correct jar in the WEB-INF/lib.

    Anyone can help me?

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    I suggest you don't use that stuff anymore, I suggest Spring-JS which makes it a lot easier.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •