Search code examples
javatomcat7web-development-server

error: package org.apache.commons.beanutils does not exist


I'm working through the example code of chapter 4 of Core Servlets and JavaServer Pages (http://volume1.coreservlets.com/archive/Chapter4.html) and I get the above error when I try to compile the BeanUtilities.java file. I thought initially it was my classpath but that seems to include the required .jar files (looking at the starttomcat prompt). I think I have the .jar files in the correct directory ($CATALINA_HOME/lib/ I'm running tomcat 7 on fedora). Any advice? Thanks & I hope your day is going better than mine, sigh.


Solution

  • Bean utils doesn't contains in the default package of JDK or Tomcat, So you need to add it manually as it is a dependency.

    If you are building and web project using J2EE

    Then add bean utils (.jar file) in your WebContent/WEB-INF/lib directory.

    Also add all dependency in this directory

    If it's a maven project add the commons-beanutils dependency

      <dependency>            
          <groupId>commons-beanutils</groupId>
          <artifactId>commons-beanutils</artifactId>
          <version>1.9.2</version>        
      </dependency>