LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tomcat5.5 mostly working , slight tweaking needed (https://www.linuxquestions.org/questions/linux-newbie-8/tomcat5-5-mostly-working-slight-tweaking-needed-802179/)

captain_sensible 04-15-2010 08:24 AM

tomcat5.5 mostly working , slight tweaking needed
 
I have a slight problem with my off line tomcat5.5 web development servlet engine .Firstly I must mention that all the jsp files etc that DON'T WORK off line DO WORK on my web site.

tomcat5.5 was installed on "Simply Mepis" a debian based linux system. There is no sudo apt-get install tomcat5.5 in Mepis, so I had to log in as root , and then # apt-get install sun-java5-jdk

# apt-get install tomcat5.5

i think thats part of the problem , tomcat5.5 downloaded as root.


Simple jsp files work, such as those having something like
<jsp:include page="newtop.jsp" />

but jsp files referening a taglib jar file don't work.
such as : <%@ taglib uri="WEB-INF/lib/navtag.jar" prefix="Set" %> on my offline, ( but DO WORK on web site).

I think its either my system can not see the jar files in the lib directory at:

/var/lib/tomcat5.5/webapps/ROOT/WEB-INF/lib or that its a permission thing.
briefly let me expalin the set up:



after installation the default index.jsp was in : var/lib/tomcat5.5/webapps/ROOT

what I did is add my own jsp files ,html ,.css to ROOT folder. I put jar files in WEB-INF/lib . I made ROOT chown -R user
and chmod -R 777 for user , and I simply amended the web.xml inside WEB-INF referencing the taglibs so:

<taglib>
<taglib-uri>/WEB-INF</taglib-uri>
<taglib-location>/WEB-INF/lib/taglib191.tld</taglib-location>
</taglib>

I have used the same web.xml on the web and it works.

as mentioned the only jsp NOT working on my off line tomcat5.5 web devwelopment are referencing a taglib. I think the problem is to do with down loading as root and there is a permission block somewhere. The output i'm getting is:

The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /hotel_link.jsp:20

17: <p>
18: See other reviews:<br />
19: <%@ taglib uri="WEB-INF/lib/navtag.jar" prefix="Set" %>
20: <Set:Navigation separator=" >> ">
21: <Set:link url="/hansonic.jsp" title ="hansonic" />
22: <Set:link url="/esthers_hotel.jsp" title="esthers hotel" />
23: <Set:link url="/big_milly.jsp" title="bigg milly" />


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
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)

root cause

javax.servlet.ServletException: Could not initialize class org.apache.jasper.runtime.BodyContentImpl
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.access$11(PageContextImpl.java:779)
org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:761)
java.security.AccessController.doPrivileged(Native Method)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:759)
org.apache.jsp.hotel_005flink_jsp._jspService(hotel_005flink_jsp.java:112)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)

root cause

java.lang.NoClassDefFoundError: Could not initialize class org.apache.jasper.runtime.BodyContentImpl
org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:705)
org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:695)
org.apache.jsp.hotel_005flink_jsp._jspx_meth_Set_005fNavigation_005f0(hotel_005flink_jsp.java:131)
org.apache.jsp.hotel_005flink_jsp._jspService(hotel_005flink_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5 logs.

any ideas anybody

thecarpy 05-16-2010 11:33 AM

You always install software as root, well, not always. But be it with sudo apt-get or Synaptic, you need to provide the root password, so you are root anyway. This is not the problem, I think.
The important thing, though, is that tomcat is started as the correct user ... how do you start tomcat?

captain_sensible 05-17-2010 10:05 AM

hi

thanks very much for your reply. After the post got fed up with Tomcat5.5, especially after ten minutes trying localhost:8080 instead of :8081 !Tomcat5.5 is the only version via synaptic on Simply Mepis .


Had a go at Tomcat6 install which had previously successfully installed on Jaunty Jackel.

I posted how I did it here : http://mepislovers.org/showthread.php?t=26157

Its not factually correct such as in the web.xml it mentions a wwwboard servlet . It will work for me but not others. It needs cleaning up but would like to put it on my web site with screen shots for other newbies.
You know for someone like me you can achieve a lot with little code. Setting up a simple jsp test environment where yo want to see how one page interacts with another can be quite difficult.

cheers andy brookes
http://www.nkran.net


All times are GMT -5. The time now is 05:22 PM.