TR: [opencms-dev] Help ! Resource loader error ...

Apostoly Guillaume ApostolyG at mail.europcar.com
Mon Jul 21 16:03:01 CEST 2003


Hi Matt,

So i tried the two tests : 
- the first gave the same error has usual
- the second gives me "java.lang.ClassNotFoundException:
com.europcar.intranet.Constants"
So i I though from the beginning, the class loader simply doesn't see my
class... This is very strange, my class IS actually in
WEB-INF/classes/com/europcar/intranet/ ....

Any clue ?

> -----Message d'origine-----
> De: M Butcher [mailto:mbutcher at grcomputing.net]
> Date: vendredi 18 juillet 2003 19:37
> À: opencms-dev at opencms.org
> Objet: RE: TR: [opencms-dev] Help ! Resource loader error ...
> 
> 
> Can you try adding a static method to the class, and calling 
> that? That
> might narrow down whether the problem is in the class loader or some
> nuance in the class itself.
> 
> So... add a method to Constants that looks like this:
> 
> public static String testMe() {
>     return "Test";
> } 
> 
> And call it (without a constructor) from the JSP:
> 
> <%
> out.println(Constants.testMe());
> %>
> 
> If that works, then at least we know the classloader is 
> working. If not,
> maybe another test would be a "manual" classload, where the JSP might
> look like this:
> 
> <%
> try {
> 
> Class constantsClass = 
> Class.forName("com.europcar.intranet.Constants");
> Constants constants = (Constants)constantsClass.newInstance();
> 
> } catch (Throwable t) {
>    out.println(t.toString());
> }
> %>
> 
> If that fails, then your know that the class isn't visible 
> (or useable)
> to the classloader. It may also give you some useful 
> information if it 
> fails.
> 
> Matt
> 
> On Fri, 2003-07-18 at 01:45, Apostoly Guillaume wrote:
> > Yes, here are my source code.
> > What is strange, is that the try catch doesn't catch 
> anything, i think the
> > jsp doesn't even compile in fact, for an unknown reason.
> > 
> > The JSP : 
> > <%@ page session="false" import="com.europcar.intranet.Constants" %>
> > <%
> > try
> > {
> > out.println("toto-titi");
> > com.europcar.intranet.Constants cts = new 
> com.europcar.intranet.Constants();
> > out.println("toto-titi");
> > }
> > catch (Exception e)
> > {
> > out.println(e);
> > }
> > %>
> > 
> > The class : in
> > 
> /modules/com.europcar.intranet/classes/com/europcar/intranet/C
> onstants.java
> > (i've got the equivalent in .class in the same directory, 
> the class name has
> > no influence (i tried also IntranetConstants by example))
> > 
> > /*
> >  * Constants.java
> >  *
> >  * Created on 8 juillet 2003, 10:32
> >  */
> > 
> > package com.europcar.intranet;
> > 
> > /**
> >  *
> >  * @author  apostolyg
> >  */
> > public class Constants
> > {
> > 
> >     /** Creates a new instance of Constants */
> >     public Constants()
> >     {
> >     }
> >     
> > }
> > 
> > If i give new tries, i'll post them.
> > Thanks a lot for your help Matt.
> > 
> > Regards,
> > 
> > Guillaume.
> > 
> > > -----Message d'origine-----
> > > De: M Butcher [mailto:mbutcher at grcomputing.net]
> > > Date: jeudi 17 juillet 2003 19:31
> > > À: opencms-dev at opencms.org
> > > Objet: RE: TR: [opencms-dev] Help ! Resource loader error ...
> > > 
> > > 
> > > Is it possible for you to post code samples?
> > > 
> > > One thing I encountered yesterday (and still haven't quite 
> > > figured out)
> > > is that a particular variable name (e.g. the line 'int 
> > > thisDate', though
> > > that's not the exact name -- I can't remember what the 
> real name was)
> > > was causing exactly the same problem as what you have 
> > > described. I would
> > > have expected some error about redeclaring an existing 
> > > variable, like I
> > > normally get when I do that, but that was not the case. 
> > > Anyway, changing
> > > the name of the variable fixed the problem.
> > > 
> > > A few more questions... though you're probably sick of my 
> asking them:
> > > 
> > > - Do you know the exact line of code that is causing the 
> exception?
> > > - Can you wrap that code in a try/catch and catch a more 
> informative 
> > > exception? (Do a  catch(Exception e) to make sure you get 
> stuff like
> > > NullPointerException)
> > > 
> > > Sorry I can't be of more help... at least I'm not telling you 
> > > to restart
> > > tomcat anymore. ;-)
> > > 
> > > Matt
> > > 
> > > 
> > > On Thu, 2003-07-17 at 10:27, Apostoly Guillaume wrote:
> > > > Already tried !
> > > > 
> > > > In fact, this is really misterious. If i take the .class from my
> > > > opencms/WEB-INF/classes and put it into another webapp, and 
> > > then build a jsp
> > > > in that webapp that makes "new myClass()", this works. If i 
> > > put the same jsp
> > > > into my opencms webapp directory, the class can not be 
> > > loaded ... I've tried
> > > > all sort of possible restarts/touch the file and so on !! 
> > > That's X-Files ...
> > > > :)
> > > > 
> > > > > -----Message d'origine-----
> > > > > De: Urich, Chase [mailto:ChaseUrich at letu.edu]
> > > > > Date: jeudi 17 juillet 2003 17:45
> > > > > À: opencms-dev at opencms.org
> > > > > Objet: RE: TR: [opencms-dev] Help ! Resource loader error ...
> > > > > 
> > > > > 
> > > > > Restart Tomcat?
> > > > > 
> > > > > Chase Urich
> > > > > LeTourneau University
> > > > > Web Programmer
> > > > > ---------------------
> > > > > Linux: Because rebooting is for adding hardware
> > > > > 
> > > > > -----Original Message-----
> > > > > From: Apostoly Guillaume [mailto:ApostolyG at mail.europcar.com] 
> > > > > Sent: Thursday, July 17, 2003 8:31 AM
> > > > > To: opencms-dev at opencms.org
> > > > > Subject: RE: TR: [opencms-dev] Help ! Resource loader 
> error ...
> > > > > 
> > > > > 
> > > > > thanks for your help, still ... any body else ? ;)
> > > > > 
> > > > > > -----Message d'origine-----
> > > > > > De: Mark Miller [mailto:mark.miller at hema.ch]
> > > > > > Date: jeudi 17 juillet 2003 14:55
> > > > > > À: opencms-dev at opencms.org
> > > > > > Objet: AW: TR: [opencms-dev] Help ! Resource loader 
> error ...
> > > > > > 
> > > > > > 
> > > > > > Hmmm ... sorry ... no more ideas
> > > > > > 
> > > > > > All the best (and good luck),
> > > > > > 
> > > > > > mark
> > > > > > 
> > > > > > _______________________________________________
> > > > > > This mail is send to you from the opencms-dev mailing list
> > > > > > To change your list options, or to unsubscribe from 
> the list,
> > > > > > please visit
> > > > > > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > > > > > 
> > > > > _______________________________________________
> > > > > This mail is send to you from the opencms-dev mailing list
> > > > > To change your list options, or to unsubscribe from the list, 
> > > > > please visit 
http://mail.opencms.org/mailman/listinfo/opencms-dev
> > > > _______________________________________________
> > > > This mail is send to you from the opencms-dev mailing list
> > > > To change your list options, or to unsubscribe from the list, 
> > > > please visit
> > > > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > > > 
> > > _______________________________________________
> > > This mail is send to you from the opencms-dev mailing list
> > > To change your list options, or to unsubscribe from the 
> > list, please visit
> > > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > -- 
> > M Butcher <mbutcher at grcomputing.net>
> > _______________________________________________
> > This mail is send to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the list, 
> > please visit
> > http://mail.opencms.org/mailman/listinfo/opencms-dev
> > 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
-- 
M Butcher <mbutcher at grcomputing.net>
_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list