RE: Precompile jsps into work directory
Never mind. I searched the list again and found the answer. Though I haven't tried it, yet, it looks like with the proper arguments (output directory, package name, etc.) to JSPC, you can manipulate it to compile the jsps to the work directory and not have to insert the servlet definition fragments in web.xml. This seems like a task which should be automated through an option in the JSPC task. Why? Suppose that I have a WAR file which I would like to deploy on multiple application servers. Each app server may have its own jsp compiler. I don't see why I should have to build separate WAR files in order to precompile jsps for each application server. Ideally, I could build one WAR file and then precompile for each application server. Scott From: Scott Goldstein Sent: Thursday, September 29, 2005 8:47 PM To: 'tomcat-user@jakarta.apache.org' Subject: Precompile jsps into work directory I've searched the archives and couldn't find an answer to this question. The Tomcat manual suggests using Jspc to precompile jsps. The method it describes precompiles the jsps and creates stub servlet definitions for each jsp to place within web.xml. Instead of this method, I would like to simply precompile the jsps into the tomcat work directory. I know I can do this by requesting each jsp with the precompile request parameter, but I'd like a command line/Ant method of doing this without having to run the server. Has anyone tried/been successful in doing this? Thanks. Scott
Precompile jsps into work directory
I've searched the archives and couldn't find an answer to this question. The Tomcat manual suggests using Jspc to precompile jsps. The method it describes precompiles the jsps and creates stub servlet definitions for each jsp to place within web.xml. Instead of this method, I would like to simply precompile the jsps into the tomcat work directory. I know I can do this by requesting each jsp with the precompile request parameter, but I'd like a command line/Ant method of doing this without having to run the server. Has anyone tried/been successful in doing this? Thanks. Scott
Re: Class loader looks in Tomcat work directory and not in webapp directory for resources
It is isn't really meant to be part of the classpath, don't put it in WEB-INF/lib. Put it in some other location under WEB-INF. Should work fine. Tomcat extracts resources (in the classpath) to its work directory. I don't entirely know why, but it might be for performance reasons? Anyway, if you are going to overload the purpose of WEB-INF/lib, you are going to have to expect to run into clashes with container (and not just Tomcat, I imagine). Jake Quoting Oliver Kuntze <[EMAIL PROTECTED]>: > > Hi QM, > > thanks a lot for the prompt answer! > > Unfortunately I have to provide some application resources in a JAR. > > I am using hibernate in my persistence layer. I generate my persistent > classes and their O/R mappings directly from the database and deploy that > stuff to my app. If you don't want to specify all hibernate mappings that > hibernate should use one by one you have to provide these mappings in a JAR > and read it into hibernate. In that way I don't have to touch any classes > in my persistence layer. I just tell hibernate "Use whatever mapping you > find in this JAR.". The only thing I have to do when implementing the > persistence layer of a new app is then call the middlegen hibernate plugin > and generate the app specific bos and mappings. The rest is implemented in > framework classes that don't have to be changed. > > I tried to rename the JAR to a ZIP but that does not get accepted and an > exception is thrown. > > Do you have any ideas how to solve this problem? > > Desperately, > > Oliver > > > > > QM@brandxdev.net> To: Tomcat Users List > <[EMAIL PROTECTED]> > cc: > 17.08.2004 22:28 Subject: Re: Class loader > looks in Tomcat work directory and not in webapp directory for > Please respond resources > to "Tomcat Users > List" > > > > > > > On Tue, Aug 17, 2004 at 08:43:54PM +0200, Oliver Kuntze wrote: > : For the second resource lookup (the JAR) the class loader searches in > : "Tomcat 5.0\work\Catalina\localhost\rad_webmodule\loader " (Tomcat's work > : directory) and not in the webapp classpath under "Tomcat 5.0 > : \webapps\rad_webmodule\WEB-INF\classes" (or in the WEB-INF/lib) where the > : JAR is located. Why? > > That just seems to be where Tomcat5 deploys JARs from WAR files... > probably for easy access. > > Is there any reason you're trying to manipulate JARs directly within > your app? If you need to get to a set of files, why not place them > under a directory structure in the classpath? > > -QM > > -- > > software -- http://www.brandxdev.net > tech news -- http://www.RoarNetworX.com > > > - > 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]
RE: Class loader looks in Tomcat work directory and not in webapp directory for resources
Hi, >That just seems to be where Tomcat5 deploys JARs from WAR files... >probably for easy access. The reasons are more complex and with more history than that. There is a long-standing issue (of sorts -- it's not an issue to some people, like me, but others complain persistently ;)) with URLClassLoader locking JARs. One way to avoid locking is to copy the original JAR into a place that's owned by Tomcat, and then lock the copy so users can still modify the original and reload their webapp (at which time another copy operation will be done and so on). This will be modified and improved in Tomcat 5.1 (or 5.5, whatever we decide to call it). So the bottom line is the same as always: stick to the Servlet Specification as tightly as you can, and in this case the Java spec itself regarding resource-loading from JARS in a context-sensitive ClassLoader (admittedly an abstruse area of the JLS), and you will save yourself long-term pain. And thanks to the original poster for also posting his solution. As you said, this will make future archive searches better. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Class loader looks in Tomcat work directory and not in webapp directory for resources
On Wed, Aug 18, 2004 at 01:26:07PM +0200, Oliver Kuntze wrote: : The reason why the ZIP was not found is the ever present JVM problem with : %20 in URLs (as in "Tomcat%205" ;-). Will try URL decoding and if that does : not work rename the tomcat base dir to "Tomcat5.0". Thanks for posting your solution to the list. It will help people searching the archives and spare them lots of headaches. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Class loader looks in Tomcat work directory and not in webapp directory for resources
Found the reason for my problem. You cannot put app resources in a JAR and put it in the webapp class path (the class loaders will not find it there because the class loader in command looks in the tomcat work directory for JARs). The reason why the ZIP was not found is the ever present JVM problem with %20 in URLs (as in "Tomcat%205" ;-). Will try URL decoding and if that does not work rename the tomcat base dir to "Tomcat5.0". So, thanks for trying to help me out anyway! Cheers, Oliver - Forwarded by Oliver Kuntze/PLZ/CSC on 18.08.2004 13:21 - Oliver Kuntze /PLZ/CSC To: "Tomcat Users List" <[EMAIL PROTECTED]> cc: 18.08.2004 09:17 Subject: Re: Class loader looks in Tomcat work directory and not in webapp directory for resources(Document link: Oliver Kuntze) Hi QM, thanks a lot for the prompt answer! Unfortunately I have to provide some application resources in a JAR. I am using hibernate in my persistence layer. I generate my persistent classes and their O/R mappings directly from the database and deploy that stuff to my app. If you don't want to specify all hibernate mappings that hibernate should use one by one you have to provide these mappings in a JAR and read it into hibernate. In that way I don't have to touch any classes in my persistence layer. I just tell hibernate "Use whatever mapping you find in this JAR.". The only thing I have to do when implementing the persistence layer of a new app is then call the middlegen hibernate plugin and generate the app specific bos and mappings. The rest is implemented in framework classes that don't have to be changed. I tried to rename the JAR to a ZIP but that does not get accepted and an exception is thrown. Do you have any ideas how to solve this problem? Desperately, Oliver QM To: Tomcat Users List <[EMAIL PROTECTED]> cc: 17.08.2004 22:28 Subject: Re: Class loader looks in Tomcat work directory and not in webapp directory for Please respond resources to "Tomcat Users List" On Tue, Aug 17, 2004 at 08:43:54PM +0200, Oliver Kuntze wrote: : For the second resource lookup (the JAR) the class loader searches in : "Tomcat 5.0\work\Catalina\localhost\rad_webmodule\loader " (Tomcat's work : directory) and not in the webapp classpath under "Tomcat 5.0 : \webapps\rad_webmodule\WEB-INF\classes" (or in the WEB-INF/lib) where the : JAR is located. Why? That just seems to be where Tomcat5 deploys JARs from WAR files... probably for easy access. Is there any reason you're trying to manipulate JARs directly within your app? If you need to get to a set of files, why not place them under a directory structure in the classpath? -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - 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: Class loader looks in Tomcat work directory and not in webapp directory for resources
Hi QM, thanks a lot for the prompt answer! Unfortunately I have to provide some application resources in a JAR. I am using hibernate in my persistence layer. I generate my persistent classes and their O/R mappings directly from the database and deploy that stuff to my app. If you don't want to specify all hibernate mappings that hibernate should use one by one you have to provide these mappings in a JAR and read it into hibernate. In that way I don't have to touch any classes in my persistence layer. I just tell hibernate "Use whatever mapping you find in this JAR.". The only thing I have to do when implementing the persistence layer of a new app is then call the middlegen hibernate plugin and generate the app specific bos and mappings. The rest is implemented in framework classes that don't have to be changed. I tried to rename the JAR to a ZIP but that does not get accepted and an exception is thrown. Do you have any ideas how to solve this problem? Desperately, Oliver QM To: Tomcat Users List <[EMAIL PROTECTED]> cc: 17.08.2004 22:28 Subject: Re: Class loader looks in Tomcat work directory and not in webapp directory for Please respond resources to "Tomcat Users List" On Tue, Aug 17, 2004 at 08:43:54PM +0200, Oliver Kuntze wrote: : For the second resource lookup (the JAR) the class loader searches in : "Tomcat 5.0\work\Catalina\localhost\rad_webmodule\loader " (Tomcat's work : directory) and not in the webapp classpath under "Tomcat 5.0 : \webapps\rad_webmodule\WEB-INF\classes" (or in the WEB-INF/lib) where the : JAR is located. Why? That just seems to be where Tomcat5 deploys JARs from WAR files... probably for easy access. Is there any reason you're trying to manipulate JARs directly within your app? If you need to get to a set of files, why not place them under a directory structure in the classpath? -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - 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: Class loader looks in Tomcat work directory and not in webapp directory for resources
On Tue, Aug 17, 2004 at 08:43:54PM +0200, Oliver Kuntze wrote: : For the second resource lookup (the JAR) the class loader searches in : "Tomcat 5.0\work\Catalina\localhost\rad_webmodule\loader " (Tomcat's work : directory) and not in the webapp classpath under "Tomcat 5.0 : \webapps\rad_webmodule\WEB-INF\classes" (or in the WEB-INF/lib) where the : JAR is located. Why? That just seems to be where Tomcat5 deploys JARs from WAR files... probably for easy access. Is there any reason you're trying to manipulate JARs directly within your app? If you need to get to a set of files, why not place them under a directory structure in the classpath? -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Class loader looks in Tomcat work directory and not in webapp directory for resources
Hi there, I've got a class loading problem (at least that is my impression) with Tomcat 5 that I did not have with Tomcat 4. I have the following lines of code in my app: "URL hibernateConfigFileURL = this.getClass().getResource("/hibernate.cfg.xml");" and "URL hibernateMappingsURL = this.getClass().getResource("/hibernate-mappings.jar");" (If you change this.getClass().getResource(...) to Thread.currentThread().getContextClassLoader().getResource(...) it does not work either.) For the first resource lookup (the xml file) the class loader correctly searches in "Tomcat 5.0\webapps\rad_webmodule\WEB-INF\classes" and below (The classpath of the webapp). For the second resource lookup (the JAR) the class loader searches in "Tomcat 5.0\work\Catalina\localhost\rad_webmodule\loader " (Tomcat's work directory) and not in the webapp classpath under "Tomcat 5.0 \webapps\rad_webmodule\WEB-INF\classes" (or in the WEB-INF/lib) where the JAR is located. Why? Any help is greatly appreciated! Thanks a lot in advance! Regards, Oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Deleting Work Directory
Hello All, Is there anyway to deleting work directory without stopping tomcat ? Regrads, Burçin _ Bu e-posta mesaji kisiye ozel olup, gizli bilgiler iceriyor olabilir. Eger bu e-posta mesaji size yanlislikla ulasmissa, icerigini hic bir sekilde kullanmayiniz ve ekli dosyalari acmayiniz. Bu durumda lutfen e-posta mesajini kullaniciya hemen geri gonderiniz ve tum kopyalarini mesaj kutunuzdan siliniz. Bu e-posta mesaji, hic bir sekilde, herhangi bir amac icin cogaltilamaz, yayinlanamaz ve para karsiligi satilamaz. Bu e-posta mesaji viruslere karsi anti-virus sistemleri tarafindan taranmistir. Ancak yollayici, bu e-posta mesajinin - virus koruma sistemleri ile kontrol ediliyor olsa bile - virus icermedigini garanti etmez ve meydana gelebilecek zararlardan dogacak hicbir sorumlulugu kabul etmez. This message is intended solely for the use of the individual or entity to whom it is addressed , and may contain confidential information. If you are not the intended recipient of this message or you receive this mail in error, you should refrain from making any use of the contents and from opening any attachment. In that case, please notify the sender immediately and return the message to the sender, then, delete and destroy all copies. This e-mail message, could not be copied, published or sold for any reason. This e-mail message has been swept by anti-virus systems for the presence of computer viruses. In doing so, however, sender cannot warrant that virus or other forms of data corruption may not be present and do not take any responsibility in any occurrence. _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to change to Tomcat work directory
You should be able to set this by modifying your server.xml and all .xml files: Set the "workDir" attribute for your Host (or for the individual Contexts) http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html Set the "directory" sttribute for your Access Log Valve http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/valve.html Set the "directory" sttribute for your File Loggers (you've done this, i think) http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/logger.html If using the Standard Manager for session persistance set the "pathname" attribute http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/manager.html I think if you set the workDir for the Host all nested Elements will use it, but you'll have to check this assumption :) HTH, Jon Anne Durand wrote: Hello I would like to use Tomcat from a CD on Windows. I have changed the logs directory, but Tomcat doesn't start because the working directory is not writable. Is it possible to change it? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to change to Tomcat work directory
Hello I would like to use Tomcat from a CD on Windows. I have changed the logs directory, but Tomcat doesn't start because the working directory is not writable. Is it possible to change it? Thanks
RE: Work Directory in Tomcat
Here is the link to the jasper doc for jsp compilation http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html You will need to modify the checkInterval param in the conf/web.xml file of your tomcat server, it defaults to 300 secs. so tomcat only checks every 5 mins for a new doc for a 30 sec this should work checkInterval 30 However by default 4.1 is set up to check on every file access, you might try forcing this with development true These will work for 4.1, I do not know if 4.0 has similar params but I have noticed that 4.0 does seem slow in recognizing new jsp pages. Most of the apps we support run off of servlet so I have not spent much time tunning the jsp servlet Jeff -Original Message- From: Hari Venkatesan [mailto:[EMAIL PROTECTED]] Sent: Friday, December 20, 2002 1:47 PM To: [EMAIL PROTECTED] Subject: Work Directory in Tomcat Can anybody explain the usage of work Directory in Tomcat. I see that the compiled versions of the JSP's are being stored here. Does the JSP get loaded from here upon actual execution? IF so what happens if there is a change in the JSP. One strange problem is every time I change a JSP, I had to go and remove the JSP classes from the work directory before I could get to see the changed version. Any Ideas? Hari -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
Work Directory in Tomcat
Can anybody explain the usage of work Directory in Tomcat. I see that the compiled versions of the JSP's are being stored here. Does the JSP get loaded from here upon actual execution? IF so what happens if there is a change in the JSP. One strange problem is every time I change a JSP, I had to go and remove the JSP classes from the work directory before I could get to see the changed version. Any Ideas? Hari
Overriding the Tomcat work directory for compiled JSPs
Has anyone successfully overridden the work directory into which Tomcat 4.0.3 writes compiled JSPs? I have found two methods documented, and neither of them works for me. The first is in server.xml: The second is in web.xml: a mapping for the .jps extension in WEBAPP/WEB-INF/web.xml, e.g. jsp org.apache.jasper.servlet.JspServlet scratchdir /mydir/workdir I have tried both of these methods both with absolute pathnames and with paths relative to catalina_home but in all cases JSPs are compiled into the default "work" directory under catalina_home. Am I missing something or do these methods not work in 4.0.3? Many thanks. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
work directory
Hi! Do you know is it possible to change the names of the directories under the work directory? They look like localhost_8080 ant etc. Thank you Michael
mod_jk, $TOMCAT_HOME/work directory and gigantic files
Hello, Today i got a request from one of our developers to install Tomcat or Solaris 7 machine running JDK1.2 and Apache 1.3.19 I compiled and installed mod_jk with no problems and installed binary distribution of Tomcat 3.2.1 But then i found out that for some strange reason it can only process Servlets out of webapps/examples directory, and when i call any .jsp files it sits there and trying to contact the server. At the mean time, while it is making an inpression of contacting the server my $TOMCAT_HOME/work dramatically grows, so in 15 minutes or me clicking the .jsp links it filled up my 580Mb partition.. So, i decided to look into that evil directory and see what is going on there, And what i found in 30Mb plain text file was pretty disturbing: Thousands of these lines: -- snip -- // HTML // begin [file="/a/local/tomcat/webapps/examples/jsp/dates/date.jsp";from=(0,0);to=(6,0)] out.write("\r\n\r\n\r\n"); out.write("\r\n\r\n\r\n"); out.write("\r\n\r\n\r\n"); out.write("\r\n\r\n\r\n"); out.write("\r\n\r\n\r\n"); out.write("\r\n\r\n\r\n"); out.write("\r\n\r\n\r\n"); out.write("\r\n\r\n\r\n"); out.write("\r\n\r\n\r\n"); out.write("\r\n\r\n\r\n"); -- snip -- I am sure that this question popped up on this mailing list more then few times, but i do not seem to be able to find an answerd to it, so i am forced to ask it again. Here is goes: -How do i fix it ?- Please help, I do not want to kill another 8 hour day fighting the software i do not really have an idea about. Sincerely, Igor Pruchanskiy igor (at) linuxinside (dot) com