1 Reply Latest reply on Apr 15, 2008 5:20 PM by lolotak

    Getting "org.jboss.seam.NoConversation" when updating model

    lolotak

      Good day everyone,
      I am working with jboss-4.2.2.GA, seam-2.0.0.GA and MySQL 5.0.45. I have a problem with updating multipart form. These facts are important I think: When I upload file that is about 10-20 KB big, everything works perfect, it is stored to the database, and I can update entity which contains this file with no problem.
      But when I upload file that is about 1 MB or bigger, it also stores to the database, but then, when I try to update the enclosing entity of that uploaded file, I get the org.jboss.seam.NoConversation message. It happens when I update random field of that entity. This file containing attribute is called data, and I also store its contents to filesystem. Here is part of the entity bean, which stores the data and filename attribute:


      @Column(name = "data", nullable = false)
      
           @NotNull
      
           public byte[] getData() {
      
                return this.data;
      
           }
      
      
           public void setData(byte[] data) {          
      
                if (data.length == 0)
      
                     return;
      
                this.data = data;          
      
           }
      
      
           @Column(name = "file_name", nullable = false, length = 100)
      
           @NotNull
      
           @Length(max = 100)
      
           public String getFileName() {
      
                
      
      
                if (data == null || regZnacka1 == null || regZnacka2 == null || id == null || data.length == 0)
      
                     return this.fileName;
      
                
      
                try{
      
                                    
      
                     File output = new File("D:/"+getRegZnacka1()+"/"+getRegZnacka2());
      
                     if (!output.exists())
      
                          output.mkdirs(); 
      
                     
      
                     output = new File("D:/"+getRegZnacka1()+"/"+getRegZnacka2()+"/_"+getId()+"_"+this.fileName);
      
                     
      
                     FileOutputStream oStream = new FileOutputStream(output);
      
                     if (!output.exists() || output.length() < data.length) {
      
                          oStream.write(data); 
      
                     }
      
                     
      
                     oStream.close();
      
                                    
      
                     output = new File("D:\\Develop\\jboss-4.2.2.GA\\server\\default\\deploy\\evidencia_zmluv_3.war\\tmp\\");
      
                     if (!output.exists())
      
                          output.mkdirs();
      
                     output = new File("D:\\Develop\\jboss-4.2.2.GA\\server\\default\\deploy\\evidencia_zmluv_3.war\\tmp\\"+getRegZnacka1()+getRegZnacka2()+"_"+getId()+"_"+this.fileName);
      
                     oStream = new FileOutputStream(output);
      
                     if (!output.exists() || output.length() < data.length) {
      
                          oStream.write(data); 
      
                     }
      
                     
      
                     oStream.close();
      
                     
      
                     
      
                }catch(Exception e){
      
      
                }
      
                return this.fileName;
      
                
      
           }
      
      
           public void setFileName(String fileName) {
      
                if (fileName == null || fileName.length() == 0)
      
                     return;
      
                this.fileName = fileName.replaceAll(" ", "_");
      
           }



      Here is the xhtml, where I upload the file


      <s:decorate id="dataDecoration" template="layout/edit.xhtml">
      
                 <ui:define name="label">data</ui:define>
      
                <s:fileUpload data="#{zmluvaHome.instance.data}"                      fileName="#{zmluvaHome.instance.fileName}" accept="" />
      
                  </s:decorate> 


      Anyone has some idea about this? Thank You