tomcat-users mailing list archives

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

George,

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:

http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html#scanForPlugins%28%29

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
WEB-INF/classes

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSMI4FAAoJEBzwKT+lPKRYISYQALXbDqfYjkotZq24fjJutG7A
wDdbFGY9a+eM27iZvHpPQAkuCmLTrD16uNyuAcQRBpoZb3ciaE5ZQwOcwBt620qM
Ia5th3e2SM303GaQ6MCfnreLOr2UqIeJhcbnv8+y/65XAAVik9hYhXY1KHNVRQLJ
srJMFMT+XeSjI2YLeIwRz8gEUZDh8wAaVCMe3M/smmQSsOFbRy+3rkbCv2Qr+isA
MDdgZlz8KCtNUg7Gg3ycTMk9gIYOcLN0hhOr7SAWjOok9a9FEe+g6BelWf8FwRQK
KGz//xS3ICoCn8q3hyAZ7dzqtK12AV5V+bV0qduNheqgouzdxwjI0yzJJd2vtk1+
wFlmtLE8fooAsne7kESyPhRvpQEir001pXftCJmef4hKqa5nr5YQY5HCgC3Pp3TG
Gy0IpBmxEo5FI3hcbJKq5nIae8qBmNKIrmwO88+hFqaG+cQFzXPmZnio4QYTk7xQ
QLyMHtqdGz5yxPupMpeWa2plfA4n9qe/4ex83njIGcaICh26Bulb4McV/5yBVgTz
+YkoD7HYkbpNnvcU8EaE4QCYIbq256GPt3mLt3Jmz/056xPnFPG0J3MdBHSuz//t
jqjN/uuSdJaOEN80Yqqbc4+3P9p+3RzYFFCV1CYE+tvFDyYXWwsWkGlbqRmPOdx6
/6fWPb42Xc2oRw1Uvhp5
=AI2a
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message