Re: <classloader> and web.xml

Scott Ferguson <[email protected]> Fri, 23 Jun 2006 13:26:58 -0700
Newsgroups gmane.text.xml.resin.user
Message-ID <[email protected]>
--Apple-Mail-11-988526450
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed


On Jun 23, 2006, at 8:03 AM, Geoffrey Wiseman wrote:

> I've been doing a little experimentation with setting up Resin so  
> that it can read the HTML and web.xml from the project source but  
> get the libraries and classes from Maven; I tried something like this:
>
> Turning the logs up to 'finest' doesn't seem to help -- I don't get  
> any more information that'd help me find out why it can't find the  
> class.  Suggestions?  Is it that resin is reading the web.xml  
> before it's hooked up to the classloader?  Is this a bug?
>
> resin 3.0.14 pro, btw; haven't tried upgrading to solve the problem.

You might try upgrading to 3.0.19 and use the <prologue> tag like:

<web-app id="...">
   <prologue>
     <class-loader>...</class-loader>
   </prologue>

The issue is that the <web-app-defaults> (including the web.xml) are  
concatenated and applied in order.  The <web-app> in the resin.conf  
is the last one evaluated.

So if you define a <class-loader> in the resin.conf's <web-app>, it  
will only be available after any <servlet> in the web.xml.

If you put the <class-loader> in a <prologue>, it's applied before  
any of the web-app-default.

So it looks like:

prologue phase:
     web-app-default (from app-default.xml)
         web.xml
         resin-web.xml
     web-app-default (somewhere else in resin.conf)
     web-app

"normal" config phase:
     web-app-default (from app-default.xml)
         web.xml
         resin-web.xml
     web-app-default (somewhere else in res.conf)
     web-app

So if you put the <class-loader> definitions in the <prologue>, it  
will be available to the web.xml in the "normal" phase.

-- Scott


>
> Thanks,
>
>     - Geoffrey
> Geoffrey Wiseman
> direct: 416.646.7124
>
> main: 416.646.7000
> fax: 416.646.7050
>
> Exchange Solutions Inc.
> 250 Yonge Street, 18th Floor
> Toronto, ON M5B 2L7
> www.exchangesolutions.com
>
>


--Apple-Mail-11-988526450
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; "><BR><DIV><DIV>On Jun 23, 2006, =
at 8:03 AM, Geoffrey Wiseman wrote:</DIV><BR =
class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite">  =
<DIV><SPAN class=3D"686303413-23062006"><FONT face=3D"Arial" =
size=3D"2">I've been doing a little experimentation with setting up =
Resin so that it can read the HTML and <A =
href=3D"http://web.xml">web.xml</A> from the project source but get the =
libraries and classes from Maven; I tried something like =
this:</FONT></SPAN></DIV> <DIV><SPAN class=3D"686303413-23062006"><FONT =
face=3D"Arial" size=3D"2"></FONT></SPAN>=A0</DIV> <DIV><FONT =
face=3D"Arial" size=3D"2"><SPAN class=3D"686303413-23062006">Turning the =
logs up to 'finest' doesn't seem to help -- I don't get any more =
information that'd help me find out why it can't find the class.=A0 =
Suggestions?=A0 Is it that resin is reading the <A =
href=3D"http://web.xml">web.xml</A> before it's hooked up to the =
classloader?=A0 Is this a bug?</SPAN></FONT></DIV> <DIV><FONT =
face=3D"Arial" size=3D"2"><SPAN =
class=3D"686303413-23062006"></SPAN></FONT>=A0</DIV> <DIV><FONT =
face=3D"Arial" size=3D"2"><SPAN class=3D"686303413-23062006">resin =
3.0.14 pro, btw; haven't tried upgrading to solve the =
problem.</SPAN></FONT></DIV></BLOCKQUOTE><DIV><BR =
class=3D"khtml-block-placeholder"></DIV>You might try upgrading to =
3.0.19 and use the &lt;prologue&gt; tag like:</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>&lt;web-app =
id=3D"..."&gt;</DIV><DIV>=A0 &lt;prologue&gt;</DIV><DIV>=A0=A0 =
=A0&lt;class-loader&gt;...&lt;/class-loader&gt;</DIV><DIV>=A0 =
&lt;/prologue&gt;</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>The issue is that the =
&lt;web-app-defaults&gt; (including the <A =
href=3D"http://web.xml">web.xml</A>) are concatenated and applied in =
order.=A0 The &lt;web-app&gt; in the resin.conf is the last one =
evaluated.</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>So =
if you define a &lt;class-loader&gt; in the resin.conf's =
&lt;web-app&gt;, it will only be available after any &lt;servlet&gt; in =
the <A href=3D"http://web.xml">web.xml</A>.</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>If you put the =
&lt;class-loader&gt; in a &lt;prologue&gt;, it's applied before any of =
the web-app-default.</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>So it looks =
like:</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>prologue =
phase:</DIV><DIV>=A0=A0 =A0web-app-default (from =
app-default.xml)</DIV><DIV>=A0 =A0 =A0=A0 =A0<A =
href=3D"http://web.xml">web.xml</A></DIV><DIV>=A0 =A0 =A0=A0 =
=A0resin-web.xml</DIV><DIV>=A0=A0 =A0web-app-default (somewhere else in =
resin.conf)</DIV><DIV>=A0=A0 =A0web-app</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>"normal" config =
phase:</DIV><DIV>=A0=A0 =A0web-app-default (from =
app-default.xml)</DIV><DIV>=A0 =A0 =A0=A0 =A0<A =
href=3D"http://web.xml">web.xml</A></DIV><DIV>=A0 =A0 =A0=A0 =
=A0resin-web.xml</DIV><DIV>=A0=A0 =A0web-app-default (somewhere else in =
res.conf)</DIV><DIV>=A0=A0 =A0web-app</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>So if you put the =
&lt;class-loader&gt; definitions in the &lt;prologue&gt;, it will be =
available to the <A href=3D"http://web.xml">web.xml</A> in the "normal" =
phase.</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>-- =
Scott</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR><BLOCKQUOTE =
type=3D"cite"> <DIV><FONT face=3D"Arial" size=3D"2"><SPAN =
class=3D"686303413-23062006"></SPAN></FONT>=A0</DIV> <DIV><FONT =
face=3D"Arial" size=3D"2"><SPAN =
class=3D"686303413-23062006">Thanks,</SPAN></FONT></DIV> <DIV><FONT =
face=3D"Arial" size=3D"2"><SPAN =
class=3D"686303413-23062006"></SPAN></FONT>=A0</DIV> <DIV><FONT =
face=3D"Arial" size=3D"2"><SPAN class=3D"686303413-23062006">=A0=A0=A0 - =
Geoffrey</SPAN></FONT></DIV> <DIV style=3D"BORDER-LEFT: #67121f 1px =
solid"><P style=3D"FONT-WEIGHT: bold; FONT-SIZE: 12px; MARGIN-LEFT: 9px; =
COLOR: #67121f; FONT-FAMILY: Arial, Helvetica, sans-serif" =
align=3D"left">Geoffrey Wiseman<BR>direct: 416.646.7124</P><P =
style=3D"FONT-SIZE: 12px; MARGIN-LEFT: 9px; COLOR: #848589; FONT-FAMILY: =
Arial, Helvetica, sans-serif">main: 416.646.7000 <BR>fax: 416.646.7050 =
</P><P style=3D"FONT-SIZE: 12px; MARGIN-LEFT: 9px; COLOR: #848589; =
FONT-FAMILY: Arial, Helvetica, sans-serif">Exchange Solutions =
Inc.<BR>250 Yonge Street, 18th Floor<BR>Toronto, ON M5B =
2L7<BR>www.exchangesolutions.com</P></DIV> =
<DIV>=A0</DIV></BLOCKQUOTE></DIV><BR></BODY></HTML>=

--Apple-Mail-11-988526450--