Problem with compilation of dynamically generated JSPs on JBoss WildFly
mortenheine Jul 5, 2016 12:29 PMWe have this application with a bunch of JSPs. Some are static, some are generated dynamically.
The application is packed up as an ear file that includes a war file. That war file includes the static JSPs.
The ear file is dumped in deployments and JBoss deploys the ear file OK, including the war file, and in turn including the JSPs.
We see the following generated directories:
1) tmp/vfs/deployment/deploymentxxxxxxxx/<myWarFile>.war-yyyyyyyyy/
2) tmp/<myEarFile>.ear.<myWarFile>.war/org/apache/jsp/
The static JSP-files appear in directory 1).
When we access the static JSP-files via a browser, the corresponding java files are automatically generated and compiled and the result resides in directory 2).
Along the way, some dynamic JSP-files are generated and placed in directory 1). Yes, the internal directory that JBoss has generated. This is an application that was written some time ago and has apparently worked fine on an earlier JBoss AS version.
However, when we access these dynamic JSPs from a browser, JBoss returns an error that the file is not found, instead of generating the java file and compiling it:
Unhandled exception occurred whilst decorating page: java.lang.RuntimeException: javax.servlet.ServletException: JBWEB004036: File "<myJSP>.jspx" not found
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:40)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:83)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:91)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
It is as if JBoss internally knows that it must compile the static JSPs that were there from the beginning, but does not know it must compile the dynamic JSPs. Or for some reason it does not see the JSP even if it is there.
Sometimes Jboss after a while (that appears to have random duration) decides to compile the dynamic JSPs when I hit them. Sometimes it seems to make a difference that I restart the server, other times not. After hours of experimenting, it still seems totally random whether Jboss compiles the dynamic JSPs or not.
Of course, we have experimented with the jsp-configuration element in the configuration, but it seems to make no difference. We assume this configuration only applies to the deployments directory, not these internal directories.
Of course, we have considered exploded deployment, but we understand that this is not intended for production, plus we are running a cluster in production and in this case, exploded deployment is not possible, as far as we understand. In our test setup, we're running a single server.
The only way out seems to be to avoid the generation of dynamic JSPs. Those JSPs are a mixture of HTML and java code. But probably the java code can be executed at generation time instead of when the JPSs are hit. However, this is still a significant rewrite of the code, and we would prefer to keep the existing code.
Any suggestions would be highly appreciated.