一尘不染

getDeclaredConstructors0(boolean)-在调试模式下,tomcat启动期间行不可用

tomcat

我的spring管理的tomcat应用程序遇到一些麻烦。有一个UserDao负责某些User数据库操作。如果我启动tomcat,则会收到以下消息:

Thread [pool-2-thread-1] (Class load: UserDao)  
Class<T>.getDeclaredConstructors0(boolean) line: not available [native method]  
    Class<T>.privateGetDeclaredConstructors(boolean) line: not available    
    Class<T>.getDeclaredConstructors() line: not available  
    AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(Class<?>, String) line: 229 
    DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).determineConstructorsFromBeanPostProcessors(Class, String) line: 962 
    DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBeanInstance(String, RootBeanDefinition, Object[]) line: 935   
    DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).doCreateBean(String, RootBeanDefinition, Object[]) line: 485 
    DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[]) line: 456   
    AbstractBeanFactory$1.getObject() line: 294 
    DefaultListableBeanFactory(DefaultSingletonBeanRegistry).getSingleton(String, ObjectFactory) line: 225  
    DefaultListableBeanFactory(AbstractBeanFactory).doGetBean(String, Class<T>, Object[], boolean) line: 291    
    DefaultListableBeanFactory(AbstractBeanFactory).getBean(String) line: 193   
    DefaultListableBeanFactory.preInstantiateSingletons() line: 605 
    XmlWebApplicationContext(AbstractApplicationContext).finishBeanFactoryInitialization(ConfigurableListableBeanFactory) line: 925 
    XmlWebApplicationContext(AbstractApplicationContext).refresh() line: 472    
    ContextLoaderListener(ContextLoader).configureAndRefreshWebApplicationContext(ConfigurableWebApplicationContext, ServletContext) line: 383  
    ContextLoaderListener(ContextLoader).initWebApplicationContext(ServletContext) line: 283    
    ContextLoaderListener.contextInitialized(ServletContextEvent) line: 111 
    StandardContext.listenerStart() line: 4779  
    StandardContext.startInternal() line: 5273  
    StandardContext(LifecycleBase).start() line: 150    
    ContainerBase$StartChild.call() line: 1568  
    ContainerBase$StartChild.call() line: 1558  
    FutureTask$Sync.innerRun() line: not available  
    FutureTask<V>.run() line: not available 
    ThreadPoolExecutor$Worker.runTask(Runnable) line: not available 
    ThreadPoolExecutor$Worker.run() line: not available 
    Thread.run() line: not available

但是,我的Web应用程序的每个部分都可以正常工作。

在我的spring上下文中,这就是UserDao bean的实现:

<bean id="userDao" class="de.bc.qz.dao.UserDao" autowire="byName">
        <property name="dataSource" ref="dataSource" />
        <property name="LAU">
            <value>
                select u.* from quiz.user u where name like ?
        </value>
        </property>
        <property name="LUC">
            <value>
                select u.pc, u.gc, u.sc, u.bc from quiz.user u where name = ?
        </value>
        </property>
        <property name="LUID">
            <value>
                SELECT u.id
                FROM quiz.user u
                WHERE u.name = ?;
        </value>
        </property>
        <property name="LBQC">
            <value>
                SELECT u.name, u.cq
                FROM quiz.user u
                WHERE u.cq != 0 ORDER BY u.cq DESC LIMIT 0, 100;
        </value>
        </property>
    </bean>

以及我的UserDao类:

@Service
public class UserDao extends AbstractSpring {

    private String mLAU;
    private String mLUID;
    private String mLBQC;
    private String mLUC;

    public void setLUC(String pLUC) {
        mLUC = pLUC;
    }

    public void setLAU(String pLAU) {
        mLAU = pLAU;
    }

    public void setLUID(String pLUID) {
        mLUID = pLUID;
    }

    public void setLBQC(String pLBQC) {
        mLBQC = pLBQC;
    }

    @Autowired
    public UserDao(DataSource dataSource) {
        setDataSource(dataSource);
    }

    @Autowired
    private UserMapper mUserMapper;

    public List<User> findAllUser(String pName) {
        return createJdbcTemplate().query(mLAU,
                new Object[] { "%" + pName + "%" }, mUserMapper);
    }

}

从消息中给出的信息中,我会说构造函数存在问题。但为什么?更重要的是在哪里?


阅读 229

收藏
2020-06-16

共1个答案

一尘不染

在您可能在该课程的某个地方设置断点之前,我已经遇到了此错误

在Eclipse goto中:

  1. 窗口->显示视图->其他
  2. 在搜索框过滤器中输入:“断点”
  3. 在此断点视图中,查找您的UserDao类,然后取消选中其中的所有断点。

这将使启动期间的那些消息消失

2020-06-16