Date Created: Sat 09-Jul-2011


    How to add shared libraries to Tomcat within Eclipse

    Open Tomcat server definition



    Click Open launch configuration in the General Information section as shown below



    Clink on User Entries and then Add External JARs



    Browse and locate the shared lib (JAR)

    What I would I would recommend is that you create a separate Java project with Ant/Maven to automatically create the JAR file as required and place it into a shred JARS location, for referencing form Tomcat as required for testing development.

    Below is an example for a class not found when a shared library was not available.

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: Servlet execution threw an exception

    root cause

    java.lang.NoClassDefFoundError: com/screv/shared/utilities/ServletHelpers
    com.screv.GetSession.doGet(GetSession.java:61)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

    root cause

    java.lang.ClassNotFoundException: com.screv.shared.utilities.ServletHelpers
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    com.screv.GetSession.doGet(GetSession.java:61)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

    note The full stack trace of the root cause is available in the Apache Tomcat/7.0.11 logs.


Middleware Mentor - Steven Charles Robinson

About Me

Steve Robinson has been working in IT for over 15 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware consulting. Steve comes from both an administration and development background.

Before moving to JEE, Steve was an accomplished developer and consultant for both IBM Lotus Notes and Microsoft .NET Technologies.

Follow Steve as @stevencrobinson on twitter.

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Oracle WebLogic Categories

JBoss Categories

Other Categories