You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kevin Jones <ke...@develop.com> on 2000/03/07 12:53:18 UTC

jar files aren't being loaded from lib directory

Looking in DefaultCMSetter.java, the getJars method has this code to load
jars

        if(f.exists() && f.isDirectory() && f.isAbsolute())
        {
            System.out.println("In getJars - 1");
            String[] jarlist = f.list(jarfilter);

            for(int i=0; (jarlist != null) && (i < jarlist.length); ++i)
            {
                System.out.println("In getJars - 2");
                v.addElement(jarlist[i]);
            }

            String[] dirlist = f.list(dirfilter);

            for(int i=0; (dirlist != null) && (i < dirlist.length); ++i)
            {
                File dir = new File(f, dirlist[i]);
                getJars(v, dir);
            }
        }

notice the f.isAbsolute() at the end.

But the filename passed in is ALWAYS a relative directory name - so either
this should be turned into a full directory name before the call is made OR
the isAbsolute call should be removed (or I'm missing something?)


Kevin Jones
www.develop.com


RE: jar files aren't being loaded from lib directory

Posted by Kevin Jones <ke...@develop.com>.
Talking to myself again :-)

The code that calls getJars (initURLs)creates a string for the
WEB-INF/classes directory and turns this into a fully qualified pathname, my
guess is that this code also needs to be added for jars, so initURLs does
this

        File f =  new File(base + "/WEB-INF/lib");
        if (!f.isAbsolute()) // not absolute
        {
            // evaluate repository path relative to the context's home
directory
            ContextManager cm = context.getContextManager();
            f = new File(cm.getHome(), base + "/WEB-INF/lib"); // make it so
number 1
        }
        Vector jars = new Vector();
        getJars(jars, f);

Kevin Jones
www.develop.com

> -----Original Message-----
> From: Kevin Jones [mailto:kevinj@develop.com]
> Sent: 07 March 2000 11:53
> To: Tomcat-Dev
> Subject: jar files aren't being loaded from lib directory
>
>
> Looking in DefaultCMSetter.java, the getJars method has this code to load
> jars
>
>         if(f.exists() && f.isDirectory() && f.isAbsolute())
>         {
>             System.out.println("In getJars - 1");
>             String[] jarlist = f.list(jarfilter);
>
>             for(int i=0; (jarlist != null) && (i < jarlist.length); ++i)
>             {
>                 System.out.println("In getJars - 2");
>                 v.addElement(jarlist[i]);
>             }
>
>             String[] dirlist = f.list(dirfilter);
>
>             for(int i=0; (dirlist != null) && (i < dirlist.length); ++i)
>             {
>                 File dir = new File(f, dirlist[i]);
>                 getJars(v, dir);
>             }
>         }
>
> notice the f.isAbsolute() at the end.
>
> But the filename passed in is ALWAYS a relative directory name - so either
> this should be turned into a full directory name before the call
> is made OR
> the isAbsolute call should be removed (or I'm missing something?)
>
>
> Kevin Jones
> www.develop.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org