Re: Shell command to stop and start a webapp without using the manager?
Nikola Milutinovic wrote: [EMAIL PROTECTED] wrote: Hi all, I'd like to know if there's a shell command to stop and start separate web applications. With our configuration, we are unable to use the manager. * We are running Tomcat 5.5 and Apache 2 with the JK Connector (mod_jk) on RedHat Linux. * We have several virtual hosts. When we used 1 service with multiple hosts, we had the problem that our different webapps were sharing the same memory space and they kept stepping on each other. So we split things up. Each host is using a separate service on a different port (see example below). Take a look at Ant Tomcat task. It is used to deploy new webapp from Ant and Ant works from command line. I think this is your best bet. Not to mention that Ant has such a wide variety of other tasks, it is a great boost to your work. You might need to do some other tasks at that time and Ant can help a lot. Of course, if something *is* a job for a shell script, it might be better to do it a s shell script job :-) Ant is also using the manager and Nikola says that they cannot use it for some reason. Nikola, you cannot use the web interface of the manager or you cannot use the manager at all? You can easily write scripts that use wget for example to remotely control Tomcat through the manager (no need to use the web interface in a browser but it has to be accessible). Have a look at: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html#Supported%20Manager%20Commands Marius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where do i place log4j
teknokrat wrote: Normally I place log4j.jar with my webapp. However, I have a number of libraries that need to be shared across various webapps. These need to do logging as well. should i place a version of log4j in shared/lib? Should I still keep the versions in each WEB-INF/lib too? Where do i place the log4j.properties file for the shared libraries? Place it as usual in WEB-INF/classes. It doesn't matter where the library (jar) is loaded from as long as the code is executed by your web app. thanks Marius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple source directories for one webapp
Laurent Brucher wrote: It all depends on what OS and what editor you use. Under Unix using symbolic links could be a solution. I am not familiar with rsync, but you could use a tool like that to keep two folders in sync. It should be possible to setup a process that is watching your working folder and every time a file changes to copy it over to the deployed web app folder. I'm running Windows, so no synlinks. There are sym links under Windows, quite obscure though. Have a look at Junction: http://www.sysinternals.com/Utilities/Junction.html I'm using Eclipse, which is capable of copying files to a given folder, but cannot do that across Eclipse projects, and that's what I need to do. Finally, I'm using tomcat 5.5. I'm not familiar with IDEA, but I'd rather avoid having to actually do something such as pressing a key. I guess I'm looking for a solution that ideally requires as little external tool as possible... One key press per changed file is not a big deal and it gives you control on what/when you deploy. Have you looked into rsync and the like? See Unison: http://www.cis.upenn.edu/~bcpierce/unison/ Also, check the recent "File synchronization software" thread(s) on the VanJUG mailing list: http://lists.openroad.ca/pipermail/vanjug/2005-June/thread.html Thanks for the info anyway, Laurent. Marius I had a similar problem a while back (Windows/IDEA) and I ended up using a plugin that will copy the JSP file to the right location when hitting a special key. I found this plugin to be very effective. Thanks, Laurent. Marius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple source directories for one webapp
Laurent Brucher wrote: Hi all, I guess this is not really new, but I haven't seen any concrete solution nor much discussion about it. So here's the problem: one webapp composed of multiple pieces (jsp, html, css, etc.) located at various locations on the filesystem. I know, this goes against the servlet spec. but I've had a need for this many times by now, especially under development (our projects are broken down into various modules, each contributing to creating a final webapp). For production, an ant task will do the job putting all the pieces correctly together. Under development, I find it unpractical to run an ant task every time a jsp has been modified. We started looking into replacing the resource context with a modified version of the FileDirContext, with good results so far. This modified version acts as a directory mapper and, given a requested resource, provides its correct location on the filesystem. Before continuing further in that direction, I was wondering whether there may be alternatives solutions to the problem, and also what you guys think about all this? It all depends on what OS and what editor you use. Under Unix using symbolic links could be a solution. I am not familiar with rsync, but you could use a tool like that to keep two folders in sync. It should be possible to setup a process that is watching your working folder and every time a file changes to copy it over to the deployed web app folder. I had a similar problem a while back (Windows/IDEA) and I ended up using a plugin that will copy the JSP file to the right location when hitting a special key. I found this plugin to be very effective. Thanks, Laurent. Marius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: shared install under Linux
David Smith wrote: Sounds like you want to setup multiple TC instances. Try using CATALINA_BASE. See this message for more info: http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg151971.html Thanks, this is what I was looking for. --David Marius Marius Scurtescu wrote: Mark wrote: Then in that case, I would make the context writable to all developers, and also make the context reloadable. By making the context reloadable, tomcat will reload any classes/jars that are placed into/or updated in the context. A couple tips would be: 1. If you are building classes into the context/WEB-INF directory, do not perform a "clean" operation, as this could throw tomcat off. 2. I would recommend building jar files, and then place a copy of the jar file into the context. Thanks Mark. This is what I do know (more or less). I was wondering if it is possible to install Tomcat to a common location and then run separate instances (separate server.xml files) with totally separate web apps. You can always install the whole Tomcat in separate folders (for each user) I guess. Marius On 5/26/05, Marius Scurtescu <[EMAIL PROTECTED]> wrote: Mark wrote: Is this for a development environment ? Yes, for development. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: shared install under Linux
Mark wrote: Then in that case, I would make the context writable to all developers, and also make the context reloadable. By making the context reloadable, tomcat will reload any classes/jars that are placed into/or updated in the context. A couple tips would be: 1. If you are building classes into the context/WEB-INF directory, do not perform a "clean" operation, as this could throw tomcat off. 2. I would recommend building jar files, and then place a copy of the jar file into the context. Thanks Mark. This is what I do know (more or less). I was wondering if it is possible to install Tomcat to a common location and then run separate instances (separate server.xml files) with totally separate web apps. You can always install the whole Tomcat in separate folders (for each user) I guess. Marius On 5/26/05, Marius Scurtescu <[EMAIL PROTECTED]> wrote: Mark wrote: Is this for a development environment ? Yes, for development. - 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: shared install under Linux
Mark wrote: Is this for a development environment ? Yes, for development. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
shared install under Linux
Hi, Could anyone share some advice on how to install Tomcat on a Linux box such that it can be shared by several users? I would imagine that you install Tomcat to a system folder like /usr or /opt and then users that want to use Tomcat will have configuration files in their own home folders. Any advice for a typical Linux install in general (folder layout), sharing aside? Thanks, Marius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xhtml and Internet Explorer
I opened an enhancement request for this issue at: http://issues.apache.org/bugzilla/show_bug.cgi?id=24506 Cheers, Marius Marius Scurtescu wrote: Hi, Yes, I totally agree that this issue should be brought up with the JSP specification. I will look into that. Even if the suggestion is accepted it will be quite a while until a specification will deal with this issue and then even longer until there is going to be a Tomcat implementation supporting it. We are talking years I guess :-( For what I know the specification is not saying anything about this issue and if Tomcat is implementing it right now it will not go against the spec. Keeping strictly with the JSP directives (the issue can be extended to the JSP tags as well, but it gets more complicated) common sense is enough, I hope, to realize that whenever you add a directive you really don't want an empty line in your output. These empty lines are annoying at best (every time you check the source of a page generated by JSP you first see an empty page - quite stupid), and breaking your app at worst (like in the case of IE). The absolute best proof that there is a problem here that needs fixing is the fact that developers make their code unreadable just as a work around. Cheers, Marius Rodrigo Ruiz wrote: Marius, I think such a feature request should not be addressed to Tomcat, but to the JSP specification itself. Remember that Tomcat is being used as the reference implementation of servlet/JSP technologies, and so it should stick to the specification. Basically, as I see it, your request means a special treatment for a subset of directives in a few specific cases. I think it would imply that tags could be marked as not generating any output, so when in a single JSP line there were only such marked tags and leading / trailing spaces among them, the line itself could be omited from the output. Such a change should be made from the specification. Regards, Rodrigo Marius Scurtescu wrote: JSP is a templating language which is using a meta language: the JSP constructs. The new line is in the JSP indeed, but is it part of the meta language or part of the literal output? I would argue that these new lines are part of the meta language and that they should not be output. You put them there so the meta language you use is readable. See how FreeMarker, another templating language, is dealing with this issue: http://freemarker.sourceforge.net/docs/dgui_misc_whitespace.html#dgui_misc_whitespace_stripping You are not asking the directive to scan anything, the page compiler could consider white space and newlines after a directive as part of that directive. Marius Adam Hardy wrote: On 10/30/2003 10:08 PM Marius Scurtescu wrote: I will consider implementing a filter to remove the empty lines before the tag. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xhtml and Internet Explorer
Hi, Yes, I totally agree that this issue should be brought up with the JSP specification. I will look into that. Even if the suggestion is accepted it will be quite a while until a specification will deal with this issue and then even longer until there is going to be a Tomcat implementation supporting it. We are talking years I guess :-( For what I know the specification is not saying anything about this issue and if Tomcat is implementing it right now it will not go against the spec. Keeping strictly with the JSP directives (the issue can be extended to the JSP tags as well, but it gets more complicated) common sense is enough, I hope, to realize that whenever you add a directive you really don't want an empty line in your output. These empty lines are annoying at best (every time you check the source of a page generated by JSP you first see an empty page - quite stupid), and breaking your app at worst (like in the case of IE). The absolute best proof that there is a problem here that needs fixing is the fact that developers make their code unreadable just as a work around. Cheers, Marius Rodrigo Ruiz wrote: Marius, I think such a feature request should not be addressed to Tomcat, but to the JSP specification itself. Remember that Tomcat is being used as the reference implementation of servlet/JSP technologies, and so it should stick to the specification. Basically, as I see it, your request means a special treatment for a subset of directives in a few specific cases. I think it would imply that tags could be marked as not generating any output, so when in a single JSP line there were only such marked tags and leading / trailing spaces among them, the line itself could be omited from the output. Such a change should be made from the specification. Regards, Rodrigo Marius Scurtescu wrote: JSP is a templating language which is using a meta language: the JSP constructs. The new line is in the JSP indeed, but is it part of the meta language or part of the literal output? I would argue that these new lines are part of the meta language and that they should not be output. You put them there so the meta language you use is readable. See how FreeMarker, another templating language, is dealing with this issue: http://freemarker.sourceforge.net/docs/dgui_misc_whitespace.html#dgui_misc_whitespace_stripping You are not asking the directive to scan anything, the page compiler could consider white space and newlines after a directive as part of that directive. Marius Adam Hardy wrote: On 10/30/2003 10:08 PM Marius Scurtescu wrote: I will consider implementing a filter to remove the empty lines before the tag. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xhtml and Internet Explorer
JSP is a templating language which is using a meta language: the JSP constructs. The new line is in the JSP indeed, but is it part of the meta language or part of the literal output? I would argue that these new lines are part of the meta language and that they should not be output. You put them there so the meta language you use is readable. See how FreeMarker, another templating language, is dealing with this issue: http://freemarker.sourceforge.net/docs/dgui_misc_whitespace.html#dgui_misc_whitespace_stripping You are not asking the directive to scan anything, the page compiler could consider white space and newlines after a directive as part of that directive. Marius Adam Hardy wrote: On 10/30/2003 10:08 PM Marius Scurtescu wrote: I will consider implementing a filter to remove the empty lines before the tag. For now I eliminated most of the empty lines by changing: <[EMAIL PROTECTED] import="..." %> <[EMAIL PROTECTED] language="Java" %> to: <[EMAIL PROTECTED] import="..." language="Java" %> Ugly, but at least there is one directive per page. It would be great if the JSP compiler would not output new lines for lines containing only JSP directives. I will fill a feature request for this. I doubt you will get far with such a feature request. If you consider what the JSP is doing, you'll see it's only doing it's job. The new line is in the JSP! It's nothing to do with the tag / page directive. Asking the tag or page directive not to output a new line afterwards is like asking it to scan ahead in the JSP to determine what comes next, and if it's a new line, please delete it. Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] CVS question
The keywords you mention are expanded every time you add or commit your file. You do have some control over the expansion, check the cvs documentation, see the -k option. http://www.cvshome.org/docs/manual/cvs-1.11.7/cvs_12.html Marius Yansheng Lin wrote: How do you get something like the following autopopulated by CVS? I don't want to type the date all the time. I don't seem to be able to do this. A! I tried: --- $Header$ $Revision$ $Date$ --- Do you have to set up anything on your cvs server? I am using pserver, would that cause any problem? Sorry for the post, don't know whereelse to post it. Thanks! -Yan * $Header: /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authen ticator/AuthenticatorBase.java,v 1.38 2003/07/18 04:39:31 billbarker Exp $ * $Revision: 1.38 $ * $Date: 2003/07/18 04:39:31 $ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xhtml and Internet Explorer
I will consider implementing a filter to remove the empty lines before the tag. For now I eliminated most of the empty lines by changing: <[EMAIL PROTECTED] import="..." %> <[EMAIL PROTECTED] language="Java" %> to: <[EMAIL PROTECTED] import="..." language="Java" %> Ugly, but at least there is one directive per page. It would be great if the JSP compiler would not output new lines for lines containing only JSP directives. I will fill a feature request for this. I am using IE 6 SP1, so this issue is still not fixed. Microsfot may not even be aware of it. Thanks, Marius Christopher Schultz wrote: Marius, Thanks for all the replies. I did solve the mystery. IE is indeed a POS. I told you :) IE seems to be scanning for the tag (don't ask why) and if it does not find it soon enough then it gives up and treats the file as raw XML. Pretty smart. Now this is sort of a show stopper for me, unless I find a way to reduce the empty lines a the top of a file. Is there a way in Tomcat to prevent the If you have multiple JSP directives at the tops of your pages, consider putting them onto the same line. For example: <[EMAIL PROTECTED] import="..." %> <[EMAIL PROTECTED] language="Java" %> Maybe change this to: <[EMAIL PROTECTED] import="..." %><[EMAIL PROTECTED] language="Java" %> Also note that all of your <[EMAIL PROTECTED] ... %> directives can be put together into one directive, which uses less space. Tomcat really can't be blamed, because you are putting the newlines into the JSP file yourself. The only thing I can think of would be to have Tomcat ignore trailing whitespace on JSP source lines that nothing but a JSP directive or something like ... You other option might be to create a filter that collapsed multiple consecutive newlines into a single one. This might break some of your page, though. A few more observation regarding IE. It seems that once it guessed the type of a page it is caching that info in memory. Even better! What version of IE are you using, BTW? I'm wondering if they've finally fixed this in IE 6.0. I still use 5.5 when I view a site that's so broken in Mozilla that I can't make sense of it (which makes me pretty much furious). -chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xhtml and Internet Explorer
Thanks for all the replies. I did solve the mystery. IE is indeed a POS. It looks like it completely ignores the Content-Type headers and it just scans the beginning of the file. The JSPs I was struggling with are using lots of JSP directives (tag lib and page), includes and tiles. The result was that there were many empty lines after the DOCTYPE declaration and the tag. IE seems to be scanning for the tag (don't ask why) and if it does not find it soon enough then it gives up and treats the file as raw XML. Pretty smart. I attached a test file which on my system is treated as raw XML. If I delete on single empty line before the tag then it is treated as XHTML. Now this is sort of a show stopper for me, unless I find a way to reduce the empty lines a the top of a file. Is there a way in Tomcat to prevent the creation of an empty line for each JSP directive? I cannot move the tag on top since it is generated in a layout file and imported through tiles. A few more observation regarding IE. It seems that one it guessed the type of a page it is caching that info in memory. Deleting temporary files and forcing a check on every visit does not help. You have to close the browser in order to flush this cache. Loading pages from the file system has a completely different logic, it is based on the file extension (there is no scanning for tag). Thanks again, Marius Carlos Pereira wrote: That's because IE ignores the Content-Type header and just looks at the first few bytes of the file to decide how to display it. What a POS. Anyway... (Christopher Schultz) IE works like this: in the first call to a web page, it checks the Content-Type and displays the web page accordingly. Next time you request the same page, it ignores the Content-Type. I know that this issue came up before on this list, but the solution suggested previously (adding a page directive with the content type) does not work. (Marius Scurtescu) So, do the following: 1. You have to make sure IE is foing to display the most recent page. You can do this by either adding a pragma/no-cache header, or go to (in IE): tools/internet options/temporary internet files/settings and, under "check for newer versions of stored pages", select the "every visit to the page" option. When you are developing, this last thing should ALWAYS be done. Otherwise, you might be getting IE cached versions of the web page and asking yourself why the changes aren't working. 2. Force IE to read the Content-Type again. Simply shut down the browser, and request your xhtml page to see if it works. Hope that helps. Carlos Pereira - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
xhtml and Internet Explorer
Hi, I am using Tomcat 4.0.5 with JBoss 3.0.3 under Win2K and I am trying to generate XHTML pages with JSP. Everything is fine with Mozilla, but IE keeps showing the pages as raw XML. I know that this issue came up before on this list, but the solution suggested previously (adding a page directive with the content type) does not work. I checked the headers sent by the server (using LiveHTTPHeaders in Mozilla) and everything seems to be OK. The content type is text/html; charset=UTF-8 The content generated by the JSP page is valid XHTML. I saved it to a file and when loaded from the file system it is rendered properly by IE. Any clues? Thanks, Marius - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]