RE: <classloader> and web.xml

"Geoffrey Wiseman" <[email protected]> Tue, 27 Jun 2006 14:26:58 -0400
Newsgroups gmane.text.xml.resin.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.

------_=_NextPart_001_01C69A17.464F66A3
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Seems to solve it, but create a different problem; we have two web
applications with the same docroot but different configuration
parameters bound to two urls.  In 3.0.14, this doesn't seem to cause us
problems, but I don't have the prologue.  In 3.0.19, the prologue allows
me to integrate the classloader/docroot the way I want, but ... the two
applications seem to be having some sort of conflict with each other.
=20
If I comment either out, the other works.  If I leave them both in, the
second one loads and Resin seems to think the first one doesn't exist;
is this possibly because they have the same docroot?
=20
e.g.
      <!--
        Internal
      -->
      <web-app id=3D"/my-ri-internal" startup-mode=3D"automatic"
redeploy-mode=3D"automatic"
        document-directory=3D"path\to\my-ri\src\web">
        <prologue>
       <class-loader>
     <library-loader path=3D"path\to\my-ri\target\my-ri\WEB-INF\lib" />
     <simple-loader path=3D"path\to\my-ri\target\classes" />
            <simple-loader path=3D"path\to\my-ri\local\resin\config" />
   </class-loader>
        </prologue>
        <context-param applicationMode=3D'internal'/>
      </web-app>
=20
      <!--
        External
      -->
      <web-app id=3D"/my-ri-external" startup-mode=3D"lazy"
redeploy-mode=3D"automatic"
        document-directory=3D"path\to\my-ri\src\web">
        <prologue>
       <class-loader>
     <library-loader path=3D"path\to\my-ri\target\my-ri\WEB-INF\lib" />
     <simple-loader path=3D"path\to\my-ri\target\classes" />
            <simple-loader path=3D"path\to\my-ri\local\resin\config" />
   </class-loader>
        </prologue>
        <context-param applicationMode=3D'external'/>
      </web-app>
    </host>

As is, the external app loads, and the internal app 404s.  If comment
out the external app, then the internal one works just fine.


  _____ =20

From: [email protected]
[mailto:[email protected]] On Behalf Of Scott Ferguson
Sent: June 23, 2006 4:27 PM
To: [email protected]
Subject: Re: <classloader> and web.xml



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:
	=20
	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?
	=20
	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=3D"...">
  <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



	=20
	Thanks,
	=20
	    - Geoffrey

	Geoffrey Wiseman
	direct: 416.646.7124

	main: 416.646.7000=20
	fax: 416.646.7050=20

	Exchange Solutions Inc.
	250 Yonge Street, 18th Floor
	Toronto, ON M5B 2L7
	www.exchangesolutions.com

	=20



------_=_NextPart_001_01C69A17.464F66A3
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR></HEAD>
<BODY=20
style=3D"WORD-WRAP: break-word; khtml-nbsp-mode: space; =
khtml-line-break: after-white-space">
<DIV dir=3Dltr align=3Dleft><SPAN class=3D799462018-27062006><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Seems to solve it, but create a different =
problem; we have=20
two web applications with the same docroot but different configuration=20
parameters bound to two urls.&nbsp; In 3.0.14, this doesn't seem to =
cause us=20
problems, but I don't have the prologue.&nbsp; In 3.0.19, the prologue =
allows me=20
to integrate the classloader/docroot the way I want, but ... the two=20
applications seem to be having some sort of conflict with each=20
other.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D799462018-27062006><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D799462018-27062006><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>If I comment either out, the other works.&nbsp; =
If I leave=20
them both in, the second one loads and Resin seems to think the first =
one=20
doesn't exist; is this possibly because they have the same=20
docroot?</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D799462018-27062006><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D799462018-27062006><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>e.g.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D799462018-27062006><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;!--<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Internal<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
--&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;web-app =
id=3D"/my-ri-internal"=20
startup-mode=3D"automatic"=20
redeploy-mode=3D"automatic"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
document-directory=3D"path\to\my-ri\src\web"&gt;<BR>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
&lt;prologue&gt;<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=20
&lt;class-loader&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;library-loader=20
path=3D"path\to\my-ri\target\my-ri\WEB-INF\lib" =
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;simple-loader path=3D"path\to\my-ri\target\classes"=20
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
&lt;simple-loader path=3D"path\to\my-ri\local\resin\config" =
/&gt;<BR>&nbsp;&nbsp;=20
&lt;/class-loader&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/prologue&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;context-param=20
applicationMode=3D'internal'/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/web-app&gt;</FONT></SPAN></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D799462018-27062006><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;!--<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
External<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
--&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;web-app =
id=3D"/my-ri-external"=20
startup-mode=3D"lazy"=20
redeploy-mode=3D"automatic"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
document-directory=3D"path\to\my-ri\src\web"&gt;<BR>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
&lt;prologue&gt;<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=20
&lt;class-loader&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;library-loader=20
path=3D"path\to\my-ri\target\my-ri\WEB-INF\lib" =
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;simple-loader path=3D"path\to\my-ri\target\classes"=20
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
&lt;simple-loader path=3D"path\to\my-ri\local\resin\config" =
/&gt;<BR>&nbsp;&nbsp;=20
&lt;/class-loader&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/prologue&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;context-param=20
applicationMode=3D'external'/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/web-app&gt;<BR>&nbsp;&nbsp;&nbsp; =
&lt;/host&gt;<BR></FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D799462018-27062006><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>As is, the external app loads, and the internal =
app=20
404s.&nbsp; If&nbsp;comment out the external app, then the internal one =
works=20
just fine.</FONT></SPAN></DIV><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT><FONT=20
face=3DArial color=3D#0000ff size=3D2></FONT><FONT face=3DArial =
color=3D#0000ff=20
size=3D2></FONT><BR>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> =
[email protected]=20
[mailto:[email protected]] <B>On Behalf Of </B>Scott=20
Ferguson<BR><B>Sent:</B> June 23, 2006 4:27 PM<BR><B>To:</B>=20
[email protected]<BR><B>Subject:</B> Re: &lt;classloader&gt; and =

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

------_=_NextPart_001_01C69A17.464F66A3--