You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Colin Sampaleanu <co...@Bspark.com> on 2000/08/30 00:18:28 UTC

Using struts with WebLogic 5.1

Is anybody successfully using Struts with WebLogic 5.1 (SP 5)?

I have used Struts with a number of other JSP/Servlet implementations.
WebLogic is presenting problems however.

First of all, it does not allow servlet preloading (as the spec requires),
which breaks the demo app, but that's not a big deal.

The major issue however is that it seems to be getting confused with regards
to classloaders somehow. The ApplicationServlet creates a MessageResource,
and stuffs the object into the servlet context (ie application scope). When
a tag such as the MessageTag comes along and does a
'pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE);' to get
back the same MessageResource, it does get a MessageResource object, but
there is a ClassCastException when trying to cast it to MessageResource.
Looking at the two Class objects (the one returned by Class.forname(...) at
that point, and the one returned by the getAttribute, they are both
'org.apache.struts.util.MessageResources' Class objects, but the actual
physical objects are different. I would presume this to means the
classloader is different, and indeed, calling getClassLoader on each object
returns a different classloader.

Anybody have a clue what is going on?

Re: Using struts with WebLogic 5.1

Posted by Daniel Abrams <ma...@masslight.com>.
There is a serious bug in the current WebLogic dynamic class loader, in that
it loads classes that have already been loaded.  This results in a class
cast exception, and is very likely the problem you are seeing.

Daniel


----- Original Message -----
From: "Colin Sampaleanu" <co...@Bspark.com>
To: <st...@jakarta.apache.org>
Sent: Tuesday, August 29, 2000 6:18 PM
Subject: Using struts with WebLogic 5.1


> Is anybody successfully using Struts with WebLogic 5.1 (SP 5)?
>
> I have used Struts with a number of other JSP/Servlet implementations.
> WebLogic is presenting problems however.
>
> First of all, it does not allow servlet preloading (as the spec requires),
> which breaks the demo app, but that's not a big deal.
>
> The major issue however is that it seems to be getting confused with
regards
> to classloaders somehow. The ApplicationServlet creates a MessageResource,
> and stuffs the object into the servlet context (ie application scope).
When
> a tag such as the MessageTag comes along and does a
> 'pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE);' to get
> back the same MessageResource, it does get a MessageResource object, but
> there is a ClassCastException when trying to cast it to MessageResource.
> Looking at the two Class objects (the one returned by Class.forname(...)
at
> that point, and the one returned by the getAttribute, they are both
> 'org.apache.struts.util.MessageResources' Class objects, but the actual
> physical objects are different. I would presume this to means the
> classloader is different, and indeed, calling getClassLoader on each
object
> returns a different classloader.
>
> Anybody have a clue what is going on?
>


Re: Using struts with WebLogic 5.1

Posted by Wong Kok Wai <wo...@pacific.net.sg>.
Actually there is another minor error message that WLS 5.1 keeps showing that
never got fixed:

[ExternalEntity] : Could not resolve entity '-//Sun Microsystems, Inc.//DTD Web
Application 2.2//EN'.  Check your dtd reference.

>


Re: Using struts with WebLogic 5.1

Posted by Rod McChesney <ro...@expressaction.com>.
> That's very strange, can you confirm that you are really running SP5?

I definitely am, but you're right, the PageContextImpl bug appears
to be fixed. I just downloaded the latest struts build and it now
works unmodified. I thought I had reproduced the problem even after
applying SP5, but it seems I got confused :-(

Anyway, it works now.

> these bugs are completely unacceptable
> (never mind pathetic, how could bugs this simple and obvious
> get through any kind of testing?).

Yeah, no kidding, that was exactly my reaction. Nothing like spinning
one's wheels debugging the vendor's bugs...

Thanks,

Rod

Colin Sampaleanu wrote:
> 
> That's very strange, can you confirm that you are really running SP5?
> WebLogic 5.10 SP 3 and 4 (and presumably earlier), did have another really
> nasty bug which resulted in a null pointer exception when you called
> pageContext.getAttribute(). Their PageContext implementation never
> initialized the 'context' variable they subsequently used in 'getAttribute'
> and 'setAttribute'. I actually decompiled their file PageContextImpl.class
> to verify this. It is on the list of fixes for SP5, and I even verified the
> fix by decompiling and running the new code. So if you are getting this
> error in SP5 my assumption is that you did not actually end up applying the
> patch properly, or something really weird is going on.
> 
> As for the ClassCastException, yes, I was running struts out of compiled
> classes under the classes dir, not struts.jar in the WEB-INF/lib dir (since
> I had been working on the other problem), so I will try your suggestion.
> 
> I think for a product that has reached service pack 5, has such a large
> market share and commensurate resources behind it, these bugs are completely
> unacceptable (never mind pathetic, how could bugs this simple and obvious
> get through any kind of testing?).
> 
> Everybody else on the list who doesn't give a damn about WebLogic, sorry
> about all the noise. WL is a big player though so a lot of people want/need
> to get struts going with it...
> 
> -----Original Message-----
> From: Rod McChesney [mailto:rodm@expressaction.com]
> Sent: Tuesday, August 29, 2000 6:31 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: Using struts with WebLogic 5.1
> 
> I'm using WebLogic 5.1 SP 5 as well, and there's a fix you'll have to
> make. For the class cast exception, putting struts.jar into
> your WEB-INF/lib directory should fix it, I believe.
> 
> Once you do that you'll get another error. pageContext.getAttribute() and
> setAttribute in APPLICATION_SCOPE both get a null pointer exception. The
> fix: find every occurrence of those calls in struts and change them to
> pageContext.getServletContext().getAttribute and setAttribute.
> 
> HTH,
> 
> Rod McChesney
> 
> Colin Sampaleanu wrote:
> >
> > Is anybody successfully using Struts with WebLogic 5.1 (SP 5)?
> >
> > I have used Struts with a number of other JSP/Servlet implementations.
> > WebLogic is presenting problems however.
> >
> > First of all, it does not allow servlet preloading (as the spec requires),
> > which breaks the demo app, but that's not a big deal.
> >
> > The major issue however is that it seems to be getting confused with
> regards
> > to classloaders somehow. The ApplicationServlet creates a MessageResource,
> > and stuffs the object into the servlet context (ie application scope).
> When
> > a tag such as the MessageTag comes along and does a
> > 'pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE);' to get
> > back the same MessageResource, it does get a MessageResource object, but
> > there is a ClassCastException when trying to cast it to MessageResource.
> > Looking at the two Class objects (the one returned by Class.forname(...)
> at
> > that point, and the one returned by the getAttribute, they are both
> > 'org.apache.struts.util.MessageResources' Class objects, but the actual
> > physical objects are different. I would presume this to means the
> > classloader is different, and indeed, calling getClassLoader on each
> object
> > returns a different classloader.
> >
> > Anybody have a clue what is going on?

RE: Using struts with WebLogic 5.1

Posted by Colin Sampaleanu <ca...@exis.com>.
That's very strange, can you confirm that you are really running SP5?
WebLogic 5.10 SP 3 and 4 (and presumably earlier), did have another really
nasty bug which resulted in a null pointer exception when you called
pageContext.getAttribute(). Their PageContext implementation never
initialized the 'context' variable they subsequently used in 'getAttribute'
and 'setAttribute'. I actually decompiled their file PageContextImpl.class
to verify this. It is on the list of fixes for SP5, and I even verified the
fix by decompiling and running the new code. So if you are getting this
error in SP5 my assumption is that you did not actually end up applying the
patch properly, or something really weird is going on.

As for the ClassCastException, yes, I was running struts out of compiled
classes under the classes dir, not struts.jar in the WEB-INF/lib dir (since
I had been working on the other problem), so I will try your suggestion.

I think for a product that has reached service pack 5, has such a large
market share and commensurate resources behind it, these bugs are completely
unacceptable (never mind pathetic, how could bugs this simple and obvious
get through any kind of testing?).

Everybody else on the list who doesn't give a damn about WebLogic, sorry
about all the noise. WL is a big player though so a lot of people want/need
to get struts going with it...



-----Original Message-----
From: Rod McChesney [mailto:rodm@expressaction.com]
Sent: Tuesday, August 29, 2000 6:31 PM
To: struts-user@jakarta.apache.org
Subject: Re: Using struts with WebLogic 5.1


I'm using WebLogic 5.1 SP 5 as well, and there's a fix you'll have to
make. For the class cast exception, putting struts.jar into
your WEB-INF/lib directory should fix it, I believe.

Once you do that you'll get another error. pageContext.getAttribute() and
setAttribute in APPLICATION_SCOPE both get a null pointer exception. The
fix: find every occurrence of those calls in struts and change them to
pageContext.getServletContext().getAttribute and setAttribute.

HTH,

Rod McChesney


Colin Sampaleanu wrote:
>
> Is anybody successfully using Struts with WebLogic 5.1 (SP 5)?
>
> I have used Struts with a number of other JSP/Servlet implementations.
> WebLogic is presenting problems however.
>
> First of all, it does not allow servlet preloading (as the spec requires),
> which breaks the demo app, but that's not a big deal.
>
> The major issue however is that it seems to be getting confused with
regards
> to classloaders somehow. The ApplicationServlet creates a MessageResource,
> and stuffs the object into the servlet context (ie application scope).
When
> a tag such as the MessageTag comes along and does a
> 'pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE);' to get
> back the same MessageResource, it does get a MessageResource object, but
> there is a ClassCastException when trying to cast it to MessageResource.
> Looking at the two Class objects (the one returned by Class.forname(...)
at
> that point, and the one returned by the getAttribute, they are both
> 'org.apache.struts.util.MessageResources' Class objects, but the actual
> physical objects are different. I would presume this to means the
> classloader is different, and indeed, calling getClassLoader on each
object
> returns a different classloader.
>
> Anybody have a clue what is going on?


Re: Using struts with WebLogic 5.1

Posted by Rod McChesney <ro...@expressaction.com>.
I'm using WebLogic 5.1 SP 5 as well, and there's a fix you'll have to
make. For the class cast exception, putting struts.jar into
your WEB-INF/lib directory should fix it, I believe.

Once you do that you'll get another error. pageContext.getAttribute() and 
setAttribute in APPLICATION_SCOPE both get a null pointer exception. The 
fix: find every occurrence of those calls in struts and change them to
pageContext.getServletContext().getAttribute and setAttribute.

HTH,

Rod McChesney


Colin Sampaleanu wrote:
> 
> Is anybody successfully using Struts with WebLogic 5.1 (SP 5)?
> 
> I have used Struts with a number of other JSP/Servlet implementations.
> WebLogic is presenting problems however.
> 
> First of all, it does not allow servlet preloading (as the spec requires),
> which breaks the demo app, but that's not a big deal.
> 
> The major issue however is that it seems to be getting confused with regards
> to classloaders somehow. The ApplicationServlet creates a MessageResource,
> and stuffs the object into the servlet context (ie application scope). When
> a tag such as the MessageTag comes along and does a
> 'pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE);' to get
> back the same MessageResource, it does get a MessageResource object, but
> there is a ClassCastException when trying to cast it to MessageResource.
> Looking at the two Class objects (the one returned by Class.forname(...) at
> that point, and the one returned by the getAttribute, they are both
> 'org.apache.struts.util.MessageResources' Class objects, but the actual
> physical objects are different. I would presume this to means the
> classloader is different, and indeed, calling getClassLoader on each object
> returns a different classloader.
> 
> Anybody have a clue what is going on?