You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by it...@daimler.com on 2013/11/21 13:06:23 UTC

JSP's always marked as outdated with Jar Scanner Component configured with “scanAllDirectories” and referenced Taglib in WEB-INF/classes/META-INF

Hi,

consider the following (simplified) project configuration.

web_base_jar (shared taglib etc.)
web_war (uses web_base_jar)

When developing our web project locally we use an exploded war layout. The compile output of web_base_jar is directly copied (not as a jar!) to the war’s
web_war/WEB-INF/classes directory by our ide’s (eclipse with sysdeo plugin and intellij). Our shared taglib ends up here: web_war/WEB-INF/classes/META-INF/myTaglib.tld. The taglib is successfully picked up by the Jar Scanner configured with “scanAllDirectories”.

This leads to the following generated jsp code when myTaglib is used:

  static {
    _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(1);
    _jspx_dependants.put("file:/somepath/pc_web_war_exploded/WEB-INF/classes/META-INF/ myTaglib.tld ", Long.valueOf(-1L));
  }

The relevant code for this snippet is in org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:173). Because the Taglib is a file uri (file:/C:/somepath/pc_web_war_exploded/WEB-INF/classes/META-INF/myTaglib.tld) it is not found by ApplicationContext#getResource and the method
org.apache.jasper.JspCompilationContext.getLastModified(JspCompilationContext.java:437) returns -1 in this case.

When the compiler checks if the current jsp is outdated it checks also all includes/dependants. Because myTaglib is in the dependants  list of our jsps it is also checked. The check tests
the lastModified timestamp of the file against -1 and returns always true. See here org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:519)
This means that our jsps are recompiled on every request. We have some workarounds for this but it would be nice if this setup would work

Tomcat Version: 7.0.47

Thanks and regards

Philip Herbst

If you are not the addressee, please inform us immediately that you have received this e-mail by mistake, and delete it. We thank you for your support.


Re: JSP's always marked as outdated with Jar Scanner Component configured with “scanAllDirectories” and referenced Taglib in WEB-INF/classes/META-INF

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/11/21  <it...@daimler.com>:
> Hi,
>

Please file an issue in Bugzilla against the Jasper component

> consider the following (simplified) project configuration.
>
> web_base_jar (shared taglib etc.)
> web_war (uses web_base_jar)
>

So, you have two projects in Eclipse IDE.
The "war" project references "jar" project as a dependency in its Java
Build Path configuration.


> When developing our web project locally we use an exploded war layout. The compile output of web_base_jar is directly copied (not as a jar!) to the war’s
> web_war/WEB-INF/classes directory by our ide’s (eclipse with sysdeo plugin and intellij). Our shared taglib ends up here: web_war/WEB-INF/classes/META-INF/myTaglib.tld. The taglib is successfully picked up by the Jar Scanner configured with “scanAllDirectories”.
>
> This leads to the following generated jsp code when myTaglib is used:
>
>   static {
>     _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(1);
>     _jspx_dependants.put("file:/somepath/pc_web_war_exploded/WEB-INF/classes/META-INF/ myTaglib.tld ", Long.valueOf(-1L));
>   }

It should not be -1. Here the things start going wrong.

> The relevant code for this snippet is in org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:173). Because the Taglib is a file uri (file:/C:/somepath/pc_web_war_exploded/WEB-INF/classes/META-INF/myTaglib.tld) it is not found by ApplicationContext#getResource and the method
> org.apache.jasper.JspCompilationContext.getLastModified(JspCompilationContext.java:437) returns -1 in this case.
>
> When the compiler checks if the current jsp is outdated it checks also all includes/dependants. Because myTaglib is in the dependants  list of our jsps it is also checked. The check tests
> the lastModified timestamp of the file against -1 and returns always true. See here org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:519)
> This means that our jsps are recompiled on every request. We have some workarounds for this but it would be nice if this setup would work
>
> Tomcat Version: 7.0.47
>
> Thanks and regards
>
> Philip Herbst
>

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