Hi

The file used for inputFile component is an xhtml file (JSF 2.0 Facelet environment). So cannot specify encoding as in xml file. Also in the <h:form> tag encoding is specified as "multipart/form-data" - this is as per instructions for using trinidad file upload component <tr:inputFile>


thanks

Sandeep

On 6/6/2013 12:41 PM, Krebs Roland / BWO Systems AG wrote:
Hello Sandeep

The core dump says that no encoding has been set, so try to add on top of your 
xhtml file your encoding, so for example:
        <?xml version="1.0" encoding="iso-8859-1" ?>
or
        <?xml version="1.0" encoding="UTF-8" ?>

Regards,
Roland

-----Ursprüngliche Nachricht-----
Von: Sandeep Gupta [mailto:[email protected]]
Gesendet: Donnerstag, 6. Juni 2013 08:04
An: [email protected]
Betreff: Trinidad: Null pointer exception in trinidad

Hi

I am using trinidad 2.0 in Jboss AS7 environment (JSF builtin Jboss) on windows 
. I am trying to upload a file to server using trinidad fileupload 
(tr:inputFile) component.

When the form is submitted to server on pressing a commandButton, I get 
Nullpointer exception. I have tried using tomahawk inputFileUpload component 
instaed of trinidad component for inputfile but the NPE remains same.

Any help/pointers to resolve this issue will be greatly appreciated.

rgds

Sandeep Gupta

java.lang.NullPointerException
        
org.apache.myfaces.trinidadinternal.config.upload.UploadRequestWrapper.setCharacterEncoding(UploadRequestWrapper.java:83)
        
com.sun.faces.context.ExternalContextImpl.setRequestCharacterEncoding(ExternalContextImpl.java:212)
        
javax.faces.context.ExternalContextWrapper.setRequestCharacterEncoding(ExternalContextWrapper.java:561)
        
javax.faces.context.ExternalContextWrapper.setRequestCharacterEncoding(ExternalContextWrapper.java:561)
        javax.faces.application.ViewHandler.initView(ViewHandler.java:488)
        
com.sun.faces.application.view.MultiViewHandler.initView(MultiViewHandler.java:111)
        
javax.faces.application.ViewHandlerWrapper.initView(ViewHandlerWrapper.java:274)
        
javax.faces.application.ViewHandlerWrapper.initView(ViewHandlerWrapper.java:274)
        
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:115)
        com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)



Here is my attachFile.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:f="http://java.sun.com/jsf/core";
xmlns:h="http://java.sun.com/jsf/html";
xmlns:ui="http://java.sun.com/jsf/facelets";
      xmlns:tr="http://myfaces.apache.org/trinidad";
xmlns:t="http://myfaces.apache.org/tomahawk"; >


<head>
<title>Choose File</title>

</head>
<body>

<f:view>
<tr:document>
<h:form enctype="multipart/form-data">
<tr:panelPage id="pp1">

               <tr:panelHeader text="Select File Dialog">

              <tr:panelBox id="pb1" text="Select File"
inlineStyle="width:100%;">

                      <tr:panelButtonBar id="pbb1" halign="end"
inlineStyle="width:100%;">
                      <tr:commandButton id="cb1" text="Done"
action="#{PackageJSFBean.doneAttachFile}"></tr:commandButton>
                      <tr:commandButton id="cb3" text="Cancel"
action="#{PackageJSFBean.cancelAttachFile}"
immediate="true"></tr:commandButton>
                      </tr:panelButtonBar>


                      <tr:panelFormLayout>



                      <tr:inputFile id="HighLevelIdentifiers"
label="Identifers file"
valueChangeListener="#{PackageJSFBean.onSelecthlIdFile}">
                      </tr:inputFile>


                      </tr:panelFormLayout>
                 </tr:panelBox>

              </tr:panelHeader>
              </tr:panelPage>
              </h:form>
              </tr:document>
</f:view>

</body>

</html>

Here is relevant portions of web.xml

<filter>
    <filter-name>trinidad</filter-name>
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>

    </filter>

   <filter-mapping>
    <filter-name>trinidad</filter-name>
    <servlet-name>faces</servlet-name>
</filter-mapping>



   <servlet>
    <servlet-name>Faces Servlet</servlet-name> 
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>

   <servlet>
    <servlet-name>faces</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    </servlet>

   <servlet>
    <servlet-name>resources</servlet-name>
<servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>

    </servlet>
   <servlet>

   <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
   </servlet-mapping>

    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

   <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>


Reply via email to