W3C home > Mailing lists > Public > www-jigsaw@w3.org > May to June 1999

Re: Access Error in Servlet

From: Santiago Gala <nostromo@bitmailer.es>
Date: Fri, 11 Jun 1999 13:55:15 -0400 (EDT)
To: dpwhite@halcyon.com
Cc: Benoit Mahe <Benoit.Mahe@sophia.inria.fr>, Jigsaw Mailing List <www-jigsaw@w3.org>
Message-id: <37614E83.BB444245@bitmailer.es>


"David P. White" wrote:

> Benoit,
>
> Thanks for the response. I did try re-compiling and this changed
> nothing.
>
> A bit more info though:
>
> 1. When I first tried this, only the servlet's class file
> (TestServlet.class) was placed under the www/servlet directory of
> jigsaw. I left the supporting classes (PoolObject.class and
> ResultCodes.class) elsewhere (but still on the classpath specified to
> java when running the server). This resulted in the access error I
> originally mentioned.
>

It is fairly obvious (I think):
A class can not call a protected method unless they are in the same package.
Two classes are never in the same package if they are loaded by different class loaders.
Jigsaw uses a special classloader for servlets in "/servlets". It uses the standard system loader for servlets called through ServletWrapper.

If I'm right, that explains the behaviour you found.

>
> 2. So I tried moving all of the files (servlet as well as support class
> files) into their respective directories all located under the
> www/servlet directory. When I do this, the access error is NOT
> encountered. I find this odd.
>
> 3. I am not sure if the following is a result of my browsing the servlet
> directory using jigadmin but I believe so. I do see the following
> messages displayed on jigsaw's console:
>
>         Create Servlet : PoolObject.class
>         Create Servlet : ResultCodes.class
>
> These files are support classes rather than servlet classes. In
> jigadmin, I see no servlet wrappers created for these despite the
> messages on the console. Perhaps this is just an attempt by the servlet
> indexer to create servlet wrappers which ultimately fails (because they
> are not servlets)?
>
> Cheers,
>
> David
>
> Benoit Mahe wrote:
> >
> > Well, strange, did you try to recompile your servlet?
> >
> > Regards, Benoit.
> >
> > "David P. White" wrote:
> >
> > > Hello,
> > >
> > > I have placed a servlet's class file in the www/servlet directory to be
> > > executed by jigsaw. I then start jigsaw and try to access the servlet by
> > > pointing my browser to
> > > http://localhost:8001/servlet/LicenseManagerServlet. My browser displays
> > > a dialog saying that the document has no data. I also get the following
> > > shown on jigsaw's console:
> > >
> > > -------------------------------
> > >
> > > c:\jigsaw>java.exe -cp
> > > .;E:\jdk1-2-1\jre\lib\rt.jar;E:\jacl1-1-1\jacl.jar;E:\jacl1-1-1\tcljava.jar;C:\ORANT\jdbc\Oracle-JDBC-Classes111.zip;E:\jsdk2-1\servlet.jar;D:\hms\java;c:\jigsaw\classes\jigsaw.zip
> > > org.w3c.jigsaw.Main -root C:\Jigsaw\Jigsaw
> > >
> > > loading properties from: C:\Jigsaw\Jigsaw\config\server.props
> > > Jigsaw[2.0.2]: serving at http://notacow:8001/
> > > *** Warning : no logger specified, not logging.
> > > JigAdmin[2.0.2]: serving at http://notacow:8009/
> > > Create Servlet : LicenseManagerServlet.class
> > >
> > > java.lang.IllegalAccessError: try to access class
> > > hmssoftware/licensing/LicenseManager from class
> > > hmssoftware/licensing/LicenseManagerServlet
> > >         at
> > > hmssoftware.licensing.LicenseManagerServlet.init(LicenseManagerServle
> > > t.java:15)
> > >         at
> > > org.w3c.jigsaw.servlet.ServletWrapper.launchServlet(ServletWrapper.ja
> > > va:367)
> > >
> > > (large stack trace continues...)
> > >
> > > -------------------------------
> > >
> > > The class LicenseManagerServlet is public. It instantiates an instance
> > > of the LicenseManager class which has package scope. Both classes are in
> > > the same package. The LicenseManager class is on the classpath. So why
> > > is this not working? I have done exactly this sort of thing with other
> > > servlet runners and it works just fine. Any ideas?
> > >
> > > Thanks,
> > >
> > > David
> >
> > --
> > - Benoît Mahé -------------------------------------------------------
> >                       World Wide Web Consortium   (W3C)
> >                     Architecture domain - Jigsaw Engineer
> >
> >                 http://www.w3.org/People/Mahe  - bmahe@w3.org
> > ---------------------------------------------------------------------
Received on Friday, 11 June 1999 18:40:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:29 GMT