Michael, Everything works perfectly fine in your jsp and bean except that the package mentioned in your bean (Beany.java) file seems incorrect: It is:
********** BEANY.JAVA package subapp; It should be: ********** BEANY.JAVA package subclass; Or else an alternative is to change the folder in which the bean is to subapp from subclass to match the package name... Also you do not need to place a web.xml in the WEB-INF folder - I mean its optional since tomcat5.X (maybe earlier - someone please correct if I am wrong).. and if web.xml is not present the defauly web.xml settings will be applied. Hope that helps, Anoop On 5/7/05, Michael Strorm <[EMAIL PROTECTED]> wrote: > > Hi, > > First off, let me apologise for the level of detail in > this message; if possible, I'd have made it shorter. > > Anyway, I'm trying to learn J2EE; Tomcat seemed like a > good choice to learn the underlying technology, rather > than a particular JSP/Servlet container's deployment > tool. I can get 'plain' JSP pages working fine. > > Unfortunately, I'm having major problems developing my > own Javabeans applications for Tomcat; they all fail > as shown below. The demos that come with Tomcat work > fine (although I can't get the demo at > http://jakarta.apache.org/tomcat/tomcat-5.5-doc/appdev/sample > to work; However- that's another story) > > I understand that I should simply be able to drop the > directory structure containing my program into > $CATALINA_HOME/webapps, restart Tomcat (I'm using > 5.5.7) and have it work. > Its contents (root:root ownership, Tomcat running as > root) is:- > skeleton > skeleton/subapp > skeleton/subapp/skeleton.jsp > skeleton/WEB-INF > skeleton/WEB-INF/classes > skeleton/WEB-INF/lib > skeleton/WEB-INF/lib/subapp > skeleton/WEB-INF/lib/subapp/Beany.class > skeleton/WEB-INF/lib/subapp/Beany.java > skeleton/WEB-INF/lib/subapp.jar > skeleton/WEB-INF/web.xml > Contents of files listed at end of message. > > Here's what happens when I try to run it:- > (1) When I try to access > > http://localhost:8080/skeleton/subapp/skeleton.jsp > with the setup as above, I get > HTTP Status 404 - Servlet > org.apache.jsp.subapp.skeleton_jsp > is not available > message Servlet > org.apache.jsp.subapp.skeleton_jsp > is not available > > (2) If I move skeleton/WEB-INF/lib/subapp to > skeleton/WEB-INF/classes/subapp, > I get > HTTP STATUS 500 - EXCEPTION REPORT > The server encountered an internal error () > that prevented it from fulfilling this > request. > EXCEPTION > javax.servlet.ServletException: Wrapper > cannot find servlet class > org.apache.jsp.subapp.skeleton_jsp > or a class it depends on > > org.apache.catalina.valves.ErrorReportValve.invoke > > (ErrorReportValve.java:105) > [... SNIP ...] > java.lang.Thread.run(Thread.java:595) > > ROOT CAUSE > java.lang.ClassNotFoundException: > org.apache.jsp.subapp.skeleton_jsp > > org.apache.catalina.loader.WebappClassLoader.loadClass > > (WebappClassLoader.java:1332) > [... SNIP ...] > java.lang.Thread.run(Thread.java:595) > > (3) If I remove the deployment descriptor altogether, > I get:- > HTTP STATUS 500 - EXCEPTION REPORT > The server encountered an internal error () > that prevented it from fulfilling this > request. > EXCEPTION > org.apache.jasper.JasperException: > /subapp/skeleton.jsp(2,0) The > value for the useBean class attribute > subclass.Beany is invalid. > > org.apache.jasper.compiler.DefaultErrorHandler.jspError( > DefaultErrorHandler.java:39) > [... SNIP > ...] > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > > In short, it fails; in three noticeably different > ways, granted; but it still > fails. What on EARTH am I doing wrong or missing out?! > I'd really appreciate > some feedback on this. Thank you in advance. > > ============================================================ > Here are the files:- > > ********** SKELETON.JSP: > <html> > <jsp:useBean id="beanId" class="subclass.Beany" > scope="session" /> > <head><title>Foo Bar</title></head> > <body> > <h1>Foo Bar</h1> > Duzzy wuzzy was a duck; ducky fuzzy duck a wuzz blah > blah some more yak. > </body> > </html> > ----------------------------------------------------------- > ********** WEB.XML > <?xml version="1.0" encoding="ISO-8859-1"?> > <!-- Copyright 2004 The Apache [SNIP] --> > <web-app xmlns="http://java.sun.com/xml/ns/j2ee" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee > http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" > version="2.4"> > > <display-name>Display Name</display-name> > <description> > Display Description > </description> > > <!-- JSPC servlet mappings start --> > > <servlet> > > <servlet-name>org.apache.jsp.subapp.skeleton_jsp</servlet-name> > > <servlet-class>org.apache.jsp.subapp.skeleton_jsp</servlet-class> > </servlet> > > <servlet-mapping> > > <servlet-name>org.apache.jsp.subapp.skeleton_jsp</servlet-name> > > <url-pattern>/subapp/skeleton.jsp</url-pattern> > </servlet-mapping> > > <!-- JSPC servlet mappings end --> > > ----------------------------------------------------------- > ----------------------------------------------------------- > ********** BEANY.JAVA > package subapp; > > public class Beany > { > private int first; > > /** Public no-args constructor */ > public Beany() > { > first = 404; > } > > public int getFirst() > { > return first; > } > public void setFirst(int first) > { > this.first = first; > } > > public String stringy = "Original Value"; > public String getStringy() > { > return stringy; > } > public void setStringy(String stringy) > { > this.stringy = stringy; > } > } > > -------------------------------------- > The Beany.jar file contains the Beany.java and > Beany.class files > > > ___________________________________________________________ > Too much spam in your inbox? Yahoo! Mail gives you the best spam > protection for FREE! http://uk.mail.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Thanks and best regards, Anoop
