This happened to me for the tomcat6 package on Mint 15. The installation had /usr/share/tomcat6/lib/commons-pool.jar -> ../../java/commons-pool.jar
but /usr/share/java/commons-pool.jar -> commons-pool-1.5.6.jar
was broken. Copying it from my local Maven repo sudo cp ~/.m2/repository/commons-pool/commons-pool/1.5.6/commons-pool-1.5.6.jar /usr/share/java
fixed it for me.
java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
-
29-09-2022 - |
Question
I'm trying to configure org.apache.commons.dbcp.BasicDataSource as bean in web.xml under a tomcat project using tomcat 6 and postgresql 9.1
my servletdispacher.xml
`
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/car" />
<property name="username" value="postgres" />
<property name="password" value="123" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="annotatedClasses">
<list>
<value>DAOModel.Tblusers</value>
</list>
</property>
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="DAOModel.Tblusers" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
` and error which get :
javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:724)
Solution 2
OTHER TIPS
It seems the 'commons-pool' jar is not being deployed. If you are using eclipse, you can check which jars are deployed by going to the project's properties, and clicking Deployment Assembly.
May be your commons-pool-x.x.x.jar
is not present in your lib folder in deployed folder this can be solved by copying this jar file in apache-tomcat-7.0.54\lib
folder
I too faced some problem, in my repo commons-pool2-2.1.jar is not downloaded properly. we need to download correct jar.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow