Slashdot Mirror


Taming the Elusive Tomcat

joeyslopp writes: "Finding documentation on an open source project such as FreeBSD is usually quite easy. In fact, the project relies heavily upon user support. However, tracking down a good article that illustrates how to setup a .jsp (java server pages) environment using Tomcat has been difficult. Devshed came close with their article Slapping Together A JSP Development Environment , but lacked specifics on JDK for FreeBSD -- their article was more specific to Linux. The studs in #freebsd on undernet enlightened me a bit more, but still I lacked concrete documenation. Where can one find descriptive help in setting up Tomcat for FreeBSD? Dun dun dun dun *cheesy superhero theme* Enter Victoria Chan's article seemingly tailor-made for my Tomcat woes. The article, also located here, actually appears on www.freebsd.org as well...imagine that :) Hopefully other newbies to FreeBSD will read this and shorten their search time for a good article on the setup of Tomcat."

30 comments

  1. as a official operator of #java on efnet by BoxedFlame · · Score: 0, Flamebait

    I can safely say that you should stay clear of Tomcat and go with a product that is usable in a production environment. The experienced staff of #java recommends resin (www.caucho.com) or orion (www.orionserver.com). For more help, come to #java.

    1. Re:as a official operator of #java on efnet by sinserve · · Score: 1

      As the official operator of #ai, on openprojects,

      I can safely say that you should stay clear of Lisp and go with a product that is usable in a production environment.
      The experienced staff of #ai recommends Trivia, Eggdrop and Capncrunch.

    2. Re:as a official operator of #java on efnet by Raskolnk · · Score: 2, Insightful

      I agree for with the recs for resin and orion, however, I wouldn't stay away from tomcat. IMHO, its very useful for developers to develop in tomcat in diverse environments before moving to a higher performing production environment. That way they can focus on building a proper war format app that should be portable to Resin, Orion, iPlanet, etc. Because Tomcat is supposed to be the reference version, ideally everyone would at least have there app setup and working in it.

      --
      Don't blame me, I get all my opinions from my Ouija board.
    3. Re:as a official operator of #java on efnet by mrdlinux · · Score: 2

      Speaking of which, I find CMU Common Lisp w/IMHO to be a better web application environment than Tomcat or any crappy Java servlet-type thing. And it's easier to setup too, amazingly. I do not know how it would perform under extremely heavy loads though. Perhaps AllegroServe with Allegro CL would be better in that situation.

      --
      Those who do not know the past are doomed to reimplement it, poorly.
    4. Re:as a official operator of #java on efnet by Anonymous Coward · · Score: 0

      Why would cmucl perform poorly? Properly written lisp compiled by cmulisp (or _any_ decent lisp implementation) should be much, much faster than Perl, Python (this is confusing- the cmucl compiler is also called Python), Java, VB, etc. Of course to get that kind of performance you have to make sure that recursive functions are tail recursive, that you use efficient data types (as opposed to using assoc lists where hash tables are called for), and that you specify types. In fact cmucl can give FORTRAN a run for its money doing numerical work. I'm sure you (the OP) know all this, but I think a lot of people aren't aware that lisp can be as efficient as c if it's coded with efficiency in mind. It's just a lot easier to write inefficient lisp than it is to write inefficent c.

      But web apps (that experience heavy load) aren't really about the efficiency of the code. They're about the efficiency of your caching scheme, your load balancing, the amount of thought that goes into your setup (where to cache database results, where to proxy, how to load balance, how to deal with with user tracking when you're load balancing across a number of machines). Highly optimized cmucl apps are likely to be much faster than you need them to be, unless you're doing on demand raytracing over the web. So you should probably not optimize them too heavily and keep some of the nice flexibility of unoptimized lisp :).

      My question is this- given that lisp is a better language for web development than anything commonly used at this point, how can you get people to _consider_ using lisp on the web? It's not even on most web developers' radar. I think a lot of the reasons for it are the same old worse is better reasons (some of which are pretty valid). And (like the other Python's use of significant whitespace) the parentheses don't help :).

    5. Re:as a official operator of #java on efnet by mrdlinux · · Score: 1

      I was actually thinking of some of the issues with CMUCL MP but as you point out, load-balancing would solve that with little trouble.

      I presume one wouldn't write lots of recursive functions when the iterative constructs can be used, either...

      In my own web apps CMUCL's performance was much more than adequate but I'm pretty sure the server never has seen more than moderate usage.

      What's the best way to get people to use CL for this? Use it yourself, and beat them at their own game. Maybe some Lisp-based tools for web developers? Get them out of the pointy-brackets syntax and into S-expressions =)

      I bet CLIM would do pretty well for writing a web-page layout designer, for those who don't write by hand...

      --
      Those who do not know the past are doomed to reimplement it, poorly.
    6. Re:as a official operator of #java on efnet by Anonymous Coward · · Score: 0

      I agree with most of your points, but a couple of things:

      1. There's no reason to avoid recursion _if_ it's convenient to make your functions tail-recursive. Tail-recursive constructs are translated to iterative constructs anyway. (Again, I'm sure you know this, but someone reading this might not).

      2. Again, web app performance is rarely about how cpu intensive your code is. That's why languages like Perl, Python, Java are used for them. Using Apache 1.x with mod_perl, for instance, space is usually more important than time. And no matter what your platform, caching is usually key. Anyway, the point is that Common Lisp is in the performance class of assembler, c, fortran, etc., not that of Perl, Python, Java. Better to have cmucl on one processor than Java on four.

      3. Yes, using it is one important step :). But I think you really hit the nail on the head when you talk about the availability of tools. I'm afraid that CL is dying for a lot of the same reasons that Smalltalk died. What's needed is a good cross-platform CL, released under a BSD style license, with good (cross-platform) built-in libraries and strong third-party tools (like a good servlet engine and templating kit). It seems to me that cmucl would be the best substrate available for something like this. Of course, given the complexity of the implementation (just building cmucl is painful), porting it to non-Unix platforms might be a significant challenge.

      Anyway, I think that it would be nice if the Lisp community took a lesson from the failure of Smalltalk (not technical failure, but market penetration failure) and the success of systems like Java and Perl. Advocacy is crucial (and Paul Graham seems to be the only Lisper doing significant advocacy these days), and an unencumbered cross-platform implementation with significant library support is crucial. I think I may start working on some Common Lisp tools.

    7. Re:as a official operator of #java on efnet by capnjack41 · · Score: 1
      What's the best way to get people to use CL for this? Use it yourself, and beat them at their own game. Maybe some Lisp-based tools for web developers? Get them out of the pointy-brackets syntax and into S-expressions =)

      Couldn't agree more. People just aren't into Lisp anymore. As far as the logic of a program goes, it's so much easier than an imperative language like Java, etc. I'm not familiar with web apps and lisp (I use Scheme, really) - does it play well with databases and such?

      (define (add-stuff-to-shopping-cart new-stuff)
      (cons old-stuff new-stuff) )

      Ok, well that's not technically correct. But it looks easy, right? :)

    8. Re:as a official operator of #java on efnet by Anonymous Coward · · Score: 0

      If you're a Scheme programmer, you'll most likely be surprised at the scope of Clisp, and the various libraries people have created for it.There are a number of database libraries, bindings to X, etc.Cmucl has good facilities for interfacing with foreign libraries too, so you can usually build bindings to anything you need. For server-side work on Unix-like platforms, pretty much everything you _need_ is there, and there are also some nifty add-ons, like IMHO. But you might find yourself rolling your own more often than you would with a more widespread language.

      There are two common approaches to doing server side programming in lisp. One is to use mod_lisp, which is a very simple method for communicating with a lisp process over sockets. The other is to use a lisp webserver for your lisp pages, and proxy from your main server. Cl-http has a lot of features, but the license is a bit ambiguous. There's also Araneida, which has a BSD-like license.

      Check out http://ww.telent.net/cliki/index for more information.

      BTW, did you know that Yahoo Store (originally Viaweb) was written in Clisp?

    9. Re:as a official operator of #java on efnet by mrdlinux · · Score: 1

      Common Lisp doesn't guarentee tail-call elision was my point =) It's just that all good compilers do it.

      Are you aware of SBCL by any chance? It's a fork of CMUCL and while it's still very Unix-bound there's a lot of cleanup going on and development is quite active (so is CMUCL for that matter). Besides that there is OpenMCL, CLISP, and ECL all are being worked on, and even GCL might get its act together someday. You should visit CLiki and cCLan too, or stop by OPN #lisp. There are people out there making efforts, though they may not be as visible as someone like Paul Graham.

      --
      Those who do not know the past are doomed to reimplement it, poorly.
    10. Re:as a official operator of #java on efnet by Anonymous Coward · · Score: 0

      Yes, I know that the spec doesn't guarantee tail-call optimization. If you're writing libraries meant to be portable across _all_ CL implementations you should stay away from recursion unless you _know_ that in a given situation you're not going to recurse deeply enough to blow the stack. But you'll never be able to optimize that kind of code to the hilt anyway- the spec leaves too many things unknown, and many popular CL implementations don't quite conform to the spec anyway.

      If you really need to optimize you're going to have to write to a certain implementation, or possibly a group of implementations. In the extreme case you're going to have to look at what machine code your app is compiling to, and fiddle. So assuming tail-call optimization seems reasonable to me- but then I like recursion.

      I am aware of SBCL, and I particularly like the fact that it's easier to bootstrap than cmucl. I also like the fact that it's released under the MIT license. I know that a lot of work is going into various CL projects, and I didn't mean to sound as if I were belittling that work. It's important. But it's not advocacy, and that's really what I was talking about.

      In the end it's really about priorities- widespread adoption isn't the main priority for a lot of people working on CL. Which is a position I understand, and respect. But for people who do have as a major priority the widespread adoption of CL I think it can't hurt to look at what has worked for languages which have gained a lot of mindshare, and what has happened to some really great languages that have been declining in mindshare- like Smalltalk.

      Of course the best thing that can happen to a language (in terms of popularity) is a wealthy patron that really wants to push it for some reason- like Java. But other languages have managed to do pretty well without that- Python is a good example. And I think the key there is that there aren't a lot of decisions to be made- there is one main Python distribution, it's very cross-platform, it comes with a comprehensive standard library, and it's license is BSD-like. Plus it has pretty loud advocates.

      Of course CL may just be too different from Algol-like languages to ever regain mainstream popularity, so the point may be moot :).

  2. RTFM! by Hard_Code · · Score: 4, Informative

    Christ, they're right here dammit. The docs are great, watchoo talkin' 'bout Willis...

    If that's not enough, go grab the servlet spec from Sun. It's really not that hard.

    --

    It's 10 PM. Do you know if you're un-American?
    1. Re:RTFM! by josepha48 · · Score: 2
      This guy is a moron! I have tomcat running on both my Linux box AND my windows box. All it takes is reading the F****** manual as you say!

      Step 1 get Java 1.3+ (1.4 better)

      Step 2 get apache 1.3+

      Step 3 get tomcat 4.0+ and mod_jk

      Step 4 install all of the above.

      Step 5 Create a workers.properties file.

      Step 6 Create a mod_jk.conf file or let tomcat do it for you. If you let tomcat create one for you copy it and use the copy not the one created as it may overwrite this file. There is a way to shut this on and off, but that is in the manual.

      Step 7 Add a line in apache's httpd.conf file to include the mod_jk.conf file

      Step 8 Edit the mod_jk.conf file to include your new jsp pages directory. This will require you setting up the directive as per apache documentation. Look in http.conf for examples.

      Step 9 add the 'connectors'. There are the JkMount directives.

      Step 10 start it all up and test it out. Pretty much worked for me.

      WEB-INF/classes is where your .class files go and there is a place for glocal jars and global classes as well as private classes and private servlets etc.

      Alternately youy could just get tomcat and java and run it without apache if all you are doing is jsp. It is really not that difficult and there is a whole web site dedicated to this. Its called jakarta.apache.org. try it.

      --

      Only 'flamers' flame!

    2. Re:RTFM! by Anonymous Coward · · Score: 0

      Before you flame a guy for being such a idiot why don't you try and setup the JDK on FreeBSD.

      Trying to get the linux JDK (under linux emulation) or one or the third party JDK's to run without problems is not that easy as double clicking on setup.exe/jkd1_3.rpm.

    3. Re:RTFM! by FortKnox · · Score: 1

      I have to agree. With every environment out for jsp and such, tomcat is a dream to install and get running. If its learning how to write JSPs, the go get the o'reilly book. Sheesh

      --
      Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
  3. Re:RTFM? RTFQ by brenfern · · Score: 1

    The question, though misworded, is about setting up Tomcat on FreeBSD which is nontrivial as the JDK is not 100% complete for this platform. As I understand it, many java applications need modification to get them running properly on FreeBSD, even though they may work perfectly well on Linux, Windows and Solaris.

    Hopefully Sun will start to release official JDK/JREs for this platform very soon.

  4. Hard Times for *BSD by Anonymous Coward · · Score: 0

    Sure, we all know that *BSD is a failure, but why? Why did *BSD fail? Once you get past the fact that *BSD is fragmented between a myriad of incompatible kernels, there is the historical record of failure and of failed operating systems. *BSD experienced moderate success about 15 years ago in academic circles. Since then it has been in steady decline. We all knw *BSD keeps losing market share but why? Is it the problematic personalities of many of the key players? Or is it larger than their troubled personalities?

    The record is clear on one thing: no operating system has ever come back from the grave. Efforts to resuscitate *BSD are one step away from spiritualists wishing to communicate with the dead. As the situation grows more desperate for the adherents of this doomed OS, the sorrow takes hold. An unremitting glom hangs like a death shroud over a once hopeful *BSD community. The hope is gone; a mournful nostalgia has settled in. Now is the end time for *BSD.

  5. Re:*BSD: We Hardly Knew Ye by Anonymous Coward · · Score: 0

    Funny, since Mac OS X is a BSD ;)

    You should group all the OSes you mention under shoddily written, BTW. When will we move beyond them? (Well, we already have, but decided to re-descend into the dark ages for some reason; due to business...politics... who knows. oh well.).

  6. Starting Point by Martin+Spamer · · Score: 3, Informative


    You could using one of the free (as in beer) community editions of the IDE's. CE editions of JBuilder and Forte come pre-configured with TOMCAT.

    1. Re:Starting Point by rjha94 · · Score: 1

      however if you don;t have a > 256 MB RAM machine, don;t try to run tomcat etc automatically when forte starts. I believe default configuration of forte is hugely bloated. a better option would be to use netbeans (netbeans.org) that is much slimmer or turn off those modules from loading that you are not using in forte.

      --
      No .sig
  7. Jakarta by Martin+Spamer · · Score: 3, Informative


    http://jakarta.apache.org/tomcat/

    http://jakarta.apache.org/tomcat/tomcat-3.2-
    do c/index.html
    http://jakarta.apache.org/tomcat/tom cat-3.3-doc/in dex.html

  8. jeez... install the port by Anonymous Coward · · Score: 0

    # cd /usr/ports/www/jakarta-tomcat4

    # make install clean

    After a while it will have done everything for you. I expect that you already have java installed in your machine. If not, then before the above do the following:

    # cd /usr/ports/emulators/linux_base

    # make install clean

    wait for it to finish

    # linux (or, if using the current branch, "kldload linux)

    # cd /usr/ports/java/linux-jdk13

    # make install

    Follow the instructions it provides to download the JDK; once downloaded to the correct location (/usr/ports/distfiles):

    # make install clean

    Now, install tomcat.

    Always use the 4 branch of tomcat; the 3 branch is a piece of shit. 4 actually works well and is stable.

  9. Re:RTFM? RTFQ by josepha48 · · Score: 2
    The question was not about setting up Java but Tomcat. If it was about Java then the person should not have asked "Where can one find descriptive help in setting up Tomcat for FreeBSD?" They should have asked "Where can one find descriptive help in setting up Java for FreeBSD so that they can run Tomcat?"

    The title of the article was about Tomcat NOT Java.

    Give me access to a FreeBSD box and then we'll talk. I only have NetBSD / Linux and Windows at the moment.

    The steps above are generic. They apply to ALL platforms. If there is an inadequate jdk for FreeBSD then that is not my fault. Linux users got togeather at www.blackdown.org to release Java for Linux LONG before Sun supported it. Maybe FreeBSD people who are intereseted in a better port of java to Linux should talk to someone over there and maybe they can make a more generic jdk that will work better on FreeBSD.

    --

    Only 'flamers' flame!

  10. Re:RTFM? RTFQ by josepha48 · · Score: 2

    Oh and I found a JDK for FreeBSD as well as a whole bunch of Java port. I think make install may be what he needs to do. http://www.freebsd.org/cgi/url.cgi?ports/java/jdk1 2-beta/pkg-descr

    --

    Only 'flamers' flame!

  11. man tar? by ahde · · Score: 2

    what else is needed?

    Maybe 'cat README' or 'ls'

  12. Re:RTFM? RTFQ - Learn to read by brenfern · · Score: 1

    Who said that the question was about setting up Java? The issue is that though the JDK is available it is incomplete and there are hence issues running Tomcat.

    Read what you are flaming before you flame!

  13. It's not a question... by CyberDong · · Score: 1
    Who's moderating this?

    These posts are not informative, they're almost all off-topic. The original post is not asking a question, it's pointing out an informative article that explains in detail how to download and compile the JDK (1.3!, not 1.2-beta) and required patches for FreeBSD, and then set up Tomcat to work there.

    That fact that someone was able to download and copy some files on both Linux and Windows is pretty much irrelevant to the spirit of the post (Tomcat/FreeBSD How-To). Labelling such posts as informative when they provide no information that wasn't in Victoria Chan's article seems silly to me.