Using Java Advanced Imaging (JAI) in Applet

I'm trying to port a JAI user interface to an applet using Apache Tomcat. When I try to display an image in the applet I get an exception and I have no idea what the cause is. I've opened up security completely (temporarily) to ensure that I'm not getting an error due to an applet security issue. Consequently, I'm able to browse/open files from the client.
Here is the stack for the error I'm getting. Can anyone tell me what is causing this error? Thanks.
Java(TM) Plug-in: Version 1.4.1_01
Using JRE version 1.4.1_01 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Administrator
Proxy Configuration: No proxy
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
p:   reload proxy configuration
q:   hide console
r:   reload policy configuration
s:   dump system properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
java.lang.reflect.InvocationTargetException
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
     at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1669)
     at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:481)
     at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
     at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:805)
     at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
     at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2135)
     at com.abi.protmodule.GelDisplayData.getGelImage(GelDisplayData.java:558)
     at com.abi.protmodule.ScrollingGelPanel.<init>(ScrollingGelPanel.java:58)
     at com.abi.ris.web.applet.GelEditPanel.showGelImage(GelEditPanel.java:76)
     at com.abi.ris.web.applet.GelEditApplet.openGelJButton_actionPerformed(GelEditApplet.java:159)
     at com.abi.ris.web.applet.GelEditApplet.chooseFileJButton_actionPerformed(GelEditApplet.java:136)
     at com.abi.ris.web.applet.GelEditApplet$1.actionPerformed(GelEditApplet.java:73)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
     at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
     at java.awt.Component.processMouseEvent(Component.java:5093)
     at java.awt.Component.processEvent(Component.java:4890)
     at java.awt.Container.processEvent(Container.java:1566)
     at java.awt.Component.dispatchEventImpl(Component.java:3598)
     at java.awt.Container.dispatchEventImpl(Container.java:1623)
     at java.awt.Component.dispatchEvent(Component.java:3439)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
     at java.awt.Container.dispatchEventImpl(Container.java:1609)
     at java.awt.Component.dispatchEvent(Component.java:3439)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
Caused by: java.lang.NoSuchFieldError: borders
     at com.sun.medialib.mlib.Image.initIDs(Native Method)
     at com.sun.medialib.mlib.Image.<clinit>(Image.java:2903)
     at com.sun.media.jai.mlib.MediaLibAccessor$1.run(MediaLibAccessor.java:223)
     at java.security.AccessController.doPrivileged(Native Method)
     at com.sun.media.jai.mlib.MediaLibAccessor.setUseMlib(MediaLibAccessor.java:220)
     at com.sun.media.jai.mlib.MediaLibAccessor.useMlib(MediaLibAccessor.java:185)
     at com.sun.media.jai.mlib.MediaLibAccessor.isMediaLibCompatible(MediaLibAccessor.java:391)
     at com.sun.media.jai.mlib.MediaLibAccessor.isMediaLibCompatible(MediaLibAccessor.java:314)
     at com.sun.media.jai.mlib.MlibScaleRIF.create(MlibScaleRIF.java:82)
     ... 39 more
Could not find mediaLib accelerator wrapper classes. Continuing in pure Java mode.

look at
http://forum.java.sun.com/thread.jsp?thread=290960&forum=20&message=1261471
and
http://forum.java.sun.com/thread.jsp?forum=20&thread=173410
It's something related with DLL libraries...

Similar Messages

  • Finding a Gif Encoder for Java Advanced Imaging (JAI)

    I'm trying to find the GIF encoder for Java Advanced Imaging. I keep reading all over the place that there is one, but for the life of me I can't figure out where it is supposed to be. Could anyone please enlighten me?
    Thanks

    After I installed this, it still doesn't report gif as a possible encoding type:
    String[] codecs = ImageCodec.getEncoderNames(img, null);
                for (int j = 0; j < codecs.length; j++) {
                    String codec = codecs[j];
                    System.out.println (codec);
                }only reports the following types available:
    pnm
    jpeg
    tiff
    png
    bmp

  • JAI (Java Advanced Imaging) and CF8

    Hi
    I'm using the Java Advanced Imaging API since CF6 and made
    several jar files to manipulate images (as it wasn't integrated in
    CF).
    Today I installed CF8, put the "jai_core.jar" and
    "jai_codec.jar" in the "cfroot\runtime\jre\lib\ext" folder as I did
    when I first developped my application or when I migrated from CF6
    to CF7 but today it does not work.
    I have the following error (see attached), ImageInfo and
    GetTaille are my own jar classe and method.
    I saw that there is already a "jai_core.jar/jai_codec.jar" in
    "cfroot\lib" So I think that there is a conflict between the two
    JAI's. I removed mine, but I have another error : "An exception
    occurred when instantiating a Java object. The class must not be an
    interface or an abstract class. Error:
    com/sun/media/jai/codec/ImageEncodeParam."
    I also tried to replace the JAI of CF8 by mine (just for a
    test) but I have the same error.
    Do you have any idea of a solution ?
    I know I can now use the CF8 tags to manipulate images, but I
    have to rewrite lots of code and I think there is still
    manipulations that CF8 can't handle (CMYK images, ICC profiles,
    Thanks in advance for your suggestions

    > "An exception occurred when instantiating a Java object.
    The class must not
    > be an interface or an abstract class. Error:
    I don't know how you're using
    com/sun/media/jai/codec/ImageEncodeParam in your code but the error
    is clear. ImageEncodeParam is an interface in the CF8
    jai_codec.jar. You can instantiate a concrete class, but not an
    interface. Possibly the private classes have changed since you
    first wrote the jar?
    > I think that there is a conflict between the two JAI's.
    >...
    > Caused by: java.lang.SecurityException: sealing
    violation: package
    > com.sun.media.jai.util is sealed
    You could be right. If the jars are sealed having two of them
    in the classpath might cause that kind of error.

  • How to set color space to JPEG image with Java advance Imaging

    How to set color space to JPEG image with Java advance Imaging.
    is there any API in JAI which support to set color space.

    I'm definately no guru, but this is how you can change it.
    CTRL + ALT + Click on the part of the component that you want to change. This brings up the Hidden Dom Inspector, background of component will be surrounded with a red outline (Make sure the red outline is surrounding the part of the tabset you want to change), Now you go to properties sheet and click the ellipses next to rules property this will pop up a dialog you look in this list (At the top) to see the default style classes that are affecting the rendering of the component outlined in red. (You will be able to select different sections of a single component) then you just rewrite the style class that you want to change in your Stylesheet (You will not find the styleclass that you want to change because it is a part of your theme .jar but as long as you name it exactly the same and place in your stylesheet it will override the theme .jar style classes) it's actually very easy -- you were right should be a piece of cake for a guru. Don't have the link handy but you can check out Winston's Blog on changing Table Formatting to get this information...It is EXTREMELY useful if you want your apps to have a custom look and not default that comes with Creator Themes.
    Hope this helps you out God knows others have helped me alot!
    Jason

  • Question on "use java .... for [applet]" option in IE

    posted April 30, 2003 09:27 AM
    If a plug-in is installed, IE includes an option under the advanced tab, similar to this: "use Java 1.4.1_02 for [applet]"
    Im trying to understand exactly what this is. Sorry if what I'm saying is obvious... If your HTML has the [applet] tag rather than the [object] tag, IE will use the sun plug-in? If true, and since the [applet] tag does not automatically down load a plug-in, the client would have to have this plug-in already installed?
    Is is also true that this advanced option in IE does not have anything to do with an applet using the [OBJECT] tag. If the [object] tag is in the html, then the browser will always use the plug-in regardless of whether the IE option is checked?
    Thanks for your help! Soon I'll have this applet technology down, but still many questions...

    New versions of Internet Explorer will automatically grab the Java plugin specified to run applets that are coded on webpages using the <APPLET> tag. The plugin would have had to be pre-installed on the machine - as it will not automatically download the plugin to do this. Only the <Object> tag will do that.
    And yes...this only affects the <APPLET> tag. Any OBJECT tags you will encounter that require a specific JDK will still prompt you to download that if you don't have it and will use that version, regardless of whether that advanced option is selected.
    You can also do some configuation with newer plugins via the icon located in your Control Panel.
    Good luck with applets... just wait until you have to implement one for the Crackintosh. ;-)

  • What's the latest stable version of Java Advanced Imaging Image I/O Tools?

    Hi,
    Could anybody tell me what's the latest stable version for Java Advanced Imaging Image I/O Tools and from where I can download the same?
    Thanks

    Just 'mark out of date' the package. Or email him directly. The forums are generally the WORST way to try and contact any specific developer.
    Oh, and before that, please do a quick google....
    http://projects.gnome.org/gedit/
    Closing.

  • Saving a Gif image using JAI (Java Advanced Imaging)

    I'm trying to read in and save out a bunch of gif images in JAI. I'm reading them in, resizing them, and then saving them back out, all in gif format.
    For some reason some of my gif images work fine, and some don't throw any errors, but save as 0k size.
    When I do img.getColorModel().toString(); I get the following output for images that do work:
    IndexColorModel: #pixelBits = 8 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@1bbf1ca transparency = 1 transIndex = -1 has alpha = false isAlphaPre = false
    And the following output for images that don't work:
    ColorModel: #pixelBits = 24 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@1bbf1ca transparency = 1 has alpha = false isAlphaPre = false
    If I try to save the images that don't work out as jpg's they work fine, but if I try to save them out as gif's, I get 0k files.
    Any insight on how to correct this problem?
    I assume it has something to do with the 24 numComponents in the non-working gifs, but I'm really not sure.
    Please help.
    Thanks.

    Can you post your image property?
    Try using this for image compression:
    int pixelSize = img.getColorModel().getPixelSize();
    if (1 == pixelSize) {
    tiffEncodeParam.setCompression(TIFFEncodeParam.COMPRESSION_GROUP3_2D);
    } else if (8 == pixelSize) {
    tiffEncodeParam.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE);
    } else if (24 == pixelSize) {
    tiffEncodeParam.setCompression(TIFFEncodeParam.COMPRESSION_JPEG_TTN2);
    Thanks,

  • Error trying to open a file using java.io.* in an Applet

    I have a file called wordlist.txt and I am using java.io.* to open it. When I try it
    in Applet Viewer it runs without a hitch. But when I try to run it in a
    browser as an Applet, it errors out saying:
    com.ms.security.SecurityExceptionEx[package3/SpellCheck.setWordList]: cannot access file wordlist.txt
    I have tried adding this file to my Project and accessing it that way but I still get
    the same message. If anyone can help with this, I sure would appreciate it.
    My code is as follows:
    String inWord = new String("zzz");
    try {
    File myWordList = new File("wordlist.txt");
    BufferedReader inWordList = new BufferedReader(
    new FileReader(myWordList));
    inWord = inWordList.readLine();
    while (inWord != null) {
    wordList.addElement(inWord);
    inWord = inWordList.readLine();
    } // end while
    inWordList.close();
    } // end try
    catch (Exception e1) {
    // Pr is equivalent System.out.println();
    Pr("Error Reading this line " + '\n' + inWord + '\n' + e1);
    } // end catch
    } // end setWordList()

    Applets are generally prevented from reading as well as writing files, but appletviewer can load files from the hard drive, so, that is the cause of the behaviour you have observed. To know more about enabling applets load files, you have to sign your applets,
    learn more at
    http://java.sun.com/sfaq/#prevent

  • Thumbnails with Java Advanced Imaging

    Hi,
    I'm trying to create thumbnails from images that I am loading into an application. Scaling won't work as my images may be of different sizes and I want to apply the function to all images.
    Any Ideas,
    Thanks,
    Kieran.

    Yes scaling will work. You just have to figure out the scale you need
    to use for each image.
    check the x and y size of the image. find the longest of these and then
    figure out the scale factor needed to get the biggest dimension to fit
    the thumbnail.
    matfud

  • JAI(Java Advanced Imaging) Problem with splitting TIFF images

    Hi
    I am getting problem with height when I use this program to split TIFF images
    ImageDecoder decImage = ImageCodec.createImageDecoder("tiff", inStr,
    null);
    Then it creates RenderedImage page by page and encodes them to file:
    String outFileName = "";
    OutputStream outStr;
    TIFFEncodeParam encParam = new TIFFEncodeParam();
    encParam.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS);
    for (int i=0,n=this.getPageCount(); i < n; i++)
    outImage = this.decImage.decodeAsRenderedImage(i);
    outFileName = "C:\\Temp\\Split" + i + ".tif";
    outStr = new FileOutputStream(outFileName);
    BufferedOutputStream bOutStr = new BufferedOutputStream(outStr);
    encImage = ImageCodec.createImageEncoder("tiff",bOutStr,encParam);
    encImage.encode(outImage);
    bOutStr.flush();
    bOutStr.close();
    }The images are shrinking when I split . I need a solution to this problem.
    Thanks for any help in advance
    Sudheer.

    Hi
    Did you get a solution for your problem. I am also trying to split a TIFF file.
    Thanks in advance
    Antony

  • Java Advanced Imaging - Imaging Client Server application

    Hello,
    I try to send images compressed from a server to a client, the first Image is received by the client, but nothing append after.
    The client send an error that says that the socket connection is closed and I don't know wky !
    I am using "JAI" for the image compression on the server and I use the method ImageCodec.createImageEncoder(OutputStream dst, ImageEncodeParam param)
    OutputStream is the data stream between the client and the server, I have used DataOutputStream and OutputStream object but I got the same error.
    (In an example of JAI they use FileOutputStream, I just change it for OuputStream in order to send data on the socket).
    ImageEncodeParam is null.
    I use an other socket that permits to launch commands through text command. So text commands and data are on 2 differents sockets.
    Every time the client ask to the server for an image and the client wait for the stream data.
    I know that it could be easer using RMI but it will be better for me to use a stream.
    Could you tell me what way should I take, Could you show me an example?
    Thank you in advance,
    Regards.

    This has nothing to do with imaging.
    You are sending something via a socket and that is the problem.
    The most likely problems:
    1. You are sending/reading text not binary.
    2. You are sending data not a message (a message contains data) and thus have no way to determine when the actual message has arrived.
    3. You are just doing something wrong with your socket code.

  • Download for Java Advanced Imaging Image I/O Tools 1.0 not working

    Hey there,
    Anyone able to get the JAI I/O package from Sun, whenever I go to download it from
    http://java.sun.com/products/java-media/jai/downloads/download-iio.html
    I get a "FATAL Exception".
    If anyone has a copy of the I/O package and can share it please let me know. I have downloaded the regular JAI API but I do not believe this adds TIFF support.

    I read somewhere (perhaps in the imageio-interest maillist) that
    the native libraries only apply to JPEG and that they aren't strictly
    necessary unless you want the accompanying performance boost. So I've
    been using just the JAR files and NOT the native dll:
    clibwrapper_jiio.jar
    jai_imageio.jar
    mlibwrapper_jai.jar
    But NOT: clib_jiio.dll
    This has worked fine for my application and my applet. I have been using the BMP and TIFF readers with no problem. However, when I bundle these
    JAR files into my Java Web Start application, those readers aren't found. I see the JAR files get loaded and validated (I had to sign each of these JAR files -- could that be a problem?) but my JavaWS application can't read TIFF or BMP. Any ideas?
    Could someone confirm that the JAR files ARE usable without the native
    libraries? Also, in that case, does one need ALL the JAR files?

  • How to set color depth to Bitmap image with Java advance Imaging

    i have to convert image one format ot bmp format and also set the color depth as 1 bit , 4 bit , 8 bit, 16 bit, 32 bit of image.
    has any one done this before. please help me out .

    Take a look at the example code here: http://forum.java.sun.com/thread.jsp?forum=20&thread=560573&tstart=0&trange=15
    I took an image that was 24 bits/pixel (I guess) and converted it to an indexed color model (8 bits/pixel).
    Is that what you mean? (It's also easy to convert to 16 or 15 bits/pixel: use TYPE_USHORT_565_RGB or
    TYPE_USHORT_555_RGB.)

  • Jave Advanced Imaging

    Dear all,
    I am writing a servlet which can resize and display an image. firstly, it retrieves byte[] data as an image, then if the image size is too big, the image will be resize to a propotional size, say 85% of the original size. but I cannot find any decoder for .gif images.
    Byte[] byteImage = (byte[]) img; // img is an image body and stored in database
    ByteArrayInputStream inStream = new ByteArrayInputStream(byteImage);
    JPEGEncodeParam encodeParam = new JPEGEncodeParam();
    ImageDecoder decoder = ImageCodec.createImageDecoder("JPEG", inStream, encodeParam);
    JPEGEncodeParam can be used to encode a .jpg image byte[] file with ByteArrayInputStream. However, It cannot serve a .gif image byte[] file. Can somebody help?
    Cos

    Thanks first.
    however, i found that Acme.JPM.Encoders.GifEncoder is easier to use.
    but i got another problem:
    when the quality of a JPEG image is not good, when the scale is processed, the color of the image will be discarded or too compressed. what should i do?
    byte[] btImg = image btye[] from database;
    ByteArraySeekableStream inStream = new ByteArraySeekableStream(btImg);
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    RenderedImage imgSrc = JAI.create("stream", inStream);
    ParameterBlock pb = new ParameterBlock();
    // Scale
    pb = new ParameterBlock();
    pb.addSource(imgSrc);
    pb.add(1.50F);
    pb.add(1.50F);
    pb.add(0.0F);
    pb.add(0.0F);
    pb.add(new InterpolationBicubic(1));
    RenderedImage imgRen = (RenderedImage) JAI.create("scale", pb, null);
    JPEGEncodeParam encodeParam = new JPEGEncodeParam();
    ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG", outStream, encodeParam);
    encoder.encode(imgRen);
    //output scaled byte[]
    byte[] btImage = outStream.toByteArray();
    can anyone help?
    otto

  • How to convert JPEG - PNG images using java?

    Hi,
    Has anyone done this before?
    Can you provide me with a sample code or point me to the direction on how this can be done?
    Are there any existing Java technology that supports this?
    Most grateful. Thanks.

    It's should be easy using Java Advanced Imaging (JAI). Try this.
    import javax.media.jai.JAI;
    import javax.media.jai.RenderedOp;
    public class convert {
      static public void main(String[] args) {
        String inName = args[0];
        String outName = args[1];
        RenderedOp source = JAI.create("fileload", inName);
        JAI.create("filestore", source, outName, "PNG", null);
        System.exit(0);
    }

Maybe you are looking for

  • As a result of very poor customer service, I am a ...

    I decided to come back to BT after a 2-year stint with Virginmedia. I think I've made a huge mistake ! It all started so well, too. I signed up to the Anytime Call Plan and Broadband Option 3, with a discount for the first 3 months. It all started ve

  • Problem Editing User Defined Report - 1.1.0.22.71

    When I rt click on an existing user-defined report on the Reports tab and select edit, change the default value on a bind variable and click Apply, I get message "Name already used please enter new one" message and changes will not save. Am I missing

  • I can't make my first download in AppStore!

    When i try to make my first App Store download on my new iPhone 4, I'm asked to fill in my Password for Apple ID. When I'm done and press OK, I get the same message and I have to fill it in again, and again.. if I fill in wrong pass, it says "Wrong p

  • Maintain an Adobe Muse site for a client once Muse subscription expires?

    Hi there, I'd really appreciate some advice here. I have created a site in adobe muse for a client that is shortly to be pushed live. I also have a subscription to Adobe Muse (monthly), which  will need to terminate shortly. How can I ensure that the

  • CS5 Won't reinstall on Windows 7

    I have been using CS5 Extended for three or four years on two different computers. During that time I have reinstalled the operating system two or three times and had to reinstall Photoshop each time. Suddenly after reinstalling Windows 7 Photoshop w