Announcement Announcement Module
Collapse
No announcement yet.
Issue with Persisting Blob to Database Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue with Persisting Blob to Database

    So, I am able to persist to the database the Blob, BUT when it trys to resume execution on the flow I get a big fat fileNotFound Exception. Any help would be appreciated.

    Thanks,

    Matt

    UserService.java
    Code:
    Images images = new Images();
    		  
    		  try {
    			  images.setContent(Hibernate.createBlob(user.getFile().getBytes()));
    		  } catch (IOException e) {}
    		  
    		  images.setName(user.getFile().getOriginalFilename());
    		  images.setSize(new Long(user.getFile().getSize()).intValue());
    		  images.setType(user.getFile().getContentType());
    		  user.getPerson().setImages(images);
    		  personDao.save(user.getPerson());
    jsp fragment
    Code:
     <label class="float-left" for="person.images"><spring:message code="profilePhoto" /></label>
    	        <span class="float-right"><form:input type="file" class="text ui-widget-content ui-corner-all" path="file" /> </span>
    	        <br class="clear-float"/>
    register.xml
    Code:
     <flow xmlns="http://www.springframework.org/schema/webflow"  
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
       xsi:schemaLocation="http://www.springframework.org/schema/webflow  
         http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">  
        
        <var name="user" class="com.discdogevents.custom.pojo.PersonData"/>
        <var name="breedList" class="java.util.ArrayList"/>
        <var name="emailTypeList" class="java.util.ArrayList"/>
        <var name="phoneTypeList" class="java.util.ArrayList"/>
        <var name="genderList" class="java.util.ArrayList"/>
        <var name="dog" class="com.discdogevents.custom.pojo.DogData"/>
        <var name="dogs" class="java.util.ArrayList"/>
        
        <var name="dogId" class="java.lang.String"/>
        
        <on-start>
            	<evaluate expression="txtService.findAllDogBreeds(flowRequestContext)" result="flowScope.breedList"/>
            	<evaluate expression="txtService.findAllGender(flowRequestContext)" result="flowScope.genderList"/>
        </on-start>
        <view-state id="register1" model="user" view="userForm">
            <on-render>
            	<evaluate expression="txtService.findAllEmailTypes(flowRequestContext)" result="flowScope.emailTypeList"/>
            	<evaluate expression="txtService.findAllPhoneTypes(flowRequestContext)" result="flowScope.phoneTypeList"/>
            </on-render>
            <transition on="register1" to="dogList">
            	 <evaluate expression="userService.createGuestUser(user)" /> 
            </transition> 
            <transition on="cancelRegistration" to="cancelRegistration" validate="false"/>
        </view-state>
    
    ......
    ......
    
        <end-state id="cancelRegistration"
            view="welcome"/>
        <end-state id="cancel"
            view="welcome"/>
    </flow>
    PersonData.java
    Code:
    public class PersonData implements java.io.Serializable{
    	private Club club = new Club();
    	private Address address = new Address();
    	private Person person = new Person();
    	private Users userInfo = new Users();
    	private MultipartFile file;
    	private List<Email> emailBook = new ArrayList<Email>(10);
    	private List<Phone> phoneBook = new ArrayList<Phone>(10);
    	private List<DogData> dogs = new ArrayList<DogData>(10);
    	.....
    }
    Stack Trace
    Code:
    
    root cause
    
    org.springframework.webflow.execution.repository.snapshot.SnapshotUnmarshalException: IOException thrown deserializing the flow execution stored in this snapshot -- this should not happen!
    	
    
    root cause
    
    java.io.FileNotFoundException: C:\Users\mattsrum\discdogevents\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\work\Catalina\localhost\discdogevents\upload_659c1ac6_12ed983e1f0__8000_00000021.tmp (The system cannot find the file specified)
    	java.io.FileInputStream.open(Native Method)
    	java.io.FileInputStream.<init>(Unknown Source)
    	org.apache.commons.fileupload.disk.DiskFileItem.readObject(DiskFileItem.java:719)
    Last edited by programmermattsrum; Mar 21st, 2011, 04:03 PM.

  • #2
    I really need an answer or some lead on what to do to fix this. Any ideas Keith?

    Comment


    • #3
      So I finally found a post that has my problem. It is solved in post - http://forum.springsource.org/showthread.php?t=54466. Basically i just set the bean that is the multipartfile to null after saving to the database and then there is no error anymore.

      Comment

      Working...
      X