← Back to team overview

slub.team team mailing list archive

[Merge] lp:~ralf-claussnitzer/goobi-production/bug-788160 into lp:goobi-production

 

Ralf Claussnitzer has proposed merging lp:~ralf-claussnitzer/goobi-production/bug-788160 into lp:goobi-production.

Requested reviews:
  Henning Gerhardt (henning-gerhardt)
Related bugs:
  Bug #788160 in Goobi.Production: "Error reading in TIFF images (in metadata editor)"
  https://bugs.launchpad.net/goobi-production/+bug/788160

For more details, see:
https://code.launchpad.net/~ralf-claussnitzer/goobi-production/bug-788160/+merge/102798
-- 
https://code.launchpad.net/~ralf-claussnitzer/goobi-production/bug-788160/+merge/102798
Your team Saxon State Library Team is subscribed to branch lp:goobi-production.
=== modified file 'WEB-INF/web.xml'
--- WEB-INF/web.xml	2011-12-20 08:07:09 +0000
+++ WEB-INF/web.xml	2012-04-20 07:17:18 +0000
@@ -210,6 +210,11 @@
 		<url-pattern>*.jsf</url-pattern>
 	</filter-mapping>
 
+    <!-- Listener for ImageIO initialization (Tomcat workaround) -->
+    <listener>
+		<listener-class>org.goobi.production.ImageIOInitializer</listener-class>
+    </listener>
+
 	<!--
 		xml-Rpc-Server starten <listener> <listener-class>
 		de.sub.goobi.XmlRpc.Listener </listener-class> </listener>
@@ -224,7 +229,8 @@
 	<listener>
 		<listener-class>org.goobi.production.flow.jobs.JobManager</listener-class>
 	</listener>
-	<!--  
+
+	<!--
 	<listener>
 		<listener-class>
 			org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
@@ -232,7 +238,7 @@
 -->
 
 	<listener>
-        	<listener-class>org.goobi.production.GoobiVersionListener</listener-class>
+		<listener-class>org.goobi.production.GoobiVersionListener</listener-class>
 	</listener>
 
 	<!-- Faces Servlet -->

=== added file 'src/org/goobi/production/ImageIOInitializer.java'
--- src/org/goobi/production/ImageIOInitializer.java	1970-01-01 00:00:00 +0000
+++ src/org/goobi/production/ImageIOInitializer.java	2012-04-20 07:17:18 +0000
@@ -0,0 +1,53 @@
+/*
+ * This file is part of the Goobi Application - a Workflow tool for the support of
+ * mass digitization.
+ *
+ * Visit the websites for more information.
+ *     - http://gdz.sub.uni-goettingen.de
+ *     - http://www.goobi.org
+ *     - http://launchpad.net/goobi-production
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.goobi.production;
+
+import javax.imageio.ImageIO;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+/**
+ * Listener to set up static ImageIO library with web application class loader.
+ * <p/>
+ * This listener works as a workaround for problems occurring when bootstrapping web applications
+ * using ImageIO library within Tomcat when using JreMemoryLeakPreventionListener.
+ *
+ * Bug and solution described here:
+ * https://bugs.launchpad.net/goobi-production/+bug/788160
+ *
+ */
+public class ImageIOInitializer implements ServletContextListener {
+
+	static {
+		// makes sure, plugins get loaded via web application class loader
+		// and are available for later calls from the application
+		ImageIO.scanForPlugins();
+	}
+
+	public void contextInitialized(ServletContextEvent sce) {
+	}
+
+	public void contextDestroyed(ServletContextEvent sce) {
+	}
+
+}


Follow ups