(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.
4 comments:
Thanks for the helpful blog.
I'd like to know how you were able to run "sudo apt-get install tomcat5.5" on Ubuntu 6.06.1 LTS when only tomcat5 is available.
Thanks,
Glenn
In my sources.list, actually I used edgy(Ubuntu 6.06) instead of dapper(Ubuntu 6.10).
I cannot remember whether tomcat 5.5 is in dapper repository. If you find that you only get tomcat 5 when using dapper, you can try edgy. Maybe there will be some compatibility issues. But tomcat5.5 works well on my Ubuntu 6.06.
Hope it helps.
Hi,
Thank you for the very helpfull blog. I installed the tomcat server and added the axis2.war file in my webapps folder but I get an error message when I open localhost:8180/axis2.
The message is the following
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/web.xml
org.apache.jasper.compiler.JspConfig.processWebDotXml(JspConfig.java:185)
org.apache.jasper.compiler.JspConfig.init(JspConfig.java:198)
org.apache.jasper.compiler.JspConfig.findJspProperty(JspConfig.java:250)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:113)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
Do you know what this is and how I can solve it??
Thanks!
Jens
It seems that the web.xml is not correctly configured. Have you checked the web.xml?
Gerald
Post a Comment