Error Wrong number of Arguments in production environment

Asked

Viewed 138 times

1

I have an application in development and production, and only in the production mode this presenting the following error:

[0m[31m13:11:45,758 ERROR [io.undertow.request] (default task-118) UT005023: Exception Handling request to /1/Registers/Object/new: org.springframework.web.util.Nestedservletexception: Request Processing failed; nested Exception is java.lang.Illegalargumentexception: Wrong number of Arguments

How can I fix this issue in the production environment that is running on Locaweb with the Jelastic service? I think it’s something in Wildfly itself that’s running on this server, version 9.0. As soon as this error is presented the user goes back to the login screen and it is not possible to register a new object because when the request in this URL occurs again the problem.

Objectcontroller.class:

@Controller
@RequestMapping("/registers/object")
@ControllerLabel(label="header.registers.object")
public class ObjectController extends GenericController<Object> {

    @Autowired
    public ObjectController(ObjectService service) {
        super(service, Object.class, "object", "protected/registers/ListObject", "protected/registers/CrudObject");
    }

    @ModelAttribute("EnumTipoObject" )
    public List<EnumTipoObject> getEnumTipoObject() {
        return Arrays.asList(EnumTipoObject.values());
    }
}

Genericcontroller.class:

public abstract class GenericController <T>  {

    protected final Class<T> classBean;
    private final String nameVarBean;   
    protected final GenericService<T> service;
    private final String jspList;
    private final String jspManager;

    public GenericController(GenericService<T> service,Class<T> classBean,String nameVarBean, String jspList,String jspManager) {
        this.service = service;
        this.classBean = classBean;
        this.jspList = jspList;
        this.jspManager = jspManager;
        this.nameVarBean = nameVarBean;
    }

    @Link(label="New", family="genericcontroller", parent = "Lista") 
    @RequestMapping(value = {"/new"}, method = RequestMethod.GET)
    public final String viewCreate(Model model) throws Exception{

        model.addAttribute(nameVarBean,service.getInstanceOfObjectT(classBean) );

        return jspManager;      
    }

    @Link(label="Lista", family="genericcontroller", parent = "") 
    @RequestMapping( method = RequestMethod.GET)
    public final String viewList() {
        return jspList;     
    }

    @Link(label="Alterar", family="genericcontroller", parent = "Lista") 
    @RequestMapping(value = {"/alterar/{oid}"}, method = RequestMethod.GET)
    public final ModelAndView viewUpdate(@PathVariable("oid") Long oid, HttpServletRequest request) throws Exception{   

        T vObject = service.findOne(oid);   
        ModelAndView mv = new ModelAndView(jspManager); 

        if(vObject != null) {       
            mv.addObject(nameVarBean, vObject);


            return mv;      
        }else { 
            String urlRed = request.getServletPath().substring(1, request.getServletPath().lastIndexOf("/alterar"));


            return new ModelAndView("redirect:/" + urlRed + "/novo");
        }   
    }   

    @Link(label="Salvar", family="genericcontroller", parent = "Lista") 
    @RequestMapping(value = {"/salvar", "/alterar/salvar"}, method = RequestMethod.POST)
    public final String save( @Valid T object , BindingResult result, HttpServletRequest request ){

        if(result.hasErrors()) {
            return jspManager;
         }  

         try {
             service.save(object, request); 
         }catch (Exception e) {
             result.addError(ExceptionFilter.filterMessage2(e, request));
             return jspManager; 
         }


         String urlRed = request.getServletPath().substring(1, request.getServletPath().lastIndexOf("/"));

         if (urlRed.lastIndexOf("alterar") > 0)
             urlRed = request.getServletPath().substring(1, request.getServletPath().lastIndexOf("/alterar"));

         return "redirect:/" + urlRed ; 
    }

    @Link(label="Alterar", family="genericcontroller", parent = "Lista") 
    @RequestMapping(value = {"/alterar/deletar"}, method = RequestMethod.POST)
    public final String delete(T object , BindingResult result, HttpServletRequest request ){

        try{
            service.delete(object, request);    

            String urlRed = request.getServletPath().substring(1, request.getServletPath().lastIndexOf("/alterar"));


             return "redirect:/" + urlRed ; 

        }catch(Exception e) {       

            result.addError(ExceptionFilter.filterMessage2(e, request));
            return jspManager;          
        }    
    }

    @RequestMapping(value = {"/listTable"}, method = RequestMethod.GET, produces = "application/json")
    @ResponseBody
    public Iterable<T> listTable(int offset, int limit,@RequestParam(value = "search",required = false) String search,
            @RequestParam(value = "sort",required = false)  String sort, String order){
        Iterable<T>a =  service.findPaginationTable(offset,limit,order,sort,search); 
        return a;        
    }

    @RequestMapping(value = {"/listSelect"}, method = RequestMethod.GET, produces = "application/json")
    @ResponseBody
    public Iterable<T> listSelectSearch(@RequestParam(value = "term",required = false)  String term, @RequestParam(value = "id",required = false) Long id) throws Exception{

        List<T> i;

        if (id != null) {
            i = new ArrayList<T>();
            i.add(service.findOne(id));        
        } else {
            i = service.findSelectSearch(term.toUpperCase()); 
        }

        return i;       
    }  

}

Log:

[0m[31m13:11:45,758 ERROR [io.undertow.request] (default task-118) UT005023: Exception handling request to /1/registers/object/new: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: wrong number of arguments
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
    at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: wrong number of arguments
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.econtabil.erp.generic.GenericService.getInstanceOfObjectT(GenericService.java:24)
    at com.econtabil.erp.generic.GenericController.viewCreate(GenericController.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    ... 68 more
  • Giancarlo, the application is a web service? Put the method of registration and related code.

  • It is not a webservice, post yes.

  • Location you’re running on a Servlet container or on WF as well? By stack trace seems to be problem be problems in the environment libraries. I recommend taking a look at the servlet-api and a(s) from EL. No more details about the environments can not reproduce :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.