1 Reply Latest reply on Feb 15, 2003 11:04 AM by Erik Reuter

    Utility jar dependencies to other jars

    Erik Reuter Newbie

      I've run into a ClassLoader problem I cant figure out how to get around.

      I have a "helper jar" that contains utilities to make life easier when working with, say, Struts. This jar uses Struts classes and is packaged into the WEB-INF/lib dir of the war. The struts jar is also in the lib dir.

      I thought that my utility jar could see the struts.jar classes just by laying next to it in the lib dir, but I get NoClassDefFoundError errors using it. Did try to have a MANFIFEST.MF with "Class-Path: struts.jar" in the utility jar, but same error.

      shouldnt this be possible? Or cant i have jars depending on other jars inside a war file?

      Erik Reuter

        • 1. Re: Utility jar dependencies to other jars
          Erik Reuter Newbie

          ok, I'm stupid : )

          The helper utility jar I had contained both classes used by EJBs and WARs and was part of EJBs that are used in the WAR I had the problem with.

          The WAR saw the utility jar through the EJBs classpath and hence, a parent ClassLoader which didnt contain the struts.jar.

          I split the utility jar into 2 jars to separate the responsibilities and voila! it worked.

          ClassLoaders can really be a pain, otherwise I'm just a plain old idiot.