tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Registering Plugins, e.g. javax.imageio...
Date Wed, 11 Sep 2013 15:36:37 GMT
Hash: SHA256


On 9/10/13 6:34 PM, George S. wrote:
> On 9/10/13 3:14 PM, Christopher Schultz wrote:
>> ----- Is there a way that I can specify something in the
>> server.xml code that would register them? The only thing I can
>> see is to create a org.apache.catalina.LifecycleListener and put
>> the code to register the plugins in there.
>> Is there some other way of doing it? How would you do it if you
>> weren't running under Tomcat?
> I only ever run Java with tomcat (or maybe ant), so I wouldn't
> know.

Okay. I had never heard of an "imageio plugin" before. Are you
basically registering file-type handlers?

I'm just guessing at all of this, since I've never done anything
besides use ImageIO for mundane operations like loading, saving, and
re-sizing images.

Have you called ImageIO.scanForPlugins()?

The documentation gives light detains on how the plug-ins are found:

What version of Java are you using?

>> Perhaps you have to place youe plugins under an "endorsed"
>> directory (i.e. one specified via JAVA_ENDORSED_DIRS environment
>> variable when using Tomcat startup scripts).
>> - -chris
> Well, I think this is how it's "supposed" to be done. However, the
> jar's internal getResourceAsStream() function is failing when it's
> trying to load properties that are built into the jar. This is
> being tested without a security manager. It looks like being run
> in java.endorsed.dirs is breaking the classloader. I did some
> research, and it looks like java.endorsed.dirs runs in Tomcat's
> Bootstrap classloader. The comments in the class loader howto don't
> make me optimistic that I could make this work.
> I think I'm just going to follow through on my original idea of
> using a PluginLoader as a LifecycleListener

You probably don't have to do this. Just make sure that your JAR file
has all the resources in the right place(s) and it "should" work.
Testing outside of Tomcat should be easy: just write a small harness
that tries to e.g. load an image of one of those exotic types that the
JVM doesn't already recognize, and make sure that CLASSPATH is correct
when running it. If that works, it should work in Tomcat, too, since
the ClassLoader should always be the WebappClassLoader, whose resource
list includes all JAR files in WEB-INF/lib and all files rooted in

- -chris
Version: GnuPG v1.4.14 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Thunderbird -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message