Well,
I have solved my own problem. As I expected, I was unable to get the struts
example to run (same types of errors, but related to the message tag this
time), so I gave up for the day and went home. I attempted to run the same
web apps (struts example and my EJB app) from a different system and it all
works fine! Apparently the problem has to do with the WebLogic classpath on
my desktop at work...since this is the only difference I am aware of.
Weblogic is not as forgiving as other servlet engines (I have used Tomcat
and JRun) when it comes to classpaths, so I suspect there is something
missing.

My other comment related to the error messages is still applicable though...
removeAttribute() should just do nothing but WebLogic throws an exception.
Watch out if you're using WebLogic! You probably think I am crazy right?
Well here's the stack trace...

Tue Jan 23 00:11:17 EST 2001:<E> <WebAppServletContext-plims> Servlet failed
with Exception
java.lang.NullPointerException
        at
weblogic.servlet.internal.ServletRequestImpl.removeAttribute(ServletRequestI
mpl.java:309)
        at
org.apache.struts.action.ActionBase.saveErrors(ActionBase.java:206)
        at
com.bipi.plims.view.UserAdminAction.perform(UserAdminAction.java:115)
        at
org.apache.struts.action.ActionServlet.processActionInstance(ActionServlet.j
ava:794)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:702)
        at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:314)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:106)
        at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:907)
        at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:851)
        at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:252)
        at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:364)
        at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:252)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)



-Bob


-----Original Message-----
From: Hayden,Robert IT BIP-US-R 
Sent: Monday, January 22, 2001 4:45 PM
To: [EMAIL PROTECTED]
Subject: ifPropertyEquals problem, and ErrorMessages problem


Hi,

I am new to Struts and trying to use the framework for a new project. I am
curious if anyone else using Struts has deployed to WebLogic (specifically
5.1) since this is the server I am using... and I am observing some strange
behavior. Of course this could all just be due to my own inexperience, but I
have thoroughly examined all the examples and I think what I am doing is
correct...

First of all, there is a problem if an ErrorMessages is created and set in
an ActionBase, but the contents remain null. For example:

ErrorMessages errors = new ErrorMessages();
... never add anything to errors ...
saveErrors(request, errors);

This will fail- WebLogic will throw an exception (because Struts tries to
remove a session attribute that does not exist). So, the quick fix is just
to do:

if ( errors.getSize() > 0 )
    saveErrors(request, errors);


My second and more important issue has to do with the use of the Struts
tags: ifPropertyEquals and ifPropertyNotEquals. When I try to use these
tags, WebLogic seems to be throwing an exception during JSP page
compilation. When I take them out, the page complies and displays just fine.
The error message "userForm is not defined as a bean" seems to indicate that
this bean is not present. Here is what is in my action.xml for this mapping:

  <action    path="/userEdit"
      actionClass="com.bipi.plims.view.UserEditAction"
    formAttribute="userForm"
        formClass="com.bipi.plims.model.UserForm"
        inputForm="/userEdit.jsp">
    <forward name="success"    path="/mainMenu.jsp"/>
  </action>

And here is a piece of the JSP:

                <struts:ifPropertyEquals name="userForm"
                               property="action" value="new">
                        <struts:submit property="submit" value="Create
User"/>
                </struts:ifPropertyEquals>

When I try to access this page, this is the output generated by the WebLogic
console:

Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> action:
Processing a POST for /userEdit
Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> action:
Looking for ActionForm bean under attribute 'userForm'
Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> action:
Populating bean properties from this request
Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> action:
Validating bean properties
Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> resolving
taglib uri '/WEB-INF/struts.tld' to taglib-location /WEB-INF/struts.tld:
Mon Jan 22 16:07:20 EST 2001:<E> <WebAppServletContext-plims> Servlet failed
with Exception
weblogic.servlet.jsp.JspException: (line 32): userForm is not defined as
bean
        at weblogic.servlet.jsp.JspLexer.jspException(JspLexer.java:610)
        at weblogic.servlet.jsp.JspLexer.mXML_GET_PROPERTY(JspLexer.java,
Compiled Code)
        at weblogic.servlet.jsp.JspLexer.mXML_THING(JspLexer.java:1584)
        at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java, Compiled
Code)
        at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java, Compiled
Code)
        at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java, Compiled Code)
        at weblogic.servlet.jsp.JspParser.doit(JspParser.java, Compiled
Code)
        at weblogic.servlet.jsp.JspParser.parse(JspParser.java:116)
        at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:97)
        at
weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java, Compiled
Code)
        at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java, Compiled
Code)
        at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:180)
        at
weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:18
1)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:118)
        at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:154)
        at
org.apache.struts.action.ActionServlet.processActionInstance(ActionServlet.j
ava:803)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:702)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:332)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:772)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:123)
        at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:154)
        at
org.apache.struts.action.ActionServlet.processActionInstance(ActionServlet.j
ava:803)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:702)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:332)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:772)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:123)
        at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:761)
        at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:708)
        at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:252)
        at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:346)
        at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:246)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)



Just wondering if anyone has any suggestions, before I dig into the code and
search for the problem... I have not tried to run the sample project on
WebLogic yet (only on JRun which works fine) but this is my next step since
this would prove if I am doing something wrong :)

Thanks,
Bob


Robert Hayden
Lead Software Engineer
Boehringer Ingelheim Pharmaceuticals Inc.
(203) 798-5034
[EMAIL PROTECTED]

Reply via email to