View Full Version : JSP compilation problem

02-10-2011, 01:13 PM
Hello, I need to pre-compile JPSs. I've invoked the following command (from resin root):

> java -cp %CP% com.caucho.jsp.JspCompiler -app-dir webapps\ROOT -class-dir .jsp

What I've noticed is that JspCompiler is *starting* my web application. Soon, starting fails and compilation won't even start. Of course, deployed web application runs usually without a problem.

[1] why JspCompiler starts my deployed web application? Usually, on other app server, jsp compilation is independent from running the web application. Am i doing it right? Can I prevent start of web application and just force jsp compilation?

[2] Does '-app-dir' point to web application root, i.e. the root of whole web application; with web-inf and libs, i.e. where web application is deployed?
OR it may point just to 'docroot', the folder that contains just jsps, taglibs etc (not a full, deployed, application).

Resin 4.0.14

Thank you!

02-10-2011, 07:47 PM
addendum: i was able to run JspCompiler without the error, but still the whole web application started, and that takes a lot of time. Moreover, after compilation is done, web application is still up.

[3] Is it possible to pass a list of jsp files to the JspCompiler?

02-11-2011, 11:13 PM

* As far as I can tell, the JSP compiler does not start a Resin instance. It does init and destroy a web application instance under the hood. Are you sure this is what is happening? I'll test this some more and I will enter a bug report if this is really the case.
* Yes, you can specify a set of space-separated JSP names to the compiler via the command-line.
* '-app-dir' points to web application root.


02-12-2011, 01:46 AM

I can't see how I can reproduce what you seem to be observing. JSP compile works fine for me and no resin instance is started (as I mentioned, the web app is initialized under the hood to resolve all runtime dependencies).

If you can tell me how to reproduce the bug, I'll try it again.


02-16-2011, 10:05 AM
> It does init and destroy a web application instance under the hood.

Ok, probably this is what is happening, since no app is available on 8080. But it's interesting that I make initialization fail early by not providing all the jars in my ant task, however the compilation still works in the background (this significantly shortes compilation time). i just wonder if this is really necessary? afaik usually jsp compilers doesn't init application - and in my case this would create the demo database, creation of necessary folders etc.

> '-app-dir' points to web application root.

yes, my experience tells me that when app-dir points to webapps root, initialization may finish correctly. since i do not want that, i was able to run compiler and have app-dir to points just to source folders where .jsps are (explained above).

if some one wants to test this, it would be easy. again, its liferay project:) so, assuming all latest trunk sources are available, then:

+ create file app.server.<userprofile_name>.properties in portal folder

+ add following line: app.server.type=resin

+ unzip and prepare resin:
cd portal
ant -f build-dist.xml unzip-resin

+ compile
cd portal-web
ant compile-resin

02-16-2011, 10:05 PM

I'm not a 100% sure the web application init is really needed. I've entered a low-priority bug for it here: http://bugs.caucho.com/view.php?id=4397.

Feel free to track it.