You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matthew Heaton <Ma...@apexlearning.com> on 2000/12/01 00:45:02 UTC

RE: Struts+Weblogic=Problems but this time it looks like it's Str uts

Does this effectively mean the Struts will not work in a distributed
(clustered) environment since if places Non Serializable objects into a
HttpSession?

-Matt

-----Original Message-----
From: David Chisholm [mailto:david_chisholm@i2.com]
Sent: Thursday, November 30, 2000 3:25 PM
To: struts-user@jakarta.apache.org
Subject: Re: Struts+Weblogic=Problems but this time it looks like it's
Struts


This is configurable (Servlet 2.2 spec, section 7.7.2) based on whether you
flag your application as distributed or not using the 'distributable'
element in the web.xml file.  If you flag your application as distributable,
then anything placed in the HttpSession has to be Serializable, and the
servlet container is supposed to throw an exception if it's not.
David


----- Original Message -----
From: "Matthew Heaton" <Ma...@apexlearning.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, November 30, 2000 4:38 PM
Subject: Struts+Weblogic=Problems but this time it looks like it's Struts


> I've been trying to get Struts to work on weblogic for many days with
little
> success because of the failures of Weblogic's part.  Finally tried to
deploy
> and use it on Weblogic 6.0 Beta 2 and noticed some interesting behavior.
It
> deployed fine but when I tried to run the example application I started
> getting errors saying that Weblogic could not deserialize the context
> attribute (see exact errors at end of mail)  It appears that Weblogic
> requires any object that you use as a context attribute on a JSP page must
> be serializable.  I went through some of the Struts source and it's trying
> to use objects which aren't serializable as JSP page context attributes.
> This looks like it may be a shortcoming in the JSP spec because it makes
> sense that to support to failover of sessions you would need to be able to
> serialize the attributes since the attributes of a PageContext may have
the
> scope of an entire session.  This is a bug that probably will show up on
> many different App Servers that support the failover of Sessions not just
> Weblogic and should probably be addressed in Struts even though it hasn't
> been directly addressed by the JSP 1.1 or 1.2 specs
>
> <Nov 30, 2000 1:19:37 PM PST> <Error> <HTTP>
> <[WebAppServletContext(6802820,struts-example)] Could not deserialize
> context attribute ava.io.NotSerializableException:
> org.apache.struts.util.MessageResources
>         at
> java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
>         at
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
>         at
> java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
>         at
> java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
>         at
> java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
>         at
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
>         at
>
weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:7
> 1)
>         at
>
weblogic.servlet.internal.WebAppServletContext.getAttribute(WebAppServletCon
> text.java
> :207)
>         at
>
weblogic.servlet.jsp.PageContextImpl.getAttribute(PageContextImpl.java:164)
>         at
> org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:230)
>         at jsp_servlet._index._jspService(_index.java:105)
>         at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> :208)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> :244)
>         at
>
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
> ntext.jav
> a:1107)
>         at
>
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
> :1482)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
> >
>
> -Matt

Re: using tags within tag parameter field ?

Posted by Pierre Métras <ge...@sympatico.ca>.
Hi Jim,


>
> I apologize as this is a generic jsp question and not specific to struts,
but
> hopefully this is a simple one (at least, I give a struts example below).
Is
> it possible to use a tag as an rtexprvalue within another tag's parameter
> field?  For example (assuming 'mytag' can take a rtexprvalue for parameter
> 'param'):
>
> <tag:mytag param="<tag:anothertag param=\"hello\"/>"/>

No. You can't use tags into tag attributes.

But with a little effort, you can rewrite your tag to support a syntax like:
<tag:mytag>
    <tag:param>
        <tag:anothertag param="hello"/>
    </tag:param>
</tag:mytag>

Else, you're stuck with ver.1 for now.

Pierre Métras


using tags within tag parameter field ?

Posted by Jim Newsham <ne...@hotu.com>.
I apologize as this is a generic jsp question and not specific to struts, but
hopefully this is a simple one (at least, I give a struts example below).  Is
it possible to use a tag as an rtexprvalue within another tag's parameter
field?  For example (assuming 'mytag' can take a rtexprvalue for parameter
'param'):

<tag:mytag param="<tag:anothertag param=\"hello\"/>"/>


As a struts example, here are two versions to show a dynamic list of simple
menu items (there's a java.util.Collection attribute named "menu" attached to
the request; it's a collection of beans with properties 'href' and 'text'),
which differ only on the second line.  The first version is quite ugly but
works.  The second version is what I'd like to use, but this doesn't work --
causes a compile exception.  I'm assuming the answer to my question is "no",
but does this mean I'm stuck with version 1, or is there a better way?


ver 1:
<logic:iterate id="menuitem" collection="<%=request.getAttribute(\"menu\")%>">
  <form:link href="<%=((com.hotu.intra.MenuItem)
pageContext.getAttribute(\"menuitem\")).getHref()%>">
    <bean:write name="menuitem" property="text"/>
  </form:link>
  <br>
</logic:iterate>


ver 2:
<logic:iterate id="menuitem" collection="<%=request.getAttribute(\"menu\")%>">
  <form:link href="<bean:write name=\"menuitem\" property=\"href\"/>">
    <bean:write name="menuitem" property="text"/>
  </form:link>
  <br>
</logic:iterate>


compile exception:
/home/newsham/work/intranet/main.jsp:30: ')' expected.
          _jspTag3.setHref("<bean:write name="menuitem" property="href"/>");
                                              ^
1 error

com.caucho.java.JavaCompileException: /home/newsham/work/intranet/main.jsp:30:
')' expected.
          _jspTag3.setHref("<bean:write name="menuitem" property="href"/>");
                                              ^
1 error


Thanks,

Jim Newsham


Re: Struts+Weblogic=Problems but this time it looks like it's Struts

Posted by David Chisholm <da...@i2.com>.
I can't answer that with certainty.
David


----- Original Message -----
From: "Matthew Heaton" <Ma...@apexlearning.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, November 30, 2000 5:45 PM
Subject: RE: Struts+Weblogic=Problems but this time it looks like it's
Struts


> Does this effectively mean the Struts will not work in a distributed
> (clustered) environment since if places Non Serializable objects into a
> HttpSession?
>
> -Matt
>
> -----Original Message-----
> From: David Chisholm [mailto:david_chisholm@i2.com]
> Sent: Thursday, November 30, 2000 3:25 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: Struts+Weblogic=Problems but this time it looks like it's
> Struts
>
>
> This is configurable (Servlet 2.2 spec, section 7.7.2) based on whether
you
> flag your application as distributed or not using the 'distributable'
> element in the web.xml file.  If you flag your application as
distributable,
> then anything placed in the HttpSession has to be Serializable, and the
> servlet container is supposed to throw an exception if it's not.
> David
>
>
> ----- Original Message -----
> From: "Matthew Heaton" <Ma...@apexlearning.com>
> To: <st...@jakarta.apache.org>
> Sent: Thursday, November 30, 2000 4:38 PM
> Subject: Struts+Weblogic=Problems but this time it looks like it's Struts
>
>
> > I've been trying to get Struts to work on weblogic for many days with
> little
> > success because of the failures of Weblogic's part.  Finally tried to
> deploy
> > and use it on Weblogic 6.0 Beta 2 and noticed some interesting behavior.
> It
> > deployed fine but when I tried to run the example application I started
> > getting errors saying that Weblogic could not deserialize the context
> > attribute (see exact errors at end of mail)  It appears that Weblogic
> > requires any object that you use as a context attribute on a JSP page
must
> > be serializable.  I went through some of the Struts source and it's
trying
> > to use objects which aren't serializable as JSP page context attributes.
> > This looks like it may be a shortcoming in the JSP spec because it makes
> > sense that to support to failover of sessions you would need to be able
to
> > serialize the attributes since the attributes of a PageContext may have
> the
> > scope of an entire session.  This is a bug that probably will show up on
> > many different App Servers that support the failover of Sessions not
just
> > Weblogic and should probably be addressed in Struts even though it
hasn't
> > been directly addressed by the JSP 1.1 or 1.2 specs
> >
> > <Nov 30, 2000 1:19:37 PM PST> <Error> <HTTP>
> > <[WebAppServletContext(6802820,struts-example)] Could not deserialize
> > context attribute ava.io.NotSerializableException:
> > org.apache.struts.util.MessageResources
> >         at
> > java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
> >         at
> > java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
> >         at
> >
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
> >         at
> >
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
> >         at
> > java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
> >         at
> > java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
> >         at
> >
>
weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:7
> > 1)
> >         at
> >
>
weblogic.servlet.internal.WebAppServletContext.getAttribute(WebAppServletCon
> > text.java
> > :207)
> >         at
> >
>
weblogic.servlet.jsp.PageContextImpl.getAttribute(PageContextImpl.java:164)
> >         at
> > org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:230)
> >         at jsp_servlet._index._jspService(_index.java:105)
> >         at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> >         at
> >
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> > :208)
> >         at
> >
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> > :244)
> >         at
> >
>
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
> > ntext.jav
> > a:1107)
> >         at
> >
>
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
> > :1482)
> >         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
> >         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
> > >
> >
> > -Matt