Skip to main content

ImageIO fails to load texture

13 replies [Last post]
aces
Offline
Joined: 2003-07-17
Points: 0

Hi,

I guess this is ImageIO bug, and not a Java3D, but I guess you have the right channels to solve it.

In a Java3D applet, when I try to load a texture using TextureLoader, the undelaying ImageIO.read(url) call fails. I am not sure if this happens due my webhoster image policy, or is a ImageIO bug.

Of course it not happens in the "old" Java3D 1.3.1, because it not use ImageIO, but Toolkit.getImage(url).

The exceptions happens in following statament:
Texture tex = new TextureLoader(texImage, this).getTexture();

My test case is here:
http://planeta.terra.com.br/educacao/alessandroborges/textureImage/Textu...

the console dump is below:

</p>
<p>basic: Registered modality listener<br />
liveconnect: Invoking JS method: document<br />
liveconnect: Invoking JS method: URL<br />
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@1621e42, refcount=1<br />
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@1bd4722<br />
basic: Loading applet ...<br />
basic: Initializing applet ...<br />
basic: Starting applet ...<br />
network: Connecting <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/TextureImage.class" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/TextureImage.class">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/Textu...</a> with proxy=DIRECT<br />
network: Connecting <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/TextureImage.class" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/TextureImage.class">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/Textu...</a> with cookie "TERRA=c88c0a8d218731099439941000000553c8b0029a"<br />
basic: Loading <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/TextureImage.class" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/TextureImage.class">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/Textu...</a> from cache<br />
Java 3D [dev] 1.3.2-pre8-0410011108-experimental 01 Oct 2004 11:08:53 PDT</p>
<p>network: Connecting <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-...</a> with proxy=DIRECT<br />
network: Connecting <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-...</a> with cookie "TERRA=c88c0a8d218731099439941000000553c8b0029a"<br />
network: Connecting <a href="http://www.terra.com.br/not-found.htm" title="http://www.terra.com.br/not-found.htm">http://www.terra.com.br/not-found.htm</a> with proxy=DIRECT<br />
network: Connecting <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-...</a> with proxy=DIRECT<br />
network: Connecting <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-...</a> with cookie "TERRA=c88c0a8d218731099439941000000553c8b0029a"<br />
network: Connecting <a href="http://www.terra.com.br/not-found.htm" title="http://www.terra.com.br/not-found.htm">http://www.terra.com.br/not-found.htm</a> with proxy=DIRECT<br />
sun.misc.ServiceConfigurationError: javax.imageio.spi.ImageOutputStreamSpi: <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi:1:" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi:1:">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-...</a> Illegal configuration-file syntax<br />
	at sun.misc.Service.fail(Unknown Source)<br />
	at sun.misc.Service.fail(Unknown Source)<br />
	at sun.misc.Service.parseLine(Unknown Source)<br />
	at sun.misc.Service.parse(Unknown Source)<br />
	at sun.misc.Service.access$100(Unknown Source)<br />
	at sun.misc.Service$LazyIterator.hasNext(Unknown Source)<br />
	at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(Unknown Source)<br />
	at javax.imageio.spi.IIORegistry.(Unknown Source)<br />
	at javax.imageio.spi.IIORegistry.getDefaultInstance(Unknown Source)<br />
	at javax.imageio.ImageIO.(Unknown Source)<br />
	at com.sun.j3d.utils.image.TextureLoader$2.run(Unknown Source)<br />
	at java.security.AccessController.doPrivileged(Native Method)<br />
	at com.sun.j3d.utils.image.TextureLoader.(Unknown Source)<br />
	at com.sun.j3d.utils.image.TextureLoader.(Unknown Source)<br />
	at TextureImage.createSceneGraph(TextureImage.java:70)<br />
	at TextureImage.init(TextureImage.java:130)<br />
	at sun.applet.AppletPanel.run(Unknown Source)<br />
	at java.lang.Thread.run(Unknown Source)<br />
basic: Exception: sun.misc.ServiceConfigurationError: javax.imageio.spi.ImageOutputStreamSpi: <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi:1:" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi:1:">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-...</a> Illegal configuration-file syntax<br />
sun.misc.ServiceConfigurationError: javax.imageio.spi.ImageOutputStreamSpi: <a href="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi:1:" title="http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-INF/services/javax.imageio.spi.ImageOutputStreamSpi:1:">http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-...</a> Illegal configuration-file syntax<br />
	at sun.misc.Service.fail(Unknown Source)<br />
	at sun.misc.Service.fail(Unknown Source)<br />
	at sun.misc.Service.parseLine(Unknown Source)<br />
	at sun.misc.Service.parse(Unknown Source)<br />
	at sun.misc.Service.access$100(Unknown Source)<br />
	at sun.misc.Service$LazyIterator.hasNext(Unknown Source)<br />
	at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(Unknown Source)<br />
	at javax.imageio.spi.IIORegistry.(Unknown Source)<br />
	at javax.image<br />

And a second call gives another error:

<br />
Java Plug-in 1.5.0<br />
Using JRE version 1.5.0-rc Java HotSpot(TM) Client VM<br />
User home directory = D:\Documents and Settings\alessandro<br />
----------------------------------------------------<br />
c:   clear console window<br />
f:   finalize objects on finalization queue<br />
g:   garbage collect<br />
h:   display this help message<br />
l:   dump classloader list<br />
m:   print memory usage<br />
o:   trigger logging<br />
p:   reload proxy configuration<br />
q:   hide console<br />
r:   reload policy configuration<br />
s:   dump system and deployment properties<br />
t:   dump thread list<br />
v:   dump thread stack<br />
x:   clear classloader cache<br />
0-5: set trace level to<br />
----------------------------------------------------<br />
basic: Stopping applet ...<br />
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter@1bd4722<br />
basic: Joining applet thread ...<br />
basic: Destroying applet ...<br />
basic: Disposing applet ...<br />
basic: Quiting applet ...<br />
basic: Joined applet thread ...<br />
basic: Unregistered modality listener<br />
basic: Registered modality listener<br />
liveconnect: Invoking JS method: document<br />
liveconnect: Invoking JS method: URL<br />
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@1621e42, refcount=2<br />
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@1e0f2f6<br />
basic: Loading applet ...<br />
basic: Initializing applet ...<br />
basic: Starting applet ...<br />
java.lang.NoClassDefFoundError<br />
	at com.sun.j3d.utils.image.TextureLoader$2.run(Unknown Source)<br />
	at java.security.AccessController.doPrivileged(Native Method)<br />
	at com.sun.j3d.utils.image.TextureLoader.(Unknown Source)<br />
	at com.sun.j3d.utils.image.TextureLoader.(Unknown Source)<br />
	at TextureImage.createSceneGraph(TextureImage.java:70)<br />
	at TextureImage.init(TextureImage.java:130)<br />
	at sun.applet.AppletPanel.run(Unknown Source)<br />
	at java.lang.Thread.run(Unknown Source)<br />
basic: Exception: java.lang.NoClassDefFoundError<br />
java.lang.NoClassDefFoundError<br />
	at com.sun.j3d.utils.image.TextureLoader$2.run(Unknown Source)<br />
	at java.security.AccessController.doPrivileged(Native Method)<br />
	at com.sun.j3d.utils.image.TextureLoader.(Unknown Source)<br />
	at com.sun.j3d.utils.image.TextureLoader.(Unknown Source)<br />
	at TextureImage.createSceneGraph(TextureImage.java:70)<br />
	at TextureImage.init(TextureImage.java:130)<br />
	at sun.applet.AppletPanel.run(Unknown Source)<br />
	at java.lang.Thread.run(Unknown Source)<br />
basic: Modality pushed<br />
basic: Finding information ...<br />
basic: Releasing classloader: sun.plugin.ClassLoaderInfo@1621e42, refcount=1<br />
basic: Done ...<br />
basic: Modality popped</p>
<p>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Alessandro Borges

Yes, I check the code of 1.3.1 and 1.3.2.
1.3.1 uses Toolkit.getImage(url), so not problem at all, but ImageIO.read(url)
fails.

I was trying to load a jpg image.

Alessandro

--- java3d-interest@javadesktop.org escreveu:
> > I am using the plain j2sdk 1.5.0 install. I did not change anything ,
> except Java3D install.
>
> The difference being that Java 3D 1.3.2 now uses Image I/O whereas Java 3D
> 1.3.1 did not. What type of image files are you trying to load?
>
> Btw, the ImageIO call that the TextureLoader now uses for the URL case is:
>
> ImageIO.read(URL);
>
> which should pick a default ImageReader. What Aastha noticed is that the
> stack trace suggests that something is trying to access
> services/javax.imageio.spi.ImageOutputStreamSpi resource from your site via
> http.
>
> -- Kevin
> ---
> [Message sent by forum member 'kcr' (Kevin Rushforth)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageID=37817鎹
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>

_______________________________________________________
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

aces
Offline
Joined: 2003-07-17
Points: 0

Java 1.6.0-ea-b14 (Mustang) ImageIO.read(url) still fail to load images in applets.

aces
Offline
Joined: 2003-07-17
Points: 0

JDK 1.5.0-01 also fails to load textures in Java3D applets.
Bug in javax.imageio.ImageIO class.

nikolai
Offline
Joined: 2003-06-10
Points: 0

> Of course it not happens in the "old" Java3D 1.3.1, because it not use ImageIO, but Toolkit.getImage(url).

Is there an environment variable to switch to using toolkit again??

kcr
Offline
Joined: 2004-03-17
Points: 0

> Is there an environment variable to switch to using toolkit again??

No, but since the source for the utilties has been released under a BSD license, an application is free to take the Java 3D 1.3.1 version of TextureLoader and incorporate it into their application. Just change the package name and import statement to use that class rather than com.sun.j3d.utils.image.TextureLoader.

Long term, it seems like filing a new core Image I/O bug is in order (I took a look at 5076692 and since that deals with plug-ins, and Alejandro is having problems with the core JPEG loader, I doubt it's the same bug). I believe that Bug Parade on java.sun.com is the best way to do this.

-- Kevin

aces
Offline
Joined: 2003-07-17
Points: 0

I submit a example to ImageIO bug parade some days ago.
They are still analyzing it.
I hope they fix it soon. ImageIO support more image types than Toolkit.

Alessandro

kcr
Offline
Joined: 2004-03-17
Points: 0

> I guess this is ImageIO bug, and not a Java3D, but I guess you have the right channels to solve it.

I'll pass this along to the Java Advanced Imaging (JAI) team.

-- Kevin

aces
Offline
Joined: 2003-07-17
Points: 0

Thank you ;)

kcr
Offline
Joined: 2004-03-17
Points: 0

I received this responses from one of the JAI developers, Brian Burkhalter:

----- Begin Included Message -----

This looks to me like this bug:

5063709 JAI-Image I/O reader-writer plug-ins pragmatically unusable in applet context

which we think is actually a core J2SE Image I/O bug:

5076692 Installed Extensions Image I/O reader-writer plug-ins unusable in applet context

---

One other thing, if it's Image I/O it could be core J2SE or JAI-Image I/O. If you don't see "com.sun.media" in the trace then it's core J2SE as all our stuff is under this hierarchy whereas core is javax.image or com.sun.imageio.

Brian

----- End Included Message -----

kcr
Offline
Joined: 2004-03-17
Points: 0

Here is another response that I received from Aastha Bhardwaj:

----- Begin Included Message -----

I have a few comments:

1. As Brian indicated, I do not see anything in the stack trace or the code that relates to JAI, so this does seem to be a core Image I/O issue.

2. I note from the TextureLoader class, that whatever JAI code existed in that class was replaced with javax.imageio.ImageIO for image loading in the version 1.2 of the class, so again this would seem to indicate this is not a JAI issue.

3. Finally, the stack trace seems to indicate the problem is with the ServiceConfiguration file

sun.misc.ServiceConfigurationError:
javax.imageio.spi.ImageOutputStreamSpi: http://planeta.terra.com.br/educacao/alessandroborges/textureImage/META-... Illegal configuration-file syntax

It seems to me that in the META-INF/services directory of the user's setup, there is a javax.imageio.spi.ImageOutputStreamSpi file which has some syntax error on line 1. What I am not sure about is whether this file is automatically created, or was created by the user? Brian, do you have any comments on this?

Aastha

----- End Included Message -----

aces
Offline
Joined: 2003-07-17
Points: 0

Thank you, Kevin

about Aastha Bhardwaj reply:

I am using the plain j2sdk 1.5.0 install. I did not change anything , except Java3D install.

kcr
Offline
Joined: 2004-03-17
Points: 0

> I am using the plain j2sdk 1.5.0 install. I did not change anything , except Java3D install.

The difference being that Java 3D 1.3.2 now uses Image I/O whereas Java 3D 1.3.1 did not. What type of image files are you trying to load?

Btw, the ImageIO call that the TextureLoader now uses for the URL case is:

ImageIO.read(URL);

which should pick a default ImageReader. What Aastha noticed is that the stack trace suggests that something is trying to access services/javax.imageio.spi.ImageOutputStreamSpi resource from your site via http.

-- Kevin

kcr
Offline
Joined: 2004-03-17
Points: 0

One more note. I just tried running our TickTockPicking example program via http and it was able to load the image with no problems. I did notice several messages of the .../TickTockPicking/META-INF/services/javax.imageio.spi.ImageWriterSpi so the system must be generating them (the TickTockPicking applet is just a straight Java 3D applet with nothing special).

-- Kevin