Bug 58192

Summary: ImageIO based applications fail to deploy in Tomcat 8.0.24 (worked in 8.0.23)
Product: Tomcat 7 Reporter: Andrea Aime <andrea.aime>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: regression CC: joerg.hohwiller, martin.wegner
Priority: P2    
Version: 7.0.63   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Andrea Aime 2015-07-30 08:39:39 UTC
We have received several reports recently that GeoServer fails to deploy in Tomcat 8, and with some discussion, we poinpointed 8.0.24 as the version where this start happening, we have reports of deploys working without problems on 8.0.21 and 8.0.23 instead.

The issue happens as we try to initialize the ImageIO subsystem, here is the stack trace:

java.util.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: Provider com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi could not be instantiated
	at java.util.ServiceLoader.fail(ServiceLoader.java:232)
	at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:210)
	at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:138)
	at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:159)
	at org.geoserver.GeoserverInitStartupListener.contextDestroyed(GeoserverInitStartupListener.java:295)
	at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4776)
	at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5390)
	at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1768)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: vendorName == null!
	at javax.imageio.spi.IIOServiceProvider.<init>(IIOServiceProvider.java:76)
	at javax.imageio.spi.ImageReaderWriterSpi.<init>(ImageReaderWriterSpi.java:231)
	at javax.imageio.spi.ImageReaderSpi.<init>(ImageReaderSpi.java:212)
	at com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi.<init>(CLibJPEGImageReaderSpi.java:80)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at java.lang.Class.newInstance(Class.java:442)
	at java.util

Here is the associated GeoServer ticket: https://osgeo-org.atlassian.net/browse/GEOS-7122
Comment 1 Christopher Schultz 2015-07-30 20:09:00 UTC
Is this possibly environmental?

Comment 2 Andrea Aime 2015-07-30 21:50:27 UTC
I've read that stackoverflow article, it seems to be related to a fatjar usage, which we don't use. The stack trace we're getting it about a class that's in the stock imageio jar file, which we did not modify.

The GeoServer version used is also an official release, if you want to try, you can pick this one for example:

I've just tried it, it works in Tomcat 8.0.23... while this cannot exclude an enviroment dependnecy, it at least provies that there is a Tomcat version dependency (the same war breaks deploying in 8.0.24).

I've tried both cases with Java 1.7.0_72 and 1.8.0_25, same results, does not appear to be JDK dependent.

Oh, also the Tomcat versions tried were stock, just downloaded from the official web site as tar.gz distros.
Native JAI and native JAI Image I/O are not installed in either case.
Comment 3 Christopher Schultz 2015-07-30 22:38:43 UTC
I wonder if Tomcat's resource-locating implementation is failing, here. I seem to recall something changing recently with how getPackage() works, or something like that.

Can you produce a simple, self-contained test case? A binary WAR including source would be best. I suspect you only need to bundle the imageio JAR file and try to use it in, say, a simple JSP.
Comment 4 Mark Thomas 2015-08-04 20:31:50 UTC
*** Bug 58208 has been marked as a duplicate of this bug. ***
Comment 5 Mark Thomas 2015-08-04 20:33:05 UTC
This is a regression in the fix for bug 58023. I'm looking at a fix now.
Comment 6 Andrea Aime 2015-08-04 20:36:09 UTC
Btw, we did try to generate a simple self contained example, but failed so far.
Comment 7 Mark Thomas 2015-08-04 21:57:47 UTC
Fixed in trunk and 8.0.x (for 8.0.25 onwards). The back-port to 7.0.x is a little more complicated.
Comment 8 Mark Thomas 2015-08-04 22:16:52 UTC
Further investigation has shown this issue is far less likely to affect 7.0.x because of the separate caching in the resource implementation and in the class loader.

The issue is still possible and a fix has been back-ported for 7.0.64 onwards.
Comment 9 Andrea Aime 2015-08-05 05:47:26 UTC
That's great, are there nightly builds that we can test?
Comment 10 Mark Thomas 2015-08-05 08:59:39 UTC
No nightly builds but Tomcat 8 is very easy to build from source. Alternatively, I can make a development build available for you to download. Let me know if you need that.
Comment 11 Martin Wegner 2015-08-10 08:14:50 UTC
I checked out http://svn.apache.org/repos/asf/tomcat/tc8.0.x/trunk and run the Ant task 'release':

C:\Users\XXX\workspace\Tomcat 8\build.xml:1587: Error while expanding C:\Users\XXX\workspace\Tomcat 8\output\extras\logging\commons-logging-src.tar
java.io.IOException: Error detected parsing the header
Comment 12 Violeta Georgieva 2015-08-10 08:33:08 UTC
(In reply to Martin Wegner from comment #11)


> I checked out http://svn.apache.org/repos/asf/tomcat/tc8.0.x/trunk and run
> the Ant task 'release':
> C:\Users\XXX\workspace\Tomcat 8\build.xml:1587: Error while expanding
> C:\Users\XXX\workspace\Tomcat 8\output\extras\logging\commons-logging-src.tar
> java.io.IOException: Error detected parsing the header

This is a known issue with ANT 1.9.4 [1].


[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=56641
Comment 13 Martin Wegner 2015-08-10 08:38:10 UTC
And what can I do about it?
Comment 14 Violeta Georgieva 2015-08-10 08:39:40 UTC
(In reply to Martin Wegner from comment #13)
> And what can I do about it?

What do you think about using ANT 1.9.6?
Comment 15 Martin Wegner 2015-08-10 08:42:34 UTC
I use Eclipse Mars (the newest of the newest) but it comes with Ant 1.9.4...what a pity :(
Comment 16 Martin Wegner 2015-08-10 08:52:14 UTC
OK with Ant 1.9.6 I get this error:


C:\Users\XXX\workspace\Tomcat 8\build.xml:2175: Execute failed: java.io.IOException: Cannot run program "C:\Users\XXX\workspace\Tomcat 8\output\dist\tempinstaller.exe" (in directory "C:\Users\XXX\workspace\Tomcat 8\output\dist"): CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at java.lang.Runtime.exec(Runtime.java:620)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
        at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.Main.runBuild(Main.java:853)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
        at java.lang.ProcessImpl.start(ProcessImpl.java:137)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 23 more
Comment 17 Violeta Georgieva 2015-08-10 08:56:09 UTC

Please use tomcat users mailing list as this does not belong to this issue.

Thanks a lot,
Comment 18 Martin Wegner 2015-08-10 09:04:52 UTC
"No nightly builds but Tomcat 8 is very easy to build from source."

So it is not easy.

"Alternatively, I can make a development build available for you to download. Let me know if you need that."

Yes we need that.

Comment 19 Mark Thomas 2015-08-10 15:47:21 UTC
Just use 'ant' rather than 'ant release'. You don't need a full release build. You'll find CATALINA_HOME at output/build
Comment 20 Martin Wegner 2015-08-11 08:31:35 UTC
OK running Ant with default task worked and replacing the 8.0.24 catalina.jar with the new build catalina.jar fixed the problem...the GeoServer is up and running :)