You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jonathan Fuerth <fu...@sqlpower.ca> on 2001/03/14 18:48:52 UTC

XSP and Classloader Trouble

Hi. This message may appear to be offtopic, but it isn't. :)

I'm using Tomcat 3.2.1 and Cocoon 1.8.2.  I want to be able to call my
own utility classes (which live within the web application context)
from an xsp page.  I think there's some sort of classloader problem
preventing me from doing this.  Details follow:

I wrote a little utility class called
ca.sqlpower.util.ZealousURLEncoder.zealousEncode(), and put its
compiled classfile in
$CONTEXT_ROOT/WEB-INF/classes/ca/sqlpower/util/ZealousURLEncoder.class.

I want to call my class from within an <xsp:logic> element.  I have
an <xsp:include>ca.sqlpower.util.*</xsp:include> statement within the
<xsp:structure> at the top of my xsp file.  This causes no problems.

When I try to call the zealousEncode method, however, I get this:

java.lang.NoClassDefFoundError: ca/sqlpower/util/ZealousURLEncoder

Does anyone have any hints?

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: XSP and Classloader Trouble

Posted by Tagunov Anthony <at...@nnt.ru>.
On Wed, 14 Mar 2001 18:07:17 -0500, Jonathan Fuerth wrote:

>On Wed, Mar 14, 2001 at 11:24:06PM +0300, Tagunov Anthony wrote:
>> On Wed, 14 Mar 2001 19:35:14 +0100 (CET), michele bianchi wrote:
>> >On Wed, 14 Mar 2001, Jonathan Fuerth wrote:
>> >> I'm using Tomcat 3.2.1 and Cocoon 1.8.2.  I want to be able to call my
>> >> own utility classes (which live within the web application context)
>> >> from an xsp page.  I think there's some sort of classloader problem
>> >> preventing me from doing this.  Details follow:
>> >> [...]
>> >> Does anyone have any hints?
>> >
>> >no way, see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11
>> 
>> Not completely convinced :-)))))))
>
>> Try you luck with the latest Tomcat from the cvs, those that is going to become
>
>Ok, I will give it a go.  It would be nice to have this problem
>solved!
>
>> So, soon, really soon the bug 11 may be marked as resolved!
>> (The only thing that makes me worried is how stable those
>> Tomcat 3.3 from cvs is? They are going to release 3.2 in the
>> nearest future and until 3.3 will be called stable, i'm afraid time
>> may pass. So currently i'm not sure on what to use in production
>> environment.)
>
>Right, well production is an issue.  We're developing an application
>that we plan to try and sell (all bundled in a WAR file).. asking a
>customer to add our JARs to their servlet container's classpath might
>not go over so well.. :)
>
>Out of curiosity, how could this be a Tomcat bug? (I'm not saying it
>isn't: I'm just asking out of interest) .. My own servlets in the same
>Tomcat context are able to use those utility classes, and they even
>reload them automatically if I set "reloadable=true" in the server.xml
>file. I've actually been doing this for some time now, but today was
>the first time I felt the need to call one of these utilities from an
>xsp.

Well, there's been an extensive discussion on tomcat-dev on the
issue, here are some letters from those thread:

http://mikal.org/interests/java/tomcat/archive/view?mesg=22444
http://mikal.org/interests/java/tomcat/archive/view?mesg=22494

So you can see that those problems are related to Cocoon being
on the Tomcat classpath. What reason Cocoon resides on the
system classpath i do not quite get now, but that was sure due
to some serious problems. (Anyone can remind me?)

But looks like with the latest Tomcats these problems are gone
and we now can put evrything (all jar: Xerces, Xalan,
cocoon.jar) into WEB-INF/lib

At least that is what Krzysztof Zielinski <kz...@supermedia.pl>
reported. Is his site http://ziel.sm.pl/ still down? It was up two days
ago running some tomcat 3.3-cvs+C1+C2 and the cocoons ran
there as _pure_ webapps.

BTW: this problem of "upper" (system?) classloader not being able
load from jars in WEB-INF/lib and classes from WEB-INF/classes
hits servlet developers on Tomcat very often.
Here's one more example:
http://mikal.org/interests/java/tomcat/archive/view?mesg=22448

People run into troubles with EJB's (from JBoss) trying to deserialize
something that resides in WEB-INF/lib as JBoss classes are on the
system classpath.. Some work is under way to build-in some
EJB capabilities into TC4, but i'm not strong at that so i can not
comment on how well Tomcat integrates with, say JBoss..

Anyway a work-around solution in the cases you can not
invent anything better is to put all that has to communicate
in the system classpath..

>Thanks for all the suggestions, everyone!
>
>-Jonathan Fuerth





---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: XSP and Classloader Trouble

Posted by Jonathan Fuerth <fu...@sqlpower.ca>.
On Wed, Mar 14, 2001 at 11:24:06PM +0300, Tagunov Anthony wrote:
> On Wed, 14 Mar 2001 19:35:14 +0100 (CET), michele bianchi wrote:
> >On Wed, 14 Mar 2001, Jonathan Fuerth wrote:
> >> I'm using Tomcat 3.2.1 and Cocoon 1.8.2.  I want to be able to call my
> >> own utility classes (which live within the web application context)
> >> from an xsp page.  I think there's some sort of classloader problem
> >> preventing me from doing this.  Details follow:
> >> [...]
> >> Does anyone have any hints?
> >
> >no way, see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11
> 
> Not completely convinced :-)))))))

> Try you luck with the latest Tomcat from the cvs, those that is going to become

Ok, I will give it a go.  It would be nice to have this problem
solved!

> So, soon, really soon the bug 11 may be marked as resolved!
> (The only thing that makes me worried is how stable those
> Tomcat 3.3 from cvs is? They are going to release 3.2 in the
> nearest future and until 3.3 will be called stable, i'm afraid time
> may pass. So currently i'm not sure on what to use in production
> environment.)

Right, well production is an issue.  We're developing an application
that we plan to try and sell (all bundled in a WAR file).. asking a
customer to add our JARs to their servlet container's classpath might
not go over so well.. :)

Out of curiosity, how could this be a Tomcat bug? (I'm not saying it
isn't: I'm just asking out of interest) .. My own servlets in the same
Tomcat context are able to use those utility classes, and they even
reload them automatically if I set "reloadable=true" in the server.xml
file. I've actually been doing this for some time now, but today was
the first time I felt the need to call one of these utilities from an
xsp.

Thanks for all the suggestions, everyone!

-Jonathan Fuerth

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: XSP and Classloader Trouble

Posted by michele bianchi <mi...@pow2.com>.
On Wed, 14 Mar 2001, Tagunov Anthony wrote:

> Not completely convinced :-)))))))
> So, soon, really soon the bug 11 may be marked as resolved!
> (The only thing that makes me worried is how stable those
> Tomcat 3.3 from cvs is? They are going to release 3.2 in the
> nearest future and until 3.3 will be called stable, i'm afraid time
> may pass. So currently i'm not sure on what to use in production
> environment.)

good news!  i'll try it.  anyway i remeber that here in the ml someone said
it's a problem of xsp classpath.  in fact tomcat 3.2.1 adds to the classpath
web-inf/classes and lib correctly.  with ias 4.1.1 i have the same problem
using xsp.

but i'll try again extensivvely with the current release of tomcat/cocoon

m

-------------------------------------------------------------------------------
dott. michele bianchi                                       power of two s.r.l.
phone +39 335 5384700                                      http://www.pow2.com



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: XSP and Classloader Trouble

Posted by Tagunov Anthony <at...@nnt.ru>.
On Wed, 14 Mar 2001 19:35:14 +0100 (CET), michele bianchi wrote:

>On Wed, 14 Mar 2001, Jonathan Fuerth wrote:
>
>> Hi. This message may appear to be offtopic, but it isn't. :)
>> 
>> I'm using Tomcat 3.2.1 and Cocoon 1.8.2.  I want to be able to call my
>> own utility classes (which live within the web application context)
>> from an xsp page.  I think there's some sort of classloader problem
>> preventing me from doing this.  Details follow:
>> 
>> I wrote a little utility class called
>> ca.sqlpower.util.ZealousURLEncoder.zealousEncode(), and put its
>> compiled classfile in
>> $CONTEXT_ROOT/WEB-INF/classes/ca/sqlpower/util/ZealousURLEncoder.class.
>> 
>> I want to call my class from within an <xsp:logic> element.  I have
>> an <xsp:include>ca.sqlpower.util.*</xsp:include> statement within the
>> <xsp:structure> at the top of my xsp file.  This causes no problems.
>> 
>> When I try to call the zealousEncode method, however, I get this:
>> 
>> java.lang.NoClassDefFoundError: ca/sqlpower/util/ZealousURLEncoder
>> 
>> Does anyone have any hints?
>
>no way, see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11

Not completely convinced :-)))))))

Try you luck with the latest Tomcat from the cvs, those that is going to become
Tomcat 3.3m2!  Krzysztof Zielicski is currently building and testing his
CDK (Cocoon Development Kit) -- a place for newbies to start using
Cocoon1 and Cocoon2 on Tomcat right out of the box without any addtional
setup -- CDK used to be available on http://ziel.sm.pl lately, but not sure
if the server is up now..

So, soon, really soon the bug 11 may be marked as resolved!
(The only thing that makes me worried is how stable those
Tomcat 3.3 from cvs is? They are going to release 3.2 in the
nearest future and until 3.3 will be called stable, i'm afraid time
may pass. So currently i'm not sure on what to use in production
environment.)

Best regards, Tagunov Anthony



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: XSP and Classloader Trouble

Posted by michele bianchi <mi...@pow2.com>.
On Wed, 14 Mar 2001, Jonathan Fuerth wrote:

> Hi. This message may appear to be offtopic, but it isn't. :)
> 
> I'm using Tomcat 3.2.1 and Cocoon 1.8.2.  I want to be able to call my
> own utility classes (which live within the web application context)
> from an xsp page.  I think there's some sort of classloader problem
> preventing me from doing this.  Details follow:
> 
> I wrote a little utility class called
> ca.sqlpower.util.ZealousURLEncoder.zealousEncode(), and put its
> compiled classfile in
> $CONTEXT_ROOT/WEB-INF/classes/ca/sqlpower/util/ZealousURLEncoder.class.
> 
> I want to call my class from within an <xsp:logic> element.  I have
> an <xsp:include>ca.sqlpower.util.*</xsp:include> statement within the
> <xsp:structure> at the top of my xsp file.  This causes no problems.
> 
> When I try to call the zealousEncode method, however, I get this:
> 
> java.lang.NoClassDefFoundError: ca/sqlpower/util/ZealousURLEncoder
> 
> Does anyone have any hints?

no way, see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11

m

-------------------------------------------------------------------------------
dott. michele bianchi                                       power of two s.r.l.
phone +39 335 5384700                                      http://www.pow2.com


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>