Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
java.lang.NoClassDefFoundError: AjaxInterceptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    I suggest you don't use that stuff anymore, I suggest Spring-JS which makes it a lot easier.

    Comment

    Working...
    X