我的 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
尽管如此,我的网络应用程序的每个部分都可以正常工作。
这是我的 spring-context 中的 UserDao bean decleration:
<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);
}
}
根据消息中给出的信息,我认为构造函数存在问题。但为什么?哪里更重要?
最佳答案
在您可能在该类的某处设置断点之前,我遇到过此错误
在 eclipse 中转到:
- 窗口 -> 显示 View -> 其他
- 在搜索框过滤器类型中:“断点”
在此断点 View 中查找您的 UserDao 类并取消选中 里面的所有断点。
这将使启动期间的那些消息消失
关于java - getDeclaredConstructors0(boolean)- Debug模式下 tomcat 启动期间不可用的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27114001/