(1) download and install Sun JDK 1.6
First, you should add "universe" and "multiverse" repositories to your /etc/apt/sources.list file. Then, execute following command:
sudo apt-get install sun-java6-jdkBy default, it will be installed to /usr/lib/jvm/.
sudo update-java-alternatives -l //list all available jre/jdk installations
sudo update-java-alternatives -s java-6-sun //set sun's jdk to be used
sudo update-alternatives --config java
Then a list of available jdk/jre installations is displayed. In my case, it is:
There are 3 alternatives which provide `java'. Selection Alternative ----------------------------------------------- 1 /usr/bin/gij-wrapper-4.1 + 2 /usr/lib/jvm/java-gcj/jre/bin/java * 3 /usr/lib/jvm/java-6-sun/jre/bin/java Press enter to keep the default[*], or type selection number:Then, set environment vaiable. Add following two lines:
JAVA_HOME="/usr/lib/jvm/java-6-sun"
javac -version
java -version
to see whether your configuration works.
Note: here I installed three packages. Tomcat 5.5 contains basic implementation of Servlet and JSP specifications. Tomcat 5.5-admin contains two web-based management interface. Tomcat 5.5-webapps contains documents and some sample web applications.
Set CATALINA_HOME environmen variable. In my case, CATALINA_HOME=/usr/share/tomcat5.5.
The example apps are installed to "/usr/share/tomcat5.5/webapps/".
Global configuration files (server.xml and web.xml) are located in "/etc/tomcat5.5".
To make use of the web-based management tool, you need an account. You can set up your account by modifying file /usr/share/tomcat5.5/conf/tomcat-users.xml. Add the following line:
<user username="username" password="password" roles="manager,admin" />
Then, restart tomcat
sudo /etc/init.d/tomcat5.5 restart
You can visit http://localhost:8180 to check whether your installation succeeds.
Problem:
After installing Tomcat 5.5, I typed http://localhost:8180 to do test. Everything seemed to work well -- management, administration ... However, when I tried the JSP example at http://156.56.104.196:8180/jsp-examples/, error occurred!
Error message is:
HTTP Status 500 -
type Exception
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to load class for JSP org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:147) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:315) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
......
I made sure that all related .jar files were positioned correctly. What was weird was that servlet example could run correctly while JSP example always incurred error. I wrote a simple JSP file:
<% out.println("Hello,world"); %>
After deploying it, I found that it worked!!!
Solution
After search by Google, finally I found this page http://forum.java.sun.com/thread.jspa?threadID=693082&messageID=4028997 which gave solution. The reason is incorrect configuration in Tomcat 5.5 distribution!!! I repeat the solution simply here:
Edit /usr/share/tomcat5.5/webapps/jsp-example/WEB-INF/tagPlugins.xml.
Original one is:
<tag-plugins> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.If</plugin-class> </tag-plugin> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.Choose</plugin-class> </tag-plugin> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.When</plugin-class> </tag-plugin> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.Otherwise</plugin-class> </tag-plugin> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.ForEach</plugin-class> </tag-plugin> </tag-plugins>Note, those orange lines are not correct!! Altered copy is:
<tag-plugins> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.core.If</plugin-class> </tag-plugin> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.core.Choose</plugin-class> </tag-plugin> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.core.When</plugin-class> </tag-plugin> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.core.Otherwise</plugin-class> </tag-plugin> <tag-plugin> <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class> <plugin-class>org.apache.jasper.tagplugins.jstl.core.ForEach</plugin-class> </tag-plugin> </tag-plugins>
I chose to download .war file which would be deployed in tomcat 5.5
Command:
wget http://www.eng.lsu.edu/mirrors/apache/ws/axis2/1_3/axis2-1.3-war.zip
(2) Deploy axis2.
Copy the downloaded axis2.war to /usr/share/tomcat5.5/webapps/. Then restart Tomcat. Tomcat automatically extracts and deploys the .war file.
(3) Test
Go to http://localhost:8180/axis2/. You should see the welcome page of Axis2.
Axis2 provides a user-friendly web-based interface to view all available services, validate the installation, upload new service (actually what are uploaded are .aar files)...
The most important part of Axis2 are those tools under directory bin. These tools include axis2.sh/axis2.bat, axis2server.bat/axis2server.sh, java2wsdl.bat/java2wsdl.sh, wsdl2java.sh/wsdl2.bat. I described usage of these tools in my last post.