ImageIO usage in applets.. Please help...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: ImageIO usage in applets.. Please help...

  1. #1
    Kimberly Hendershot Guest

    ImageIO usage in applets.. Please help...


    Hi.

    I have an applet/servlet pair that communicate some images. The applet is
    a paint-like program that allows the user to draw a picture. It then takes
    this picture and sends it via ImageIO to a servlet which can create a file
    on the server to save the image in .png format also using ImageIO.

    I developed and tested my applet/servlet pair using Tomcat 4.0.3 using my
    local machine as a host. Everything ran nicely. I then uploaded the applet/servlet
    pair onto a Unix webhost which supports JDK 1.4 and Servlets 2.3 via Tomcat
    4.0.1. Here I have run into some major problems.

    The applet stops running on any line using ImageIO methods. For example,
    I am only using these 2 lines of ImageIO in my applet:

    ImageIO.setCache(false);
    ImageIO.write(buffImage, png, outputStream);

    As it is, the Java console lists these errors for the ImageIO.setCache(false);
    line:

    sun.misc.ServiceConfigurationError: javax.imageio.spi.ImageTranscoderSpi:
    http://www.imaginacard.com/IDraw/MET...anscoderSpi:2:

    Illegal configuration-file syntax
    at sun.misc.Service.fail(Service.java:129)
    at sun.misc.Service.fail(Service.java:135)
    at sun.misc.Service.parseLine(Service.java:157)
    at sun.misc.Service.parse(Service.java:206)
    at sun.misc.Service.access$100(Service.java:111)
    at sun.misc.Service$LazyIterator.hasNext(Service.java:257)
    at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IORegistry.java:173)

    at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:113)
    at javax.imageio.spi.IIORegistry.getDefaultInstance (IIORegistry.java:134)

    at javax.imageio.ImageIO.<clinit>(ImageIO.java:44)
    at IDrawApplet.saveImage(IDrawApplet.java:125)
    at IDraw$FileAction.actionPerformed(IDraw.java:361)
    ........etc......

    If I comment out that line, similar errors appear for the ImageIO.write method.
    I have been trying to fix this problem for over a week and it has been to
    no avail. I have read the ImageIO api over and over. I have tried to JAR
    everything up and add in the meta-inf/services folder with the appropriate
    files in it. And any documentation I find on ImageIO tells me how easy it
    is to use. I do not have code in my applet telling it to look for any SPI's.
    It's just doing it. I really don't understand how it worked through my
    localhost Tomcat but it wont' work on the web server.

    If anyone has any suggestions or explanations of these errors, it will be
    so greatly appreciated.

    Thank you for your time.

  2. #2
    Rob Abbe Guest

    Re: ImageIO usage in applets.. Please help...


    Kimberly,

    Make sure the temp folder has been created. The script file may be specifying
    a temp folder that does not exist. Check the script files that start tomcat
    for more information. Some of the ImageIO classes need to cache to disk
    and cannot do so if the tmp folder does not exist. On windows this would
    probably not have been a problem.

    Rob Abbe

    "Kimberly Hendershot" <java..@127.0.0.1> wrote:
    >
    >Hi.
    >
    >I have an applet/servlet pair that communicate some images. The applet

    is
    >a paint-like program that allows the user to draw a picture. It then takes
    >this picture and sends it via ImageIO to a servlet which can create a file
    >on the server to save the image in .png format also using ImageIO.
    >
    >I developed and tested my applet/servlet pair using Tomcat 4.0.3 using my
    >local machine as a host. Everything ran nicely. I then uploaded the applet/servlet
    >pair onto a Unix webhost which supports JDK 1.4 and Servlets 2.3 via Tomcat
    >4.0.1. Here I have run into some major problems.
    >
    >The applet stops running on any line using ImageIO methods. For example,
    >I am only using these 2 lines of ImageIO in my applet:
    >
    >ImageIO.setCache(false);
    >ImageIO.write(buffImage, png, outputStream);
    >
    >As it is, the Java console lists these errors for the ImageIO.setCache(false);
    >line:
    >
    >sun.misc.ServiceConfigurationError: javax.imageio.spi.ImageTranscoderSpi:
    >http://www.imaginacard.com/IDraw/MET...anscoderSpi:2:
    >
    >Illegal configuration-file syntax
    >at sun.misc.Service.fail(Service.java:129)
    >at sun.misc.Service.fail(Service.java:135)
    >at sun.misc.Service.parseLine(Service.java:157)
    >at sun.misc.Service.parse(Service.java:206)
    >at sun.misc.Service.access$100(Service.java:111)
    >at sun.misc.Service$LazyIterator.hasNext(Service.java:257)
    >at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IORegistry.java:173)
    >
    >at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:113)
    >at javax.imageio.spi.IIORegistry.getDefaultInstance (IIORegistry.java:134)
    >
    >at javax.imageio.ImageIO.<clinit>(ImageIO.java:44)
    >at IDrawApplet.saveImage(IDrawApplet.java:125)
    >at IDraw$FileAction.actionPerformed(IDraw.java:361)
    >........etc......
    >
    >If I comment out that line, similar errors appear for the ImageIO.write

    method.
    > I have been trying to fix this problem for over a week and it has been

    to
    >no avail. I have read the ImageIO api over and over. I have tried to JAR
    >everything up and add in the meta-inf/services folder with the appropriate
    >files in it. And any documentation I find on ImageIO tells me how easy

    it
    >is to use. I do not have code in my applet telling it to look for any SPI's.
    > It's just doing it. I really don't understand how it worked through my
    >localhost Tomcat but it wont' work on the web server.
    >
    >If anyone has any suggestions or explanations of these errors, it will be
    >so greatly appreciated.
    >
    >Thank you for your time.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center