6 Replies Latest reply on Apr 25, 2003 8:09 AM by Christopher Miles

    Image Manipulation, ImageIO, getDefaultToolkit

    Christopher Miles Newbie

      I have a stateless bean that does two things; it writes some data about an image to a table and then it write the image file and two thumbnails to disk. The problem I am having is that whenever I try to make an ImageIO call, the transaction just hangs.

      I tried switching to toolkit calls, but I am seeing the same issue. Is there something trickier that I have to do? Most of all, am I doing something crazy?

      Any help would be greatly appreciated,
      -- Miles

      Here is the chunk of code that is hanging:

      // wrap an input stream around the byte data
      ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream( byteData );

      // read in the image
      logger.info( "Reading in the image data..." );
      BufferedImage bufferedImageOriginal = ImageIO.read( bytearrayinputstream );

      // write the file to disk
      logger.info( "Writing the full size image to " + fileImage.getAbsolutePath() );
      ImageIO.write( bufferedImageOriginal, "jpg", fileImage );

      The log file says:

      2003-04-24 13:08:09,380 INFO [FILE] Image object created
      2003-04-24 13:08:09,381 INFO [FILE] Writing image data to disk
      2003-04-24 13:08:09,383 INFO [FILE] byteData length: 130970
      2003-04-24 13:08:09,383 INFO [FILE] Reading in the image data...
      13:13:09,327 WARN [TxCapsule] Transaction XidImpl [FormatId=257, GlobalId=Greta//42, BranchQual=] timed out. status=STATUS_ACTIVE
      2003-04-24 13:13:09,327 WARN [org.jboss.tm.TxCapsule] Transaction XidImpl [FormatId=257, GlobalId=Greta//42, BranchQual=] timed out. status=STATUS_ACTIVE

      The image size is report the same from the swing client and the server log file, my belief is that the image is getting to the server intact.