You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dimitris Mouchritsas <di...@eurodyn.com> on 2008/06/30 16:41:23 UTC

JAZN Exception when posting form with ecntype="multipart/form-data"

Hi all,
we've recently upgraded our j2ee application to use struts 1.3.8 and 
we're getting a weird exception when trying to
upload a file. Here's the jsp:

testFileUpload.jsp
=================================================================================================
<%@ page contentType="text/html;charset=utf-8"%>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>

<html:xhtml />

<html:form method="post" action="test/prepareTestFileUpload" 
enctype="multipart/form-data"> 
           <p>
            <label for="Attachment" class="w33">
                <span class="Mandatory">*</span> Attachment:
            </label>
            <html:file property="attachment" styleId="Attachment" 
styleClass="w33" size="40" />
        </p>
        <p><button type="submit">Save changes</button>    </p>       
</html:form>
===================================================================================================
       
Here's the action:

//------------------------------------------------------------------------------
//$Id: PrepareTestFileUploadAction.java,v 1.1 2008/06/30 12:26:53 kshe Exp $
//$Author: kshe $
//$Date: 2008/06/30 12:26:53 $
//$Revision: 1.1 $
//------------------------------------------------------------------------------
package my.company.web.actions.test;

import java.rmi.RemoteException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;


import my.company.web.actions.common.BaseAction;

import my.company.web.forms.TestUploadForm;

/**
 * @custom.security-filter operation="public"
 *
 * @struts.action path="/test/prepareTestFileUpload"
 *                name="testUploadForm" input="/test/prepareTestFileUpload"
 *
 * @struts.action-forward name="goForward" path="test.file.upload"
 */
public class PrepareTestFileUploadAction extends BaseAction {

    private static Logger log = 
Logger.getLogger(PrepareTestFileUploadAction.class);
   

    public PrepareTestFileUploadAction()  {
        super();
    }

    public ActionForward doExecute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws RepException, RemoteException {

        String forward = "goForward";
        TestUploadForm testForm = (TestUploadForm)form;

        FormFile file = testForm.getAttachment();

        if (file != null) {
            log.debug("File: " + file.getFileName());
        } else {
            log.debug("File == null");
        }


        return mapping.findForward(forward);
    }
}


It seems we're able to get the filename on the server side, but when it 
tries to go forward
here's the exception we get:

Caused by: javax.servlet.ServletException: JAAS-OC4J: 
JAZNFilter.doFilter - unable to find the current servlet
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at 
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
    at 
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at 
com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
    at 
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
    at 
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
    at 
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
    at 
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at 
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at 
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
    at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at 
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
    at 
com.ed.ecomm.edcore.web.filters.SecurityFilter.doFilter(SecurityFilter.java:196)
    at 
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
    at 
com.ed.ecomm.edcore.web.filters.MonitoringFilter.doFilter(MonitoringFilter.java:138)
    at 
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
    at 
com.ed.ecomm.edcore.web.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92)
    at 
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
    at 
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at 
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    ... 4 more
     -----


Any ideas what could be wrong?

Thanks
Dimitris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: JAZN Exception when posting form with ecntype="multipart/form-data"

Posted by Dimitris Mouchritsas <di...@eurodyn.com>.
Dimitris Mouchritsas wrote:
> Dimitris Mouchritsas wrote:
>> Hi all,
>> we've recently upgraded our j2ee application to use struts 1.3.8 and 
>> we're getting a weird exception when trying to
>> upload a file. Here's the jsp:
>>
>> testFileUpload.jsp
>> ================================================================================================= 
>>
>> <%@ page contentType="text/html;charset=utf-8"%>
>> <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles"%>
>> <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
>> <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
>> <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>
>>
>> <html:xhtml />
>>
>> <html:form method="post" action="test/prepareTestFileUpload" 
>> enctype="multipart/form-data">           <p>
>>            <label for="Attachment" class="w33">
>>                <span class="Mandatory">*</span> Attachment:
>>            </label>
>>            <html:file property="attachment" styleId="Attachment" 
>> styleClass="w33" size="40" />
>>        </p>
>>        <p><button type="submit">Save changes</button>    </p>       
>> </html:form>
>> =================================================================================================== 
>>
>>       Here's the action:
>>
>> //------------------------------------------------------------------------------ 
>>
>> //$Id: PrepareTestFileUploadAction.java,v 1.1 2008/06/30 12:26:53 
>> kshe Exp $
>> //$Author: kshe $
>> //$Date: 2008/06/30 12:26:53 $
>> //$Revision: 1.1 $
>> //------------------------------------------------------------------------------ 
>>
>> package my.company.web.actions.test;
>>
>> import java.rmi.RemoteException;
>>
>> import javax.servlet.http.HttpServletRequest;
>> import javax.servlet.http.HttpServletResponse;
>>
>> import org.apache.log4j.Logger;
>> import org.apache.struts.action.ActionForm;
>> import org.apache.struts.action.ActionForward;
>> import org.apache.struts.action.ActionMapping;
>> import org.apache.struts.upload.FormFile;
>>
>>
>> import my.company.web.actions.common.BaseAction;
>>
>> import my.company.web.forms.TestUploadForm;
>>
>> /**
>> * @custom.security-filter operation="public"
>> *
>> * @struts.action path="/test/prepareTestFileUpload"
>> *                name="testUploadForm" 
>> input="/test/prepareTestFileUpload"
>> *
>> * @struts.action-forward name="goForward" path="test.file.upload"
>> */
>> public class PrepareTestFileUploadAction extends BaseAction {
>>
>>    private static Logger log = 
>> Logger.getLogger(PrepareTestFileUploadAction.class);
>>  
>>    public PrepareTestFileUploadAction()  {
>>        super();
>>    }
>>
>>    public ActionForward doExecute(ActionMapping mapping, ActionForm 
>> form,
>>            HttpServletRequest request, HttpServletResponse response)
>>            throws RepException, RemoteException {
>>
>>        String forward = "goForward";
>>        TestUploadForm testForm = (TestUploadForm)form;
>>
>>        FormFile file = testForm.getAttachment();
>>
>>        if (file != null) {
>>            log.debug("File: " + file.getFileName());
>>        } else {
>>            log.debug("File == null");
>>        }
>>
>>
>>        return mapping.findForward(forward);
>>    }
>> }
>>
>>
>> It seems we're able to get the filename on the server side, but when 
>> it tries to go forward
>> here's the exception we get:
>>
>> Caused by: javax.servlet.ServletException: JAAS-OC4J: 
>> JAZNFilter.doFilter - unable to find the current servlet
>>    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
>>    at 
>> com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) 
>>
>>    at 
>> com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) 
>>
>>    at 
>> com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222) 
>>
>>    at 
>> org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113) 
>>
>>    at 
>> org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96) 
>>
>>    at 
>> org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54) 
>>
>>    at 
>> org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) 
>>
>>    at 
>> org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>>    at 
>> org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305) 
>>
>>    at 
>> org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>>    at 
>> org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) 
>>
>>    at 
>> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
>>    at 
>> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>>    at 
>> com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) 
>>
>>    at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
>>    at java.security.AccessController.doPrivileged(Native Method)
>>    at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
>>    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
>>    at 
>> com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16) 
>>
>>    at 
>> com.ed.ecomm.edcore.web.filters.SecurityFilter.doFilter(SecurityFilter.java:196) 
>>
>>    at 
>> com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20) 
>>
>>    at 
>> com.ed.ecomm.edcore.web.filters.MonitoringFilter.doFilter(MonitoringFilter.java:138) 
>>
>>    at 
>> com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20) 
>>
>>    at 
>> com.ed.ecomm.edcore.web.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92) 
>>
>>    at 
>> com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659) 
>>
>>    at 
>> com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) 
>>
>>    at 
>> com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830) 
>>
>>    ... 4 more
>>     -----
>>
>>
>> Any ideas what could be wrong?
>>
>> Thanks
>> Dimitris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> I added some code and I can see that I get the filename from the 
> formbean FormFile. But when it tries to
> forward to the next action we get the exception. Any ideas?
>
> Dimitris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
The problem seems to be fixed if we change
<jazn-web-app auth-method="BASIC" jaas-mode="doAs" 
doasprivileged-mode="true" />
in orion-application.xml


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: JAZN Exception when posting form with ecntype="multipart/form-data"

Posted by Dimitris Mouchritsas <di...@eurodyn.com>.
Dimitris Mouchritsas wrote:
> Hi all,
> we've recently upgraded our j2ee application to use struts 1.3.8 and 
> we're getting a weird exception when trying to
> upload a file. Here's the jsp:
>
> testFileUpload.jsp
> ================================================================================================= 
>
> <%@ page contentType="text/html;charset=utf-8"%>
> <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles"%>
> <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
> <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
> <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>
>
> <html:xhtml />
>
> <html:form method="post" action="test/prepareTestFileUpload" 
> enctype="multipart/form-data">           <p>
>            <label for="Attachment" class="w33">
>                <span class="Mandatory">*</span> Attachment:
>            </label>
>            <html:file property="attachment" styleId="Attachment" 
> styleClass="w33" size="40" />
>        </p>
>        <p><button type="submit">Save changes</button>    </p>       
> </html:form>
> =================================================================================================== 
>
>       Here's the action:
>
> //------------------------------------------------------------------------------ 
>
> //$Id: PrepareTestFileUploadAction.java,v 1.1 2008/06/30 12:26:53 kshe 
> Exp $
> //$Author: kshe $
> //$Date: 2008/06/30 12:26:53 $
> //$Revision: 1.1 $
> //------------------------------------------------------------------------------ 
>
> package my.company.web.actions.test;
>
> import java.rmi.RemoteException;
>
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import org.apache.log4j.Logger;
> import org.apache.struts.action.ActionForm;
> import org.apache.struts.action.ActionForward;
> import org.apache.struts.action.ActionMapping;
> import org.apache.struts.upload.FormFile;
>
>
> import my.company.web.actions.common.BaseAction;
>
> import my.company.web.forms.TestUploadForm;
>
> /**
> * @custom.security-filter operation="public"
> *
> * @struts.action path="/test/prepareTestFileUpload"
> *                name="testUploadForm" 
> input="/test/prepareTestFileUpload"
> *
> * @struts.action-forward name="goForward" path="test.file.upload"
> */
> public class PrepareTestFileUploadAction extends BaseAction {
>
>    private static Logger log = 
> Logger.getLogger(PrepareTestFileUploadAction.class);
>  
>    public PrepareTestFileUploadAction()  {
>        super();
>    }
>
>    public ActionForward doExecute(ActionMapping mapping, ActionForm form,
>            HttpServletRequest request, HttpServletResponse response)
>            throws RepException, RemoteException {
>
>        String forward = "goForward";
>        TestUploadForm testForm = (TestUploadForm)form;
>
>        FormFile file = testForm.getAttachment();
>
>        if (file != null) {
>            log.debug("File: " + file.getFileName());
>        } else {
>            log.debug("File == null");
>        }
>
>
>        return mapping.findForward(forward);
>    }
> }
>
>
> It seems we're able to get the filename on the server side, but when 
> it tries to go forward
> here's the exception we get:
>
> Caused by: javax.servlet.ServletException: JAAS-OC4J: 
> JAZNFilter.doFilter - unable to find the current servlet
>    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
>    at 
> com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) 
>
>    at 
> com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) 
>
>    at 
> com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222) 
>
>    at 
> org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113) 
>
>    at 
> org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96) 
>
>    at 
> org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54) 
>
>    at 
> org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) 
>
>    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>    at 
> org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305) 
>
>    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>    at 
> org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) 
>
>    at 
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
>    at 
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>    at 
> com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) 
>
>    at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
>    at java.security.AccessController.doPrivileged(Native Method)
>    at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
>    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
>    at 
> com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16) 
>
>    at 
> com.ed.ecomm.edcore.web.filters.SecurityFilter.doFilter(SecurityFilter.java:196) 
>
>    at 
> com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20) 
>
>    at 
> com.ed.ecomm.edcore.web.filters.MonitoringFilter.doFilter(MonitoringFilter.java:138) 
>
>    at 
> com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20) 
>
>    at 
> com.ed.ecomm.edcore.web.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92) 
>
>    at 
> com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659) 
>
>    at 
> com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) 
>
>    at 
> com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830) 
>
>    ... 4 more
>     -----
>
>
> Any ideas what could be wrong?
>
> Thanks
> Dimitris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
I added some code and I can see that I get the filename from the 
formbean FormFile. But when it tries to
forward to the next action we get the exception. Any ideas?

Dimitris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org