Tomcat 5 on Fedora Core 6: In Five Easy Steps
Have you noticed anything different about this blog in the past 24 hours?
I moved it to my newly upgraded Fedora Core 6 workstation yesterday. And I'm happy to report that setting Tomcat up on a Fedora Core 6 is extremely easy. I'll outline the steps I took to set up a functional Tomcat 5 server:
Install FC6 and Apache Web Server
Stick the Fedora Core 6 DVD in and reboot. Then follow the instructions. I took all defaults where I can, including letting it "delete all Linux partitions" and automatically partition the disk. I choose to install "Web Server" and "Development Tools" when offered the chance. This installs the Apache Web Server 2.2.3 on the box.
Install Tomcat
Tomcat 5 is included in Fedora Core 6, but not installed by default. So I have to bring it in from the repository:
[root@gao]# yum install tomcat5 tomcat5-webapps tomcat5-admin-webapps
This installs Tomcat 5.5.17 and a lot of their dependencies onto the system.
Hook up Tomcat 5 with Apache Web Server
Since I don't want my users to have to type ":8080" all the time, I went ahead and hooked up Tomcat 5 to httpd. In the past, this step had been the most confusing. I remember spending days browsing through Tomcat's website trying to figure out which one of the three alternatives offered there is the one that worked. I still have the mod_jk.so that I compiled from CVS source somewhere on by backup CD-ROMS.
In Fedora Core 6, things are quite straightforward because the version of httpd included contains mod_proxy_ajp which allows httpd to talk to Tomcat 5 through the AJP protocol, which Tomcat 5 listens to on port 8009. To make the connection, I edited /etc/httpd/conf.d/proxy_ajp.conf so that it reads (excluding comments):
[root@gao]# cat /etc/httpd/conf.d/proxy_ajp.conf LoadModule proxy_ajp_module modules/mod_proxy_ajp.so ProxyPass /blog ajp://localhost:8009/blog
Turn on the services
To have httpd and Tomcat 5 start automatically upon reboot, I went to the System->Administration->Services menuitem and enabled both the httpd and tomcat5 services.
Now I have a working Tomcat 5 server. It's webapps directory is at /usr/share/tomcat5/webapps.
Install Sun JDK
So far we have been using the default Java package that came with Fedora Core 6, which is a Free Software implementation of Java based on GNU Gcj, GNU Classpath, and the Eclipse compiler. To run the widest set of Java applications and servlets, I need to install the Sun JDK.
The best way of installing Sun JDK on Fedora Core 6 is to follow the JPackage.org method. I wrote an Introduction to JPackage.org 782 days ago. Things haven't changed much since then (except that now Fedora Core includes a bunch of Java packages, which makes my life easier).
To follow the JPackage.org method, I need to make sure that the following packages are installed:
[root@gao]# yum install jpackage-utils rpm-build libXp unixODBC unixODBC-devel
The first two were already installed when I checked. The others are needed by the JDK.
Then I need to download the JDK (Linux self-extracting file) from Sun's website.
Now we are five command lines away from success:
[root@gao]# rpm -ihv http://mirrors.dotsrc.org/jpackage/5.0/generic/\ non-free/SRPMS/java-1.5.0-sun-1.5.0.10-2jpp.nosrc.rpm [root@gao]# cp jdk-1_5_0_10-linux-i586.bin /usr/src/redhat/SOURCES [root@gao]# rpmbuild -ba /usr/src/redhat/SPECS/java-1.5.0-sun.spec [root@gao]# cd /usr/src/redhat/RPMS/i586 [root@gao]# for x in java-1.5.0-sun-*.rpm; do rpm -ihv $x; done
[Update (Thu Apr 26 06:10:52 CDT 2007)] As Sun makes update releases of the JDK, JPackage.org updates their nosrc.rpm version number that is available from their archive. Since Sun does not cordinate its JDK release with JPackage.org, their will be some lag time before a new nosrc.rpm appears in the JPackage.org archive after each Sun release. As of yesterday, the first two of the above five commands should be updated to
[root@gao]# rpm -ihv http://mirrors.dotsrc.org/jpackage/5.0/generic/\ non-free/SRPMS/java-1.5.0-sun-1.5.0.11-1jpp.nosrc.rpm [root@gao]# cp jdk-1_5_0_11-linux-i586.bin /usr/src/redhat/SOURCES
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
any solution
Mar 21, 2007 4:11:59 AM org.apache.jk.common.MsgAjp processHeader
SEVERE: BAD packet signature 18245
Mar 21, 2007 4:11:59 AM org.apache.jk.common.ChannelSocket processConnection
SEVERE: Error, processing connection
java.lang.IndexOutOfBoundsException at java.io.BufferedInputStream.read(BufferedInputStream.java:306)
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Commented our the JAVA_HOME and JRE_HOME statements previously added to /etc/profile
Rebooted.
- Able to see Tomcat
- Get a 404 for Pebble
/usr/sbin/alternatives --display java is different than previous. It would seem that a number of slave statements have been added for 1.5.0. Also now the current best version has changed to /usr/lib/jvm/jre-1.5.0-sun/bin/java.
Have yet to try /usr/sbin/alternatives --config java
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Check the Apache httpd log files (access.log and error.log in /var/log.httpd) and the Tomcat 5 log files (catalina.log in /var/log/tomcat5) to see if you can get any clue as to what the problem is.
I used "blog" rather than "pebble" when hooking up Apache httpd and Tomcat 5 because when I deployed the Pebble war file I also renamed it:
cp pebble.war /use/share/tomcat5/webapps/blog.war
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
If you think you are frustrated that the thing simply doesn't work, I'm more frustrated that Pebble doesn't work for you and I know very little about what you did and how it doesn't work.
I have prepared a little screencast of my Pebble setup, and you can find it here. Maybe you can spot something that's different between your deployment and mine and figure out what is wrong with your setup.
If you feel it will be of any help to you, you can create a similar screencast (you can do it with istanbul from the Audio and Video Application group in the menu) of your setup and put it on your web server somewhere. I'd be glad to take a look.
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Lights, cameras, blender...
Meanwhile, I was able to install everything quite easily on a WinXP machine, so that I could see what it was like to use Pebble.
It was very easy to install. It was a bit tricky to establish myself as a user with a unique password, rather than entering as username and password.
It has a nice interface and I like the idea of using XML.
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Since you have gotten the more up=to-date nosrc.rpm file, you should download the corresponding jdk-1_5_0_11-linux-i586.bin file from Sun's JDK download page, and copy that file to /usr/src/redhat/SOURCES.
The second command is meant to be run from the directory where the jdk-1_5_0_11-linux-i586.bin file is saved on your hard disk.
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
As I do not use Eclipse on FC6, I cannot diagnose your problem.
From the error message it seems that you need to let your myApp project know where the requested jar files are.
On FC6, the jar files are all installed in /usr/share/java/ or its subdirectories.
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
I did not have to do that. Did you install the Sun JDK the way I outlined (by creating an RPM using the JPackage.org *.nosrc.rpm specification)? If so, when the resulting RPM is installed, the system will automatically update itself into using the Sun JDK for all Java tasks.
You can switch between the two JDK versions (Sun JDK and GCJ) using the alternatives mechanism.
Editing Tomcat's configuration file will only change the JDK that is used by Tomcat. Chances are that your Ant and Eclipse and many other Java applications are still using the GCJ JDK. Tracking down the configuration files for each of them and figuring out how to modify them so that they may pick up the Sun JDK is a rabbit hole that you probably don't want to get into.
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
[root@localhost ~]# rpm -ihv http://mirrors.dotsrc.org/jpackage/5.0/generic/non-free/SRPMS/java-1.6.0-sun-1.6.0.2-1jpp.nosrc.rpm
Retrieving http://mirrors.dotsrc.org/jpackage/5.0/generic/non-free/SRPMS/java-1.6.0-sun-1.6.0.2-1jpp.nosrc.rpm
warning: /var/tmp/rpm-xfer.1EhpXf: Header V3 DSA signature: NOKEY, key ID c431416d
1:java-1.6.0-sun warning: user jacorley does not exist - using root
warning: group jacorley does not exist - using root
warning: user jacorley does not exist - using root
warning: group jacorley does not exist - using root
warning: user jacorley does not exist - using root
warning: group jacorley does not exist - using root
########################################### [100%]
[root@localhost ~]#
Should I have created this jacorley user on my machine?
Anyway, I installed the software directly from SUN and I made the change I described before, and now all my servlets work well.
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
This is what I had done:
[root@localhost ~]# /usr/sbin/alternatives --install /usr/bin/java java \ /opt/SDK/jdk/bin/java 1601 [root@localhost ~]# /usr/sbin/alternatives --config java There are 3 programs which provide 'java'. Selection Command -----------------------------------------------That made it the default JVM for everything but Tomcat5's service on Fedora (unless I started it using the ./startup command.)
1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java * 2 /usr/java/jre1.6.0_01/bin/java + 3 /opt/SDK/jdk/bin/java Enter to keep the current selection[+], or type selection number: 3 [root@localhost ~]#
I had to change Tomcat5's configuration file like this:
[root@localhost ~]# cat /etc/sysconfig/tomcat5 [...] #JAVA_HOME="/usr/lib/jvm/java" JAVA_HOME="/opt/SDK/jdk" [...]If I changed /etc/tomcat5/tomncat5.conf instead that file would be overiden by the settings in /etc/sysconfig/tomcat5, so I had to change this one instead.
Re: Tomcat 5 on Fedora Core 7: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 7: In Five Easy Steps
Do not set JAVA_HOME in your <tt>/etc/profile</tt>. This will mask JDK installation issues. Use the "alternatives" command as indicated in an earlier comment.
As you can see from reading earlier comments on this blog entry, troubleshooting Tomcat problems from a long distance is extremely hard and usually frustrating for both ends. So I wont pretend that I can solve your problem. My suggestion is to check your Tomcat log files to figure out what is going on with your web app.
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
Re: Tomcat 5 on Fedora Core 6: In Five Easy Steps
You can search the JPackage.org mailing list archives for some conversations on this topic. See for example, this thread.
The java-1.6.0-sun-jdbc-1.6.0.3-1jpp.i586.rpm package contains only the Sun OdbcJdbc bridge. The JDBC core is not in this package, but in the main java-1.6.0-sun package. So unless you are running an app that uses the OdbcJdbc bridge, you can safely ignore the java-1.6.0-sun-jdbc package.