Bug 59608 - Manifest scanning should handle errors in resolving entries
Summary: Manifest scanning should handle errors in resolving entries
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Util (show other bugs)
Version: 8.0.35
Hardware: PC Linux
: P2 regression (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-20 12:32 UTC by Andreas Kohn
Modified: 2016-05-20 15:59 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kohn 2016-05-20 12:32:50 UTC
https://bz.apache.org/bugzilla/show_bug.cgi?id=59226 added scanning of the Class-Path JAR manifest entries (Yay!). 

Unfortunately this now broke my Tomcat setup when updating from 8.0.33 to 8.0.35, I now see these errors in the logs:
~~~~
20-May-2016 12:15:39.467 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/collaborne/j2ee-server/webapps/manager
20-May-2016 12:15:39.494 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/manager]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
	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.deployDirectory(HostConfig.java:1092)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834)
	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: Illegal character in path at index 0: \
	at java.net.URI.create(URI.java:852)
	at java.net.URI.resolve(URI.java:1036)
	at org.apache.tomcat.util.scan.StandardJarScanner.processManifest(StandardJarScanner.java:400)
	at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:324)
	at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:273)
	at org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(ContextConfig.java:1887)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1127)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:779)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:306)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5171)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	... 10 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 0: \
	at java.net.URI$Parser.fail(URI.java:2848)
	at java.net.URI$Parser.checkChars(URI.java:3021)
	at java.net.URI$Parser.parseHierarchical(URI.java:3105)
	at java.net.URI$Parser.parse(URI.java:3063)
	at java.net.URI.<init>(URI.java:588)
	at java.net.URI.create(URI.java:850)
	... 22 more

20-May-2016 12:15:39.494 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory /opt/collaborne/j2ee-server/webapps/manager
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/manager]]
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
	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.deployDirectory(HostConfig.java:1092)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834)
	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)

20-May-2016 12:15:39.495 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/collaborne/j2ee-server/webapps/manager has finished in 27 ms
~~~~

I was able to track this down to a bug inside Batik 1.7 (https://bz.apache.org/bugzilla/show_bug.cgi?id=51908), but I'm pretty tied to that version at this moment.

1. I think it would be a good idea to log the JAR name/path/URI that is currently processed, so that finding these problems would not require stepping through Tomcat :)
2. Given that things worked before without these entries being read, it seems like Tomcat should catch exceptions here, and just log them as warning. For Tomcat 9 one might be more aggressive, but for 8.x this failure mode seems to be to aggressive.
Comment 1 Remy Maucherat 2016-05-20 15:59:24 UTC
Only one URL error was caught and logged, I also prefer catching everything there. Errors will be logged as debug with the offending JAR URL.
Included in 9M7, 8.5.3 and 8.0.36.