直接从servlet访问时出现此错误
public class UpdateFloorEventServlet extends HttpServlet {
@Override
@Transactional(readOnly=true)
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
try {
FloorDAO floorDAO = (FloorDAO)context.getBean("floorDAO");
...
我想我应该增加定义的数据源中的连接但我不知道如何
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
p:dataSource-ref="dataSource"
p:packagesToScan="com.confloorapp.domain"
/>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close"
p:driverClass="${jdbc.driverClassName}"
p:jdbcUrl="${jdbc.url}"
p:user="${jdbc.username}"
p:password="${jdbc.password}"
p:acquireIncrement="5"
p:idleConnectionTestPeriod="60"
p:maxPoolSize="100"
p:maxStatements="50"
p:minPoolSize="10"
/>
答案 0 :(得分:0)
获得DOA的服务解决了这个问题: FloorService floorService =(FloorService)context.getBean(&#34; floorService&#34;);