问题
I have some trouble with my spring managed tomcat application. There is a UserDao that is responsible for some User database operations. If I start the tomcat I get this message:
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
Nevertheless every part of my webapplication works without problems.
That is the UserDao bean decleration in my spring-context:
<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>
and that my UserDao class:
@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);
}
}
from the information given in the message I would say there are problems with constructors. But why? And more important where?
回答1:
I've experienced this error before you probably have a break point set somewhere on that class
In eclipse goto:
- Window -> Show View -> Other
- In the search box filter type: "Breakpoints"
In this break points view look for your UserDao class and uncheck all breakpoints inside it.
This will make those msgs during startup go away
来源:https://stackoverflow.com/questions/27114001/getdeclaredconstructors0boolean-line-not-available-during-tomcat-startup-in-d