Hi Nicolas,
what jspc basically needs, is acces to all the internal tomcat libraries,
as you see from the ant script:
${tomcat.home}/bin/*.jar
${tomcat.home}/server/lib/*.jar
${tomcat.home}/common/lib/*.jar
As well as all the libraries from you web application.
So what I did was just "installing" (unzipping) Tomcat on my deployment
machine, just in order to the able to do the precomplation. I think you can
also just download the deployer distribution
(http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi) this
should contain all the stuff you need for the deployment. But I don't have
experience with the deployer application.
Conerning you web application: You need to include all the classes and
libraries in the classpath as well, but it doesn't have to be under
${tomcat.home}/webapps it can be anywhere on your deployment machine.
Maybe what's missing is that you have to include the /WEB-INF/classes
directory too in your ant script.
It's not in mine because I only use jar files in my webapp.
Good luck!
Bernhard
> -----Ursprüngliche Nachricht-----
> Von: Karasek-XID, Nicolas [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 22. Juni 2005 10:26
> An: Tomcat Users List
> Betreff: RE: Use JSPC
>
>
> Hi bernhard,
>
> Just a few dumb questions on this, I still have problem to
> generate servlets source files from jsp.
> From a previous message you sent on this subject in another
> thread I guess I have a classpath problem in my jspc task (
> NullPointerException at
> org.apache.jasper.JspCompilationContext.createCompiler(JspComp
> ilationContext.java:220) with tomcat 5.5.9).
> I think I have the correct values for getting tools.jar and
> jasper jars in jspc.classpath.
> So, should the webapp be placed in tomcat webapps directory
> in order to allow jspc work ? or maybe it doesn't matter ?
> Maybe someone have an idea on what I miss...
>
> --
> Nicolas
>
>
> -----Original Message-----
> From: Bernhard Slominski [mailto:[EMAIL PROTECTED]
> Sent: jeudi 16 juin 2005 11:44
> To: 'Tomcat Users List'
> Subject: AW: Use JSPC
>
> Hi Mino,
>
> just one thing to add to the very good answer from Charl:
> I post you my ant sccript, which does all together precompiling and
> automatic generation of the web.xml file.
> You might take it as a basis for your stuff.
>
> Cheers
>
> Bernhard
>
> <!-- do the precompilation -->
> <target name="jspc" depends="get-properties-stage" >
> <mkdir dir="${webapproot}/src"/>
>
> <!-- define the jasper task -->
> <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="${webapproot}${webappname}/WEB-INF/lib">
> <include name="*.jar"/>
> </fileset>
> </classpath>
> </taskdef>
>
> <!-- execute jasper, creates the servlet source
> files -->
> <jasper2
> validateXml="false"
> uriroot="${webapproot}${webappname}"
>
> webXmlFragment="${webapproot}${webappname}/WEB-INF/generated_web.xml"
> outputDir="${webapproot}/src" />
>
> <!-- compile the source files -->
> <javac
> destdir="${webapproot}${webappname}/WEB-INF/classes"
> optimize="off"
> debug="on" failonerror="false"
> srcdir="${webapproot}/src"
> excludes="**/*.smap">
> <classpath>
> <pathelement
> location="${webapproot}${webappname}/WEB-INF/classes"/>
> <pathelement
> location="${tomcat.home}/common/classes"/>
> <pathelement
> location="${tomcat.home}/shared/classes"/>
> <fileset
> dir="${tomcat.home}/common/lib">
> <include name="*.jar"/>
> </fileset>
> <fileset
> dir="${tomcat.home}/shared/lib">
> <include name="*.jar"/>
> </fileset>
> <fileset dir="${tomcat.home}/bin">
> <include name="*.jar"/>
> </fileset>
> <fileset
> dir="${webapproot}${webappname}/WEB-INF/lib">
> <include name="*.jar"/>
> </fileset>
> </classpath>
> <include name="**" />
> <exclude name="tags/**" />
> </javac>
>
> <!-- Load your precompiled snippet into a property -->
> <loadfile property="precompiled"
>
> srcFile="${webapproot}${webappname}/WEB-INF/generated_web.xml"
> encoding="ISO-8859-1"/>
>
> <!-- Now replace the web.xml with a predifined
> snippet -->
> <replace
> file="${webapproot}${webappname}/WEB-INF/web.xml"
> value="${precompiled}">
> <replacetoken><![CDATA[<!-- precompile include
> -->]]></replacetoken>
> </replace>
> </target>
>
> > -----Ursprüngliche Nachricht-----
> > Von: Charl Gerber [mailto:[EMAIL PROTECTED]
> > Gesendet: Donnerstag, 16. Juni 2005 11:24
> > An: Tomcat Users List
> > Betreff: Re: Use JSPC
> >
> >
> > If you have the generated java files, you can compile
> > them like any other java class (remember to setup your
> > classpath correctly, including some jars in the Tomcat
> > libraries).
> >
> > Trickier to figure out first time round is to
> > dynamically create the web.xml settings. Every .jsp
> > now effectively becomes a servlet which needs to be
> > added to your web.xml. Using ant its all done
> > automatically, but getting it set up first time round
> > can be tricky.
> >
> > Charl
> >
> >
> > --- Giacomino Raccuia <[EMAIL PROTECTED]>
> > wrote:
> >
> > > Hi,
> > > I'd like to compile the JSP pages when I upload some
> > > new files on server
> > > (tomcat 4.0.3) . I use the utility JSPC, but this
> > > generate only java
> > > file but not the class file. I read that JRun has
> > > JSPC with -compile
> > > argument while my JSPC utilty doesn't have thi
> > > argument.
> > > Is possible to generate class file with tomcat and
> > > JSPC? Or there is
> > > another utility to use?
> > >
> > > Thanks in advance.
> > > Bye
> > > Mino
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > 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]
>
>
> ---------------------------------------------------------------------
> 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]