当前位置: 代码迷 >> J2EE >> javax.naming.NamingException: No set method found for property: nitialPoolSize
  详细解决方案

javax.naming.NamingException: No set method found for property: nitialPoolSize

热度:520   发布时间:2016-04-22 03:01:34.0
配置c3p0连接池报错 No set method found for property怎么回事啊?
在项目的META-INF下新建context.xml:
XML code
<Context>    <Resource        description="DB Connection"         name="jdbc/mysqlds"        auth="Container"        type="com.mchange.v2.c3p0.ComboPooledDataSource"                factory="org.apache.naming.factory.BeanFactory"        driverClassName="com.mysql.jdbc.Driver"        url="jdbc:mysql://127.0.0.1:3306/hibernate"        user="root"        password="123"        maxPoolSize="20"          minPoolSize="3"         nitialPoolSize="10"    />    </Context>

Java code
servlet中测试的部分代码:Context context = new InitialContext();DataSource dataSource = (DataSource)context.lookup("java:/comp/env/jdbc/mysqlds");conn = dataSource.getConnection();

错误消息:
Java code
javax.naming.NamingException: No set method found for property: nitialPoolSize    at org.apache.naming.factory.BeanFactory.getObjectInstance(BeanFactory.java:215)    at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:140)    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)    at org.apache.naming.NamingContext.lookup(NamingContext.java:793)    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)    at org.apache.naming.NamingContext.lookup(NamingContext.java:781)    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)    at org.apache.naming.NamingContext.lookup(NamingContext.java:781)    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)    at org.apache.naming.NamingContext.lookup(NamingContext.java:781)    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)    at javax.naming.InitialContext.lookup(InitialContext.java:392)    at com.wjf.CSPO.doGet(CSPO.java:28)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)    at java.lang.Thread.run(Thread.java:619)

我只在tomcat的lib下放了一个c3p0的jar包,对配置不太了解,
请问factory="org.apache.naming.factory.BeanFactory"这句什么意思?是不是没有引入相关的包?还是其他问题?

------解决方案--------------------
nitialPoolSize="10"
->
initialPoolSize="10"
  相关解决方案