2017-10-16 133 views
0

你好,我想要創建數據表javaspring MVC錯誤創建在文件中定義名稱 'dataTableColumnSpecs' 豆[tomcat_path DataTableColumnSpecs.class] javaspring MVC

我正在請點擊此鏈接

http://www.opencodez.com/java/datatable-with-spring-boot.htm

但我有問題 錯誤創建與豆名 'dataTableColumnSpecs' 在文件中定義的[tomcat_path \ DataTableColumnSpecs.class]

錯誤日誌

SEVERE: StandardWrapper.Throwable 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataTableColumnSpecs' defined in file [local_tomcat\hris\WEB-INF\classes\org\hris\datatables\DataTableColumnSpecs.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hris.datatables.DataTableColumnSpecs]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.hris.datatables.DataTableColumnSpecs.<init>() 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1101) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) 
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663) 
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629) 
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677) 
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548) 
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489) 
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) 
    at javax.servlet.GenericServlet.init(GenericServlet.java:158) 
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) 
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038) 
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5337) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
    at java.lang.Thread.run(Thread.java:748) 
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hris.datatables.DataTableColumnSpecs]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.hris.datatables.DataTableColumnSpecs.<init>() 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:85) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094) 
    ... 29 more 
Caused by: java.lang.NoSuchMethodException: org.hris.datatables.DataTableColumnSpecs.<init>() 
    at java.lang.Class.getConstructor0(Class.java:3082) 
    at java.lang.Class.getDeclaredConstructor(Class.java:2178) 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80) 
    ... 30 more 

Oct 16, 2017 11:20:58 AM org.apache.catalina.core.StandardContext loadOnStartup 
SEVERE: Servlet [spring] in web application [] threw load() exception 
java.lang.NoSuchMethodException: org.hris.datatables.DataTableColumnSpecs.<init>() 
    at java.lang.Class.getConstructor0(Class.java:3082) 
    at java.lang.Class.getDeclaredConstructor(Class.java:2178) 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) 
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663) 
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629) 
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677) 
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548) 
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489) 
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) 
    at javax.servlet.GenericServlet.init(GenericServlet.java:158) 
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) 
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038) 
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5337) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
    at java.lang.Thread.run(Thread.java:748) 

SEVERE: StandardWrapper.Throwable 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataTableColumnSpecs' defined in file [local_tomcat\hris\WEB-INF\classes\org\hris\datatables\DataTableColumnSpecs.class]: Instantiation of be failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hris.datatables.DataTableColumnSpecs]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.hris.datatables.DataTableColumnSpecs.<init>() 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1101) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) 
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663) 
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629) 
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677) 
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548) 
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489) 
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) 
    at javax.servlet.GenericServlet.init(GenericServlet.java:158) 
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) 
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) 
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099) 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670) 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
    at java.lang.Thread.run(Thread.java:748) 
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hris.datatables.DataTableColumnSpecs]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.hris.datatables.DataTableColumnSpecs.<init>() 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:85) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094) 
    ... 36 more 
Caused by: java.lang.NoSuchMethodException: org.hris.datatables.DataTableColumnSpecs.<init>() 
    at java.lang.Class.getConstructor0(Class.java:3082) 
    at java.lang.Class.getDeclaredConstructor(Class.java:2178) 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80) 
    ... 37 more 

Oct 16, 2017 11:21:00 AM org.apache.catalina.core.StandardWrapperValve invoke 
SEVERE: Allocate exception for servlet spring 
java.lang.NoSuchMethodException: org.hris.datatables.DataTableColumnSpecs.<init>() 
    at java.lang.Class.getConstructor0(Class.java:3082) 
    at java.lang.Class.getDeclaredConstructor(Class.java:2178) 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) 
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663) 
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629) 
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677) 
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548) 
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489) 
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) 
    at javax.servlet.GenericServlet.init(GenericServlet.java:158) 
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) 
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) 
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099) 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670) 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
    at java.lang.Thread.run(Thread.java:748) 

爲spring-servlet.xml

<?xml version="1.0" encoding="UTF-8"?> 
<beans:beans xmlns="http://www.springframework.org/schema/mvc" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> 

    <!-- Enables the Spring MVC @Controller programming model --> 
    <annotation-driven /> 

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving 
     up static resources in the ${webappRoot}/resources directory --> 
    <resources mapping="/resources/**" location="/resources/" /> 

    <!-- Resolves views selected for rendering by @Controllers to .jsp resources 
     in the /WEB-INF/views directory --> 
    <!-- context:component-scan base-package="org.bkn.hris.controller"/--> 
    <context:component-scan base-package="org.bkn.hris"> 
     <context:include-filter type="regex" expression="org.bkn.hris.*"/> 
    </context:component-scan> 

    <beans:bean id="messageSource" 
     class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
     <beans:property name="basename" value="classpath:messages" /> 
     <beans:property name="defaultEncoding" value="UTF-8" /> 
    </beans:bean> 

    <beans:bean id="localeResolver" 
     class="org.springframework.web.servlet.i18n.CookieLocaleResolver"> 
     <beans:property name="defaultLocale" value="en" /> 
     <beans:property name="cookieName" value="myAppLocaleCookie"></beans:property> 
     <beans:property name="cookieMaxAge" value="3600"></beans:property> 
    </beans:bean> 

</beans:beans> 

DataTableColumnSpecs.java

package org.bkn.hris.datatables; 

import javax.servlet.http.HttpServletRequest; 

public class DataTableColumnSpecs { 

    /** The index. */ 
    private int index; 

    /** The data. */ 
    private String data; 

    /** The name. */ 
    private String name; 

    /** The searchable. */ 
    private boolean searchable; 

    /** The orderable. */ 
    private boolean orderable; 

    /** The search. */ 
    private String search; 

    /** The regex. */ 
    private boolean regex; 

    /** The sort dir. */ 
    private String sortDir; 


    /** 
    * Instantiates a new data table column specs. 
    * 
    * @param request the request 
    * @param i the i 
    */ 
    public DataTableColumnSpecs(HttpServletRequest request, int i) { 
     this.setIndex(i); 
     prepareColumnSpecs(request, i); 
    } 

    /** 
    * Gets the data. 
    * 
    * @return the data 
    */ 
    public String getData() { 
     return data; 
    } 

    /** 
    * Sets the data. 
    * 
    * @param data the data to set 
    */ 
    public void setData(String data) { 
     this.data = data; 
    } 

    /** 
    * Gets the name. 
    * 
    * @return the name 
    */ 
    public String getName() { 
     return name; 
    } 

    /** 
    * Sets the name. 
    * 
    * @param name the name to set 
    */ 
    public void setName(String name) { 
     this.name = name; 
    } 

    /** 
    * Checks if is searchable. 
    * 
    * @return the searchable 
    */ 
    public boolean isSearchable() { 
     return searchable; 
    } 

    /** 
    * Sets the searchable. 
    * 
    * @param searchable the searchable to set 
    */ 
    public void setSearchable(boolean searchable) { 
     this.searchable = searchable; 
    } 

    /** 
    * Checks if is orderable. 
    * 
    * @return the orderable 
    */ 
    public boolean isOrderable() { 
     return orderable; 
    } 

    /** 
    * Sets the orderable. 
    * 
    * @param orderable the orderable to set 
    */ 
    public void setOrderable(boolean orderable) { 
     this.orderable = orderable; 
    } 

    /** 
    * Gets the search. 
    * 
    * @return the search 
    */ 
    public String getSearch() { 
     return search; 
    } 

    /** 
    * Sets the search. 
    * 
    * @param search the search to set 
    */ 
    public void setSearch(String search) { 
     this.search = search; 
    } 

    /** 
    * Checks if is regex. 
    * 
    * @return the regex 
    */ 
    public boolean isRegex() { 
     return regex; 
    } 

    /** 
    * Sets the regex. 
    * 
    * @param regex the regex to set 
    */ 
    public void setRegex(boolean regex) { 
     this.regex = regex; 
    } 

    /** 
    * Gets the sort dir. 
    * 
    * @return the sortDir 
    */ 
    public String getSortDir() { 
     return sortDir; 
    } 

    /** 
    * Sets the sort dir. 
    * 
    * @param sortDir the sortDir to set 
    */ 
    public void setSortDir(String sortDir) { 
     this.sortDir = (null != sortDir) ? sortDir.toUpperCase() : sortDir; 
    } 

    /** 
    * Gets the index. 
    * 
    * @return the index 
    */ 
    public int getIndex() { 
     return index; 
    } 

    /** 
    * Sets the index. 
    * 
    * @param index the index to set 
    */ 
    public void setIndex(int index) { 
     this.index = index; 
    } 

    /** 
    * Prepare column specs. 
    * 
    * @param request the request 
    * @param i the i 
    */ 
    private void prepareColumnSpecs(HttpServletRequest request, int i) { 

     this.setData(request.getParameter("columns["+ i +"][data]")); 
     this.setName(request.getParameter("columns["+ i +"][name]")); 
     this.setOrderable(Boolean.valueOf(request.getParameter("columns["+ i +"][orderable]"))); 
     this.setRegex(Boolean.valueOf(request.getParameter("columns["+ i +"][search][regex]"))); 
     this.setSearch(request.getParameter("columns["+ i +"][search][value]")); 
     this.setSearchable(Boolean.valueOf(request.getParameter("columns["+ i +"][searchable]"))); 

     int sortableCol = Integer.parseInt(request.getParameter("order[0][column]")); 
     String sortDir = request.getParameter("order[0][dir]"); 

     if(i == sortableCol) { 
      this.setSortDir(sortDir); 
     } 
    } 

} 

回答

0

你的問題在這個堆棧跟蹤行是顯而易見的:

Caused by: org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [org.hris.datatables.DataTableColumnSpecs]: 
No default constructor found; nested exception is java.lang.NoSuchMethodException 

發生這種情況是因爲你的context:component-scan正在掃描你的類,發現DataTableColumnSpecs沒有默認的構造函數,沒有參數的別名構造函數。通常你不需要顯式地添加默認構造函數,除非你指定了另一個帶參數的構造函數,這是你的情況。

你需要做的是默認的構造函數添加到您的DataTableColumnSpecs,如下:

/** 
* Default/empty constructor 
*/ 
public DataTableColumnSpecs() { 
    super(); 
} 
相關問題