我想在Tomcat 8下使用符号链接JSP目录.
它在Tomcat 7中也可以这样工作:
<Context allowLinking="true">
Run Code Online (Sandbox Code Playgroud)
但似乎Tomcat 8放弃了这个功能,它开始使用资源
(http://tomcat.apache.org/migration-8.html#Web_application_resources).
我的示例用法:
ROOT/jsp目录 - > linksto - >/var/tmp/realplaceofjspfiles /
配置错误:
ROOT/META-INF/context.xml的:
<Context>
<Resources allowLinking="true">
<PreResources className="org.apache.catalina.webresources.DirResourceSet" base="/var/tmp/realplaceofjspfiles" internalPath="jspdirectory"/>
</Resources>
</Context>
Run Code Online (Sandbox Code Playgroud)
它为我丢掉了这个例外:
07-Mar-2014 04:09:12.113 WARNING [localhost-startStop-1] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Context/Resources/PreResources} Setting property 'internalPath' to 'jspdirectory' did not find a matching
property.
07-Mar-2014 04:09:12.114 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[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1134)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1780)
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 …Run Code Online (Sandbox Code Playgroud) 我的项目包括Apache commons-* library。
Tomcat关机时引发异常,如果运行默认示例,则不引发异常。
卡塔利娜:
信息:非法访问:该Web应用程序实例已被停止。无法加载org.apache.log4j.spi.ThrowableInformation。最终的后续堆栈跟踪是由出于调试目的引发的错误以及试图终止导致非法访问的线程而引起的,并且没有功能影响。
信息:非法访问:该Web应用程序实例已被停止。无法加载org.apache.log4j.spi.ThrowableInformation。最终的后续堆栈跟踪是由出于调试目的引发的错误以及试图终止导致非法访问的线程而引起的,并且没有功能影响。
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Sep 24, 2012 4:00:14 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance ses ahas been stopped already. Could not load org.apache.commons.pool.impl.CursorableLinkedList$Cursor. The eventual following stack trace is caused by an error thrown for debugging purpos well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1600)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.commons.pool.impl.CursorableLinkedList.cursor(CursorableLinkedList.java:305)
at org.apache.commons.pool.impl.GenericObjectPool.evict(GenericObjectPool.java:1536)
at org.apache.commons.pool.impl.GenericObjectPool$Evictor.run(GenericObjectPool.java:1749)
at …Run Code Online (Sandbox Code Playgroud)