Re: precompiling JSPs -- how to resolve references normally resolved by apache?
Unless you have a directory ${TOP}/web/html/jsp/jsp your uribase/uriroot probably aren't right. [EMAIL PROTECTED] wrote: Hi, I am trying to get our JSPs to be precompiled as part of our ant build process to catch all syntax errors at compile time. The problem I have run into is that we are using apache + tomcat and we have set the following rules in apache httpd. conf: JkMount /servlets/* ajp13 JkMount /jsp/* ajp13 JkMount /controller/* cont JkMount /cgi-bin/java-rmi.cgi ajp13 Inside some of our servlets and JSPs, they refer to other jsps using the absolute URL /jsp/ which works in deployed environment because apache redirects it. For example, in one JSP we have %@ include file=/jsp/Header.jsp % I setup the tomcat-4.1.30 ant jspc task and it was giving a NPE. Then I tried the Ant Jspc optional task, and it gave me an error message: the file '\Status.jsp' generated the following general exceptionn: org.apache.jasper.JasperExeption: /Status.jsp(3,0) File /jsp/Header.jsp not found Is there any quick and dirty way to get the JspC to resolve the /jsp/*.jsp urls to *.jsp or is there no way? My alternative is to try to change all the /jsp/*.jsp references to *.jsp everywhere we do an %@ include % or jsp:include/ or jsp:forward/. I think that would be ok since those directices are handled on the tomcat side. Changing it would be kind of messy since we have a ton of JSPs in a large directory hierarchy, so some of those /jsp/Header.jsp references would have to be changed to ../../Header.jsp, etc. I know I can't get away from the /jsp mapping completely because we have URLs and HTTP redirects which depend on it. Here is the quick and dirty jspc ant target I created: jspc srcdir=${TOP}/web/html/jsp uribase=${TOP}/web/html/jsp uriroot=${TOP}/web/html/jsp destdir=${TMP_DIR}/WEB-INF/src compiler=jasper41 verbose=9 include name=*.jsp/ classpath !--todo: including all the tomcat jars, overkill i know...-- fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\bin include name=*.jar/ /fileset fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\common\endorsed include name=*.jar/ /fileset fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\common\lib include name=*.jar/ /fileset fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\shared\lib include name=*.jar/ /fileset fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\server\lib include name=*.jar/ /fileset !-- project classes and external 3rd party jar files -- pathelement path=${CLASS_DIR}/ filelist refid=active.external.jar.filelist/ /classpath /jspc Thanks for any advice, -Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: precompiling JSPs -- how to resolve references normally resolved by apache?
Jon, Thanks for your help. The uribase and uriroot were not set correctly. Here is the final version that I got working. I had one additional twist that I needed to copy the JSP files to another location first using the ant copy task. I set uriroot to the webapps root {dir}/html, and then jasper2 automatically found the JSP files in the subdirectories under jsp/** and correctly resolved the references /jsp/**.jsp inside the JSP files. Once it works, it's great. But it several hours of frustration because tomcat4.x jasper often just print NullPointerExceptions instead of an error message. So you have to guess what is wrong. -Alex target name=jspc depends=init mkdir dir=${TMP_DIR}/html/ mkdir dir=${TMP_DIR}/WEB-INF/classes/ mkdir dir=${TMP_DIR}/WEB-INF/src/ copy todir=${TMP_DIR}/html flatten=false fileset dir=${TOP}/web/html include name=jsp/*.jsp/ /fileset /copy taskdef classname=org.apache.jasper.JspC name=jasper2 classpath id=jspc.classpath fileset dir=${BASE_ENG_DIR}/${TOMCAT_DIR}\common\endorsed include name=*.jar/ /fileset fileset dir=${BASE_ENG_DIR}/${TOMCAT_DIR}\common\lib include name=*.jar/ /fileset !-- compiled classes and 3rd party jars -- pathelement path=${CLASS_DIR}/ filelist refid=active.external.jar.filelist/ /classpath /taskdef !--property name=p1 refid=jspc.classpath/-- !--echoclasspath = ${p1}/echo-- jasper2 verbose=9 compiler=jasper41 validateXml=false uriroot=${TMP_DIR}/html webXmlFragment=${TMP_DIR}/WEB-INF/generated_web.xml outputDir=${TMP_DIR}/WEB-INF/src / /target target name=compile-server-jsps depends=init,jspc mkdir dir=${TMP_DIR}/WEB-INF/classes/ mkdir dir=${TMP_DIR}/WEB-INF/lib/ javac destdir=${TMP_DIR}/WEB-INF/classes optimize=off failonerror=true srcdir=${TMP_DIR}/WEB-INF/src excludes=**/*.smap classpath pathelement location=${TMP_DIR}/WEB-INF/classes/ path refid=jspc.classpath/ /classpath include name=** / exclude name=tags/** / /javac /target On Thu, 06 Oct 2005 14:06:23 +0100, Jon Wingfield [EMAIL PROTECTED] said: Unless you have a directory ${TOP}/web/html/jsp/jsp your uribase/uriroot probably aren't right. [EMAIL PROTECTED] wrote: Hi, I am trying to get our JSPs to be precompiled as part of our ant build process to catch all syntax errors at compile time. The problem I have run into is that we are using apache + tomcat and we have set the following rules in apache httpd. conf: JkMount /servlets/* ajp13 JkMount /jsp/* ajp13 JkMount /controller/* cont JkMount /cgi-bin/java-rmi.cgi ajp13 Inside some of our servlets and JSPs, they refer to other jsps using the absolute URL /jsp/ which works in deployed environment because apache redirects it. For example, in one JSP we have %@ include file=/jsp/Header.jsp % I setup the tomcat-4.1.30 ant jspc task and it was giving a NPE. Then I tried the Ant Jspc optional task, and it gave me an error message: the file '\Status.jsp' generated the following general exceptionn: org.apache.jasper.JasperExeption: /Status.jsp(3,0) File /jsp/Header.jsp not found Is there any quick and dirty way to get the JspC to resolve the /jsp/*.jsp urls to *.jsp or is there no way? My alternative is to try to change all the /jsp/*.jsp references to *.jsp everywhere we do an %@ include % or jsp:include/ or jsp:forward/. I think that would be ok since those directices are handled on the tomcat side. Changing it would be kind of messy since we have a ton of JSPs in a large directory hierarchy, so some of those /jsp/Header.jsp references would have to be changed to ../../Header.jsp, etc. I know I can't get away from the /jsp mapping completely because we have URLs and HTTP redirects which depend on it. Here is the quick and dirty jspc ant target I created: jspc srcdir=${TOP}/web/html/jsp uribase=${TOP}/web/html/jsp uriroot=${TOP}/web/html/jsp destdir=${TMP_DIR}/WEB-INF/src compiler=jasper41 verbose=9 include name=*.jsp/ classpath !--todo: including all the tomcat jars, overkill i know...-- fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\bin include name=*.jar/ /fileset fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\common\endorsed
precompiling JSPs -- how to resolve references normally resolved by apache?
Hi, I am trying to get our JSPs to be precompiled as part of our ant build process to catch all syntax errors at compile time. The problem I have run into is that we are using apache + tomcat and we have set the following rules in apache httpd. conf: JkMount /servlets/* ajp13 JkMount /jsp/* ajp13 JkMount /controller/* cont JkMount /cgi-bin/java-rmi.cgi ajp13 Inside some of our servlets and JSPs, they refer to other jsps using the absolute URL /jsp/ which works in deployed environment because apache redirects it. For example, in one JSP we have %@ include file=/jsp/Header.jsp % I setup the tomcat-4.1.30 ant jspc task and it was giving a NPE. Then I tried the Ant Jspc optional task, and it gave me an error message: the file '\Status.jsp' generated the following general exceptionn: org.apache.jasper.JasperExeption: /Status.jsp(3,0) File /jsp/Header.jsp not found Is there any quick and dirty way to get the JspC to resolve the /jsp/*.jsp urls to *.jsp or is there no way? My alternative is to try to change all the /jsp/*.jsp references to *.jsp everywhere we do an %@ include % or jsp:include/ or jsp:forward/. I think that would be ok since those directices are handled on the tomcat side. Changing it would be kind of messy since we have a ton of JSPs in a large directory hierarchy, so some of those /jsp/Header.jsp references would have to be changed to ../../Header.jsp, etc. I know I can't get away from the /jsp mapping completely because we have URLs and HTTP redirects which depend on it. Here is the quick and dirty jspc ant target I created: jspc srcdir=${TOP}/web/html/jsp uribase=${TOP}/web/html/jsp uriroot=${TOP}/web/html/jsp destdir=${TMP_DIR}/WEB-INF/src compiler=jasper41 verbose=9 include name=*.jsp/ classpath !--todo: including all the tomcat jars, overkill i know...-- fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\bin include name=*.jar/ /fileset fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\common\endorsed include name=*.jar/ /fileset fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\common\lib include name=*.jar/ /fileset fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\shared\lib include name=*.jar/ /fileset fileset dir=C:\Program Files\Apache Group\Tomcat 4.1\server\lib include name=*.jar/ /fileset !-- project classes and external 3rd party jar files -- pathelement path=${CLASS_DIR}/ filelist refid=active.external.jar.filelist/ /classpath /jspc Thanks for any advice, -Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Precompiling JSPs fails
Hi, Im using Tomcat 5.5.9 and JDK 1.5.0_02. Im trying to precompile the Liferay Pro Portal 3.2 JSPs using the ant build script found on the apache web site: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jasper-howto.html#Web%20Appl ication%20Compilation modified to add jars placed in common/lib/ext. JAVA_HOME is set to /usr/java/jdk1.5.0_02. When I run the ant script, I get a NullPointerException. Below is the script I am using and the output from the ant command. Any idea what I might be doing wrong? Thanks. -- Bud project name=Webapp Precompilation default=all basedir=. target name=jspc taskdef classname=org.apache.jasper.JspC name=jasper2 classpath id=jspc.classpath pathelement location=${java.home}/../lib/tools.jar/ fileset dir=${tomcat.home}/bin include name=*.jar/ /fileset fileset dir=${tomcat.home}/server/lib include name=*.jar/ /fileset fileset dir=${tomcat.home}/common/lib include name=*.jar/ /fileset fileset dir=${tomcat.home}/common/lib/ext include name=*.jar/ /fileset /classpath /taskdef jasper2 validateXml=false uriroot=${webapp.path} webXmlFragment=${webapp.path}/WEB-INF/generated_web.xml outputDir=${webapp.path}/WEB-INF/src / /target target name=compile mkdir dir=${webapp.path}/WEB-INF/classes/ mkdir dir=${webapp.path}/WEB-INF/lib/ javac destdir=${webapp.path}/WEB-INF/classes optimize=off debug=on failonerror=false srcdir=${webapp.path}/WEB-INF/src excludes=**/*.smap classpath pathelement location=${webapp.path}/WEB-INF/classes/ fileset dir=${webapp.path}/WEB-INF/lib include name=*.jar/ /fileset pathelement location=${tomcat.home}/common/classes/ fileset dir=${tomcat.home}/common/lib include name=*.jar/ /fileset fileset dir=${tomcat.home}/common/lib/ext include name=*.jar/ /fileset pathelement location=${tomcat.home}/shared/classes/ fileset dir=${tomcat.home}/shared/lib include name=*.jar/ /fileset fileset dir=${tomcat.home}/bin include name=*.jar/ /fileset /classpath include name=** / exclude name=tags/** / /javac /target target name=all depends=jspc,compile /target /project --- #ant -v -Dtomcat.home=/usr/local/tomcat/jakarta-tomcat-5.5.9 -Dwebapp.path=/usr/local/tomcat/jakarta-tomcat-5.5.9/webapps/liferay Apache Ant version 1.6.2 compiled on July 16 2004 Buildfile: build.xml Detected Java version: 1.5 in: /usr/java/jdk1.5.0_02/jre Detected OS: Linux parsing buildfile /usr/local/tomcat/jakarta-tomcat-5.5.9/bin/build.xml with URI = file:///usr/local/tomcat/jakarta-tomcat-5.5.9/bin/build.xml Project base dir set to: /usr/local/tomcat/jakarta-tomcat-5.5.9/bin Build sequence for target `all' is [jspc, compile, all] Complete build sequence is [jspc, compile, all, ] jspc: [jasper2] java.lang.NullPointerException [jasper2] at org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext .java:220) [jasper2] at org.apache.jasper.JspC.processFile(JspC.java:849) [jasper2] at org.apache.jasper.JspC.execute(JspC.java:991) [jasper2] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [jasper2] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) [jasper2] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) [jasper2] at java.lang.reflect.Method.invoke(Method.java:585) [jasper2] at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:123) [jasper2] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) [jasper2] at org.apache.tools.ant.Task.perform(Task.java:364) [jasper2] at org.apache.tools.ant.Target.execute(Target.java:341) [jasper2] at org.apache.tools.ant.Target.performTasks(Target.java:369) [jasper2] at org.apache.tools.ant.Project.executeTarget(Project.java:1214) [jasper2] at org.apache.tools.ant.Project.executeTargets(Project.java:1062) [jasper2] at org.apache.tools.ant.Main.runBuild(Main.java:673) [jasper2] at org.apache.tools.ant.Main.startAnt(Main.java:188) [jasper2] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196) [jasper2] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55) [jasper2] Error in class org.apache.jasper.JspC BUILD FAILED /usr/local/tomcat/jakarta-tomcat-5.5.9/bin/build.xml:27: org.apache.jasper.JasperException at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:131) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at
Precompiling jsps in different directories does not produce right servlet mappings (jasper issue)
Hi all, I have tried to google to find solution to my problem, but had no luck, and thus I am writing to this list. Also, I tried to search through archives and did not hit on any solution yet. I am using these two tasks (shown at the end of this email) in the ant file with Tomcat version 4.1.31 for precompiling jsps. I am using this because I want my jsps to be precompiled and also because I want the web.xml file to be populated automatically with all the servlet mappings for the jsps. It works fine for all the jsp files which are under the directory ${basedir}/web (one specified as uriroot for the jasper2 task). But I have a jsp in directory as file ${basedir}/web/level1/level2/bookreg_error.jsp. For this jsp file, the class is built in the right hierarchy, the class file is in location ${basedir}/war/WEB-INF/classes/${app.name}/level1/level2/bookreg_error.c lass. (which is what i expected) But the servlet mapping is still as follows (which I did not expect) in the generated_web.xml file. servlet servlet-namesic.bookreg_error_jsp/servlet-name servlet-classsic.bookreg_error_jsp/servlet-class /servlet servlet-mapping servlet-namesic.bookreg_error_jsp/servlet-name url-pattern/bookreg_error.jsp/url-pattern /servlet-mapping There is actually no class called sic.bookreg_error_jsp but only class is sic.level1.level2.bookreg_error_jsp. Instead I was expecting the generated_web.xml file to have following entry. servlet servlet-namesic.level1.level2.bookreg_error_jsp/servlet-name servlet-classsic.level1.level2.bookreg_error_jsp/servlet-class /servlet servlet-mapping servlet-namesic.level1.level2.bookreg_error_jsp/servlet-name url-pattern/level1/level2/bookreg_error.jsp/url-pattern /servlet-mapping Can somebody please help me here. Normally, I think jsps should all be in one directory. Does this org.apache.jasper.JspC assume that all jsps should be only in the uriroot level to create the servlet mappings. Thanks in advance... Shweta XML snippet from my ant build file.. --- target name=jspc taskdef classname=org.apache.jasper.JspC name=jasper2 classpath id=jspc.classpath pathelement location=${java.home}/../lib/tools.jar/ fileset dir=${tomcat.home}/server/lib include name=*.jar/ /fileset fileset dir=${tomcat.home}/common/lib include name=*.jar/ /fileset pathelement location=${basedir}/WEB-INF/classes/ /classpath /taskdef jasper2 validateXml=false package=${app.name} uriroot=${basedir}/web webXmlFragment=${basedir}/WEB-INF/generated_web.xml outputDir=${basedir}/jsp_generated / loadfile property=generated_web.xml srcFile=${basedir}/WEB-INF/generated_web.xml / replace file=${basedir}/WEB-INF/web.xml value=${generated_web.xml} token=lt;!-- GEN_JSP_TOKEN --gt;/ delete file=${basedir}/WEB-INF/generated_web.xml / javac srcdir=${basedir}/jsp_generated destdir=${basedir}/war/WEB-INF/classes include name=**/*.java/ classpath refid=classpath/ /javac /target - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: trouble precompiling JSPs
i think there should be no space between -d and the path, and no space between the two paths, i think u must use ; to separate the paths ... -Original Message- From: Atreya Basu [mailto:[EMAIL PROTECTED] Sent: 21. juli 2003 06:09 To: Tomcat Users List Subject: trouble precompiling JSPs Hello, I'm having some difficulty pre-compiling my JSPs. Could anyone give some insight into this? I type: jspc -d d:/psx_apps/WEB_INF d:\Projects\PSX_Gotter_2\CheckStatus.jsp and I get: Exception in thread main java.lang.ArrayIndexOutOfBoundsException: 3 at org.apache.jasper.JspC.locateUriRoot(JspC.java:628) at org.apache.jasper.JspC.execute(JspC.java:759) at org.apache.jasper.JspC.main(JspC.java:823) Any ideas anyone? -- Developer Greenfield Research Inc. atreya(AT)greenfieldresearch(DOT)ca (902)422-9426 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: trouble precompiling JSPs
No unfortunately that didn't help. Here is what I typed: ./jspc.sh /tmp/Stoichiometric.jsp What I got in return was: at org.apache.jasper.JspC.locateUriRoot(JspC.java:628) at org.apache.jasper.JspC.execute(JspC.java:759) at org.apache.jasper.JspC.main(JspC.java:823) If I typed: ./jspc.sh -uriroot /usr/web/cfbcad/webapps/ROOT -d /tmp /tmp/Stoichiometric.jsp I got a file called Stoichiometric_jsp.java but it was empty. What am I doing wrong? _ Atreya Basu Developer, Greenfield Research Inc. e-mail: atreya (at) greenfieldresearch (dot) ca -Original Message- From: Abid Ali Teepo [mailto:[EMAIL PROTECTED] Sent: July 21, 2003 4:59 AM To: Tomcat Users List Subject: RE: trouble precompiling JSPs i think there should be no space between -d and the path, and no space between the two paths, i think u must use ; to separate the paths ... -Original Message- From: Atreya Basu [mailto:[EMAIL PROTECTED] Sent: 21. juli 2003 06:09 To: Tomcat Users List Subject: trouble precompiling JSPs Hello, I'm having some difficulty pre-compiling my JSPs. Could anyone give some insight into this? I type: jspc -d d:/psx_apps/WEB_INF d:\Projects\PSX_Gotter_2\CheckStatus.jsp and I get: Exception in thread main java.lang.ArrayIndexOutOfBoundsException: 3 at org.apache.jasper.JspC.locateUriRoot(JspC.java:628) at org.apache.jasper.JspC.execute(JspC.java:759) at org.apache.jasper.JspC.main(JspC.java:823) Any ideas anyone? -- Developer Greenfield Research Inc. atreya(AT)greenfieldresearch(DOT)ca (902)422-9426 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
trouble precompiling JSPs
Hello, I'm having some difficulty pre-compiling my JSPs. Could anyone give some insight into this? I type: jspc -d d:/psx_apps/WEB_INF d:\Projects\PSX_Gotter_2\CheckStatus.jsp and I get: Exception in thread main java.lang.ArrayIndexOutOfBoundsException: 3 at org.apache.jasper.JspC.locateUriRoot(JspC.java:628) at org.apache.jasper.JspC.execute(JspC.java:759) at org.apache.jasper.JspC.main(JspC.java:823) Any ideas anyone? -- Developer Greenfield Research Inc. atreya(AT)greenfieldresearch(DOT)ca (902)422-9426 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: precompiling jsps
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html#Web%20Application%20Compilation (didn't work for me though, had some CLASSPATH problems which i didn't investigate further yet) At 12:31 13.07.2003 +0800, you wrote: Hi, How do you precompile jsps for tomcat? Is it possible to package compiled jsps in a jar file to be included in the WEB-INF dir of another war file? If this is documented somewhere, I'd appreciate a shove in the right direction. thanks Nathan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
precompiling jsps
Hi, How do you precompile jsps for tomcat? Is it possible to package compiled jsps in a jar file to be included in the WEB-INF dir of another war file? If this is documented somewhere, I'd appreciate a shove in the right direction. thanks Nathan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Precompiling JSPs
Here's my problem with JspC task: does not factor in class or taglib dependencies, or jsp:include references. Quote from the page mentioned below!! I need these things factored in or else you cannot run javac on these *.java files. Thanks, Andoni. - Original Message - From: Robert Priest [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 3:51 PM Subject: RE: Precompiling JSPs You should read up on the JspC task: http://ant.apache.org/manual/OptionalTasks/jspc.html The JspC task will compile your jsp file to a java servlet (.java) file. Then you can run javac/ to get your class files. You will need to download the jasper-compiler.jar and jasper-runtime.jar files. I currently do this in ant: Here is what my project for compiling my jsps looks like: project name=PW_JSPS default=build basedir=. target name=build property name=JSP_ROOT value=${WEB_MAIN}/src/java/jsp/ property name=JSP2JAVA_DIR value=${WEB_OUT}/jsp2java/ mkdir dir=${JSP2JAVA_DIR}/ echo message=*** / echo message=Building\Compiling JSP files: / echo message=*** / jspc srcdir=${JSP_ROOT} destdir=${JSP2JAVA_DIR} uriroot=${JSP_ROOT} package=com.myproj.web.jsp verbose=9 webinc=${JSP2JAVA_DIR}/generated_webxml_snippet.xml include name=**/*.jsp / classpath id=jsp_classpath pathelement path=${env.CLASSPATH}/ path refid=classpath/ pathelement location=${TOMCAT_SOURCE}common/lib/jasper-compiler.jar/ pathelement location=${TOMCAT_SOURCE}common/lib/jasper-runtime.jar/ /classpath /jspc javac srcdir=${JSP2JAVA_DIR} destdir=${WEB_OUT} includes=**/*.java listfiles=yes debug=${turn_on_debug} classpathref=jsp_classpath / /target /project -Original Message- From: Andy Eastham [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 10:37 AM To: Tomcat Users List Subject: RE: Precompiling JSPs Andoni, I do this in Sun One Studio, where I do all my Java development. You can compile JSPs just as you can compile java source. Andy -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: 18 June 2003 10:25 To: Tomcat Users List Subject: Precompiling JSPs Hello, I have a build.cmd file that I have had and modified for every project I've done for years. I should probably go learn ANT or some other build technique but for now I want to do this the command line way. I'm not even sure if ANT will do what I want. I want to have my .jsp files made into .java files (easy) then compiled into .class files (hard) before starting my Tomcat. That way I can see any syntax errors in my .jsp files. If I do this at the moment I get a load of errors where one JSP which is included in another uses variables which are only declared in the major one. Is there a way to compile the .java files the way Tomcat does (which takes account of included .jsp's)? Does ANT create .class files? Thanks in advance. Andoni. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Precompiling JSPs
Hello, I have a build.cmd file that I have had and modified for every project I've done for years. I should probably go learn ANT or some other build technique but for now I want to do this the command line way. I'm not even sure if ANT will do what I want. I want to have my .jsp files made into .java files (easy) then compiled into .class files (hard) before starting my Tomcat. That way I can see any syntax errors in my .jsp files. If I do this at the moment I get a load of errors where one JSP which is included in another uses variables which are only declared in the major one. Is there a way to compile the .java files the way Tomcat does (which takes account of included .jsp's)? Does ANT create .class files? Thanks in advance. Andoni.
RE: Precompiling JSPs
Andoni, Justin Ruthenbeck helped me with this situation. Direct your browser to: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html and look at Web Application Compilation. See if that helps you. Best regards, Wayne Chang Pacific Northwest Software Mobile: (978) 869-3446 Email: [EMAIL PROTECTED] -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 6:25 PM To: Tomcat Users List Subject: Precompiling JSPs Hello, I have a build.cmd file that I have had and modified for every project I've done for years. I should probably go learn ANT or some other build technique but for now I want to do this the command line way. I'm not even sure if ANT will do what I want. I want to have my .jsp files made into .java files (easy) then compiled into .class files (hard) before starting my Tomcat. That way I can see any syntax errors in my .jsp files. If I do this at the moment I get a load of errors where one JSP which is included in another uses variables which are only declared in the major one. Is there a way to compile the .java files the way Tomcat does (which takes account of included .jsp's)? Does ANT create .class files? Thanks in advance. Andoni. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Precompiling JSPs
Have you tried compiling the servlet source files in the work directory? On Wednesday 18 June 2003 05:25 am, Andoni wrote: Hello, I have a build.cmd file that I have had and modified for every project I've done for years. I should probably go learn ANT or some other build technique but for now I want to do this the command line way. I'm not even sure if ANT will do what I want. I want to have my .jsp files made into .java files (easy) then compiled into .class files (hard) before starting my Tomcat. That way I can see any syntax errors in my .jsp files. If I do this at the moment I get a load of errors where one JSP which is included in another uses variables which are only declared in the major one. Is there a way to compile the .java files the way Tomcat does (which takes account of included .jsp's)? Does ANT create .class files? Thanks in advance. Andoni. -- Ben Souther F.W. Davison Company, Inc. REGISTER NOW FOR THE SCORPEO USER CONFERENCE! September 18-19, 2003 in Boston/Brookline, MA Additional Training Sessions held September 17, 2003 More info http://www.fwdco.com/services/Uconf03/default.shtm - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Precompiling JSPs
Andoni, I do this in Sun One Studio, where I do all my Java development. You can compile JSPs just as you can compile java source. Andy -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: 18 June 2003 10:25 To: Tomcat Users List Subject: Precompiling JSPs Hello, I have a build.cmd file that I have had and modified for every project I've done for years. I should probably go learn ANT or some other build technique but for now I want to do this the command line way. I'm not even sure if ANT will do what I want. I want to have my .jsp files made into .java files (easy) then compiled into .class files (hard) before starting my Tomcat. That way I can see any syntax errors in my .jsp files. If I do this at the moment I get a load of errors where one JSP which is included in another uses variables which are only declared in the major one. Is there a way to compile the .java files the way Tomcat does (which takes account of included .jsp's)? Does ANT create .class files? Thanks in advance. Andoni. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Precompiling JSPs
You should read up on the JspC task: http://ant.apache.org/manual/OptionalTasks/jspc.html The JspC task will compile your jsp file to a java servlet (.java) file. Then you can run javac/ to get your class files. You will need to download the jasper-compiler.jar and jasper-runtime.jar files. I currently do this in ant: Here is what my project for compiling my jsps looks like: project name=PW_JSPS default=build basedir=. target name=build property name=JSP_ROOT value=${WEB_MAIN}/src/java/jsp/ property name=JSP2JAVA_DIR value=${WEB_OUT}/jsp2java/ mkdir dir=${JSP2JAVA_DIR}/ echo message=*** / echo message=Building\Compiling JSP files: / echo message=*** / jspc srcdir=${JSP_ROOT} destdir=${JSP2JAVA_DIR} uriroot=${JSP_ROOT} package=com.myproj.web.jsp verbose=9 webinc=${JSP2JAVA_DIR}/generated_webxml_snippet.xml include name=**/*.jsp / classpath id=jsp_classpath pathelement path=${env.CLASSPATH}/ path refid=classpath/ pathelement location=${TOMCAT_SOURCE}common/lib/jasper-compiler.jar/ pathelement location=${TOMCAT_SOURCE}common/lib/jasper-runtime.jar/ /classpath /jspc javac srcdir=${JSP2JAVA_DIR} destdir=${WEB_OUT} includes=**/*.java listfiles=yes debug=${turn_on_debug} classpathref=jsp_classpath / /target /project -Original Message- From: Andy Eastham [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 10:37 AM To: Tomcat Users List Subject: RE: Precompiling JSPs Andoni, I do this in Sun One Studio, where I do all my Java development. You can compile JSPs just as you can compile java source. Andy -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: 18 June 2003 10:25 To: Tomcat Users List Subject: Precompiling JSPs Hello, I have a build.cmd file that I have had and modified for every project I've done for years. I should probably go learn ANT or some other build technique but for now I want to do this the command line way. I'm not even sure if ANT will do what I want. I want to have my .jsp files made into .java files (easy) then compiled into .class files (hard) before starting my Tomcat. That way I can see any syntax errors in my .jsp files. If I do this at the moment I get a load of errors where one JSP which is included in another uses variables which are only declared in the major one. Is there a way to compile the .java files the way Tomcat does (which takes account of included .jsp's)? Does ANT create .class files? Thanks in advance. Andoni. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Precompiling JSPs for Tomcat
On 08-09 15:21, Rossen Raykov wrote: Try something like: property name=build.compiler value=jikes/ path id=compile.classpath pathelement location=${java.home}/jre/lib/rt.jar/ pathelement location=${java.home}/lib/tools.jar/ pathelement location=${tomcat.lib}/jasper-compiler.jar/ pathelement location=${tomcat.lib}/jasper-runtime.jar/ pathelement location=${tomcat.common.lib}/xerces.jar/ pathelement location=${tomcat.common.lib}/servlet.jar/ ... /path !-- store the generated java classes here -- property name=generated.java.classes.dir value=/some/path / !-- generate java classes for you JSPs and mapping web.xml -- java classname=org.apache.jasper.JspC classpath=${compile.classpath} fork=true failonerror=true arg value=-d / arg value=${generated.java.classes.dir} / arg value=-webinc / arg value=/path/to/the/generated/web.xml / arg value=-webapp / arg value=/path/to/you/webapp/dir / jvmarg value=-Djava.endorsed.dirs=${tomcat.home}/bin:${tomcat.home}/common/endorse d / jvmarg value=-Djasper.home=${tomcat.home} / jvmarg value=-Xms194m / jvmarg value=-Xmx194m / /java !-- compile generated java classes and store them in their finall location -- javac srcdir=${generated.java.classes.dir} destdir=/path/to/you/webapp/dir/WEB-INF/classes optimize=off debug=on depend=on classpath=${compile.classpath} includeJavaRuntime=on/ Regards, Rossen Thanks, Rossen. However, I still have two problems when I run the above. 1. The resulting .class file does not have the XXX$jsp.class naming that results from having Tomcat compile it on-the-fly. Thus, Tomcat doesn't use my pre-compiled tax. 2. Also, I'm having trouble with variables being shared across pages, i.e., pages that define a variable, and then use the same variable in an included page. This is valid, but the precompilation bombs on this. TIA, -- Sean LeBlanc - Nutros.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Precompiling JSPs for Tomcat
Hi all, I'm having some issues with using Ant's jspc task (I have a thread going on the Ant mailing list), is there any way to manually call the compilation for Tomcat's build? Somehow, Tomcat must do it, so I figure there has to be a way to kluge something together that does the same thing? -- Sean LeBlanc - Nutros.com Random fortune/quote: The biggest difference between time and space is that you can't reuse time. -- Merrick Furst -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Precompiling JSPs for Tomcat
Try something like: property name=build.compiler value=jikes/ path id=compile.classpath pathelement location=${java.home}/jre/lib/rt.jar/ pathelement location=${java.home}/lib/tools.jar/ pathelement location=${tomcat.lib}/jasper-compiler.jar/ pathelement location=${tomcat.lib}/jasper-runtime.jar/ pathelement location=${tomcat.common.lib}/xerces.jar/ pathelement location=${tomcat.common.lib}/servlet.jar/ ... /path !-- store the generated java classes here -- property name=generated.java.classes.dir value=/some/path / !-- generate java classes for you JSPs and mapping web.xml -- java classname=org.apache.jasper.JspC classpath=${compile.classpath} fork=true failonerror=true arg value=-d / arg value=${generated.java.classes.dir} / arg value=-webinc / arg value=/path/to/the/generated/web.xml / arg value=-webapp / arg value=/path/to/you/webapp/dir / jvmarg value=-Djava.endorsed.dirs=${tomcat.home}/bin:${tomcat.home}/common/endorse d / jvmarg value=-Djasper.home=${tomcat.home} / jvmarg value=-Xms194m / jvmarg value=-Xmx194m / /java !-- compile generated java classes and store them in their finall location -- javac srcdir=${generated.java.classes.dir} destdir=/path/to/you/webapp/dir/WEB-INF/classes optimize=off debug=on depend=on classpath=${compile.classpath} includeJavaRuntime=on/ Regards, Rossen -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Friday, August 09, 2002 2:18 PM To: [EMAIL PROTECTED] Subject: Precompiling JSPs for Tomcat Hi all, I'm having some issues with using Ant's jspc task (I have a thread going on the Ant mailing list), is there any way to manually call the compilation for Tomcat's build? Somehow, Tomcat must do it, so I figure there has to be a way to kluge something together that does the same thing? -- Sean LeBlanc - Nutros.com Random fortune/quote: The biggest difference between time and space is that you can't reuse time. -- Merrick Furst -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
some doubts abt precompiling jsps.
Hai all, As suggested I can precompile the jsps to classes,but the problem is 1)With jspc I am able to parse the jsps to java files.Now I can compile.But tomcat follows its own naming convention when compiling the jsps to classes upon request(if it is not precompiled).Shall I have to follow the conventions in to make tomcat recognize it.But one solution sugested is $./jspc.sh -webxml $TOMCAT_HOME/webapps/urcontext/WEB-INF/web.xml -d $TOMCAT_HOME/webapps/urcontext/WEB-INF/classes -webapp $TOMCAT_HOME/webapps/urcontext/ It parses the jsp files in the context urcontext to java files to my classes folder now I have to compile it. It generates the web.xml file which maps the jsp request to a compile servlet. According to my understanding each web application will have one JSPServlet instance and depending on the request the corresponding pages will be shown as the output stream of JSPServlet.(This is what I infer from the extension mapping in the ROOT web.xml file).If I generate the web.xml which points to each request to each servlet,It will lead to many servlets instanaces instead of one JSPServlet. Any other solution . kamesh jayachandran -- I would suggest you to read through the following book and files: * Kernighan Pike, The Practice of Programming * Documentation/CodingStyle * drivers/net/aironet4500_proc.c and consider, erm, discrepancies. On the second thought, reading KR might also be useful. IOW, no offense, but your C is bad beyond belief. - Al Viro
precompiling jsps
Using Tomcat, is there a way like in RESIN, to precompile all jsps ? Regards, Stephane
Re: precompiling jsps
Check out the jspc.bat file shipped with Tomcat. --- Stéphane_Laurière [EMAIL PROTECTED] wrote: Using Tomcat, is there a way like in RESIN, to precompile all jsps ? Regards, Stephane = Wyn Easton [EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Calendar - Get organized for the holidays! http://calendar.yahoo.com/