You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Glen Daniels <gl...@thoughtcraft.com> on 2007/05/30 14:55:08 UTC
[axis2] Quick ClassLoader questions
Hi folks!
So deployment.util.Utils.getClassLoader() sets up a classloader with a
classpath consisting of:
- The passed root dir (i.e. modules/ or services/)
- The "lib" and "Lib" subdirs
- Any jar files found in "lib"/"Lib"
1) Who uses "Lib/" with a capital L? Do we need this?
2) Should the classpath actually include the "lib/" dir itself? If we
want to support unjarred class access, that should be in a separate
"classes/" directory, IMHO (just like WEB-INF/lib and WEB-INF/classes)....
3) Should the classpath actually include the root dir itself? If so, why?
I'll be sending another mail re: deployment and class loading issues,
but for now I wanted to get these quick questions out there.
--Glen
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org
Re: [axis2] Quick ClassLoader questions
Posted by Deepal Jayasinghe <de...@opensource.lk>.
>
> The lib/ directory should contain jars, not classes directly, right?
> I agree that lib/*.jar should be added to the classpath, but I was
> asking about lib/ itself. Right now if you had
> lib/org/apache/axis2/SomeClass.class, that class would be available,
> which I do not think is appropriate.
Hmm, yes if someone put classes like that it will work . But the whole
idea of adding lib directory to classpath is to add resources to lib
directory. If you think thats not the right way then I am +1 for your
suggestion.
> That's what a classes/ directory is for.
>
>>> 3) Should the classpath actually include the root dir itself? If so,
>>> why?
>> I think you mean root directory of the archive file , yes we need to do
>> so . If someone put some resources under the archive file then he need
>> to be able to load them.
>
> No, I mean the actual modules/ or services/ directory! Unless I'm
> reading things incorrectly, Utils.java:209 seems to add the base
> directory to the classpath. This gets called 1) once for the repo
> base directory itself, 2) once each for services/ and modules/, and
> then 3) once for each service. In cases 1 and 2, I believe this
> behavior is at least questionable if not incorrect.
Oh , same as before lets remove that too.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org
Re: [axis2] Quick ClassLoader questions
Posted by Glen Daniels <gl...@thoughtcraft.com>.
Hi Deepal!
Deepal Jayasinghe wrote:
>> So deployment.util.Utils.getClassLoader() sets up a classloader with a
>> classpath consisting of:
>>
>> - The passed root dir (i.e. modules/ or services/)
>> - The "lib" and "Lib" subdirs
>> - Any jar files found in "lib"/"Lib"
> Yes correct.
>> 1) Who uses "Lib/" with a capital L? Do we need this?
> We just have added that to support both Lib and lib cases , but if you
> think no one is going to use Lib then let's remove that.
+1 to remove it, unless we have a use-case for it (anyone?)...
>> 2) Should the classpath actually include the "lib/" dir itself? If we
>> want to support unjarred class access, that should be in a separate
>> "classes/" directory, IMHO (just like WEB-INF/lib and
>> WEB-INF/classes)....
> Well , all the jar files and resources in the lib (mar or aar) can be
> access via the corresponding class loader. Abt the classes we are too
> late to add that and the way we have right now is ok too. no need to
> have separate classes directory inside the aar or mar you can just put
> your .class file inside the archive file.
The lib/ directory should contain jars, not classes directly, right? I
agree that lib/*.jar should be added to the classpath, but I was asking
about lib/ itself. Right now if you had
lib/org/apache/axis2/SomeClass.class, that class would be available,
which I do not think is appropriate. That's what a classes/ directory
is for.
>> 3) Should the classpath actually include the root dir itself? If so,
>> why?
> I think you mean root directory of the archive file , yes we need to do
> so . If someone put some resources under the archive file then he need
> to be able to load them.
No, I mean the actual modules/ or services/ directory! Unless I'm
reading things incorrectly, Utils.java:209 seems to add the base
directory to the classpath. This gets called 1) once for the repo base
directory itself, 2) once each for services/ and modules/, and then 3)
once for each service. In cases 1 and 2, I believe this behavior is at
least questionable if not incorrect.
For the service case, case 3 above, that's the same thing you're talking
about as the root of the .aar file. Is that really where we want
classes loaded from? We support "lib" directories in service archives,
and the lib/ directories in there should contain (as mentioned above)
jar files, NOT classes. What if someone has a class called
"lib.BookManager" in their service? Wouldn't we then have to put that
class file into the lib/ directory in the service deployment, mixing it
in with the jar files? This is why WAR/EAR files have separate lib/ and
classes/ roots.
I'm a bit concerned that we load from a few too many places right now,
which could lead to unintended confusion down the road.
--Glen
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org
Re: [axis2] Quick ClassLoader questions
Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Glen,
Please see my comment inline.
> Hi folks!
>
> So deployment.util.Utils.getClassLoader() sets up a classloader with a
> classpath consisting of:
>
> - The passed root dir (i.e. modules/ or services/)
> - The "lib" and "Lib" subdirs
> - Any jar files found in "lib"/"Lib"
Yes correct.
>
> 1) Who uses "Lib/" with a capital L? Do we need this?
We just have added that to support both Lib and lib cases , but if you
think no one is going to use Lib then let's remove that.
>
> 2) Should the classpath actually include the "lib/" dir itself? If we
> want to support unjarred class access, that should be in a separate
> "classes/" directory, IMHO (just like WEB-INF/lib and
> WEB-INF/classes)....
Well , all the jar files and resources in the lib (mar or aar) can be
access via the corresponding class loader. Abt the classes we are too
late to add that and the way we have right now is ok too. no need to
have separate classes directory inside the aar or mar you can just put
your .class file inside the archive file.
>
> 3) Should the classpath actually include the root dir itself? If so,
> why?
I think you mean root directory of the archive file , yes we need to do
so . If someone put some resources under the archive file then he need
to be able to load them.
>
> I'll be sending another mail re: deployment and class loading issues,
> but for now I wanted to get these quick questions out there.
>
> --Glen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>
>
--
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org