the class needs to be compiled into one of 2 places:
webapp specific
WEB-INF/lib/*.jar or WEB-INF/classes
system
$CATALINA_HOME/common/lib
jsp's are compiled to $CATALINA_HOME/work/Container/Host
the jsp is jasper-compiled when first referenced e.g.
http://localhost:8080/webapp/index.jsp
beans should be compiled to /WEB-INF/classes.. here is an example
<-- in jsp form -->
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:bean name="org.apache.struts2.example.counter.SimpleCounter" var="counter">
<s:param name="foo" value="BAR" />
The value of foot is : <s:property value="foo"/>, when inside the bean tag <br
/>
</s:bean>
HTH
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig.
Diese Nachricht dient lediglich dem Austausch von Informationen und
entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten
Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den
Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
interdite. Ce message sert à l'information seulement et n'aura pas n'importe
quel effet légalement obligatoire. Étant donné que les email peuvent facilement
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité
pour le contenu fourni.
> Date: Wed, 24 Jun 2009 22:47:28 +0300
> From: amich...@amichais.net
> To: users@tomcat.apache.org
> Subject: Re: Bizarre NoClassDefFoundError
>
> You can assume it's "placed in a jar file under WEB-INF/lib" :-)
>
>
> The thing is, I have a feeling it has nothing to do with the actual
> class not being found. Because it finds it when another page loads
> first, or when the jsp's generated class file is deleted and recreated,
> and nothing in the class/jar/jsp locations changes in the meanwhile. If
> it really couldn't find it, it wouldn't find it in any of the scenarios
> where it does work, no?
>
>
> Further, if tomcat follows the javadocs for NoClassDefFoundError, it
> means "The searched-for class definition existed when the currently
> executing class was compiled, but the definition can no longer be
> found." So I think it finds it with no problem, compiles the jsp class
> (the index_jsp.class file is indeed created), but then, and only
> sometimes, it goes missing again moments later during runtime.
>
>
> Unfortunately I don't know enough about the tomcat compiling and
> classloading mechanisms to understand what's really going on here...
>
>
> Amichai
>
>
>
> Martin Gainty wrote:
>
> > where is the code web.SessionBean.java compiled to?
> >
> > can we assume you compiled it to
> >
> > /WEB-INF/classes/web/SessionBean.class
> >
> > ?
> > Martin Gainty
> > ______________________________________________
> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de
confidentialité
> >
> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
> > unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig.
> > Diese Nachricht dient lediglich dem Austausch von Informationen und
> > entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten
> > Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den
> > Inhalt uebernehmen.
> > Ce message est confidentiel et peut être privilégié. Si vous
n'êtes pas le destinataire prévu, nous te demandons avec bonté que
pour satisfaire informez l'expéditeur. N'importe quelle diffusion non
autorisée ou la copie de ceci est interdite. Ce message sert à
l'information seulement et n'aura pas n'importe quel effet légalement
obligatoire. Étant donné que les email peuvent facilement être sujets
à la manipulation, nous ne pouvons accepter aucune responsabilité pour
le contenu fourni.
> >
> >
> >
> >
> >
> > > Date: Wed, 24 Jun 2009 22:03:13 +0300
> > > From: amich...@amichais.net
> > > To: users@tomcat.apache.org
> > > Subject: Bizarre NoClassDefFoundError
> > >
> > > Hi everyone!
> > >
> > >
> > > I'm running a stock tomcat 6 (6.0.18-0ubuntu6.1) on kubuntu Jaunty
> > amd64
> > > and Sun JDK (1.6.0_13-b03) , with a website consisting of
several jsps,
> > > some of which make use of a POJO session bean, placed in a jar file
> > > under WEB-INF/lib.
> > >
> > >
> > > I'm encountering a very strange error, in the form of a
> > > NoClassDefFoundError (pasted fully below). Related scenario:
> > >
> > >
> > > 1. It happens only on one of the pages, which happens to be the main
> > > index.jsp.
> > > 2. It happens only when this page is the first to be accessed
after a
> > > restart. If any other page is accessed before it, everything is ok.
> > > 3. After the first error shows up, hitting refresh causes the
error to
> > > repeat, however the stack trace is slightly different: the
"Caused by"
> > > section disappears (and the top part remains the same).
> > > 4. After the error shows up, if the index_jsp.class file under
tomcat's
> > > work directory is deleted and the page refreshed - everything is ok.
> > > 5. It happens consistently after every restart (either reboot, or
> > > /etc/init.d/tomcat6 restart).
> > > 6. It happens consistently also after deleting the entire tomcat
work
> > > folder for this hostname.
> > > 7. Nothing else changes between the tests afaik - jsps,
configuration
> > > etc. remain untouched.
> > >
> > > Any ideas?
> > >
> > >
> > >
> > > The full stacktrace:
> > >
> > >
> > > java.lang.NoClassDefFoundError: web/SessionBean
> > >
> > > at org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
> > > at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> > > at
> > >
> >
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
> > > at
> > >
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
> > > at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > >
> >
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > at
> > >
> >
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > at
> > >
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
> > > at java.security.AccessController.doPrivileged(Native Method)
> > > at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
> > > at
> > >
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
> > > at
> > >
> >
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
> > > at
> > >
> >
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
> > > at
> > >
> >
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
> > > at
> > >
> >
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
> > > at java.security.AccessController.doPrivileged(Native Method)
> > > at
> > >
> >
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
> > > at
> > >
> >
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> > > at
> > >
> >
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> > > at
> > >
> >
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> > > at
> > >
> >
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> > > at
> > >
> >
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
> > > at
> > >
> >
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> > > at
> > >
> >
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> > > at
> > >
> >
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
> > > at
> > >
> >
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> > > at
> > >
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> > > at java.lang.Thread.run(Thread.java:619)
> > > Caused by: java.lang.ClassNotFoundException: web.SessionBean
> > > at
> > >
> >
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
> > > at
> > >
> >
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
> > > at
> > >
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
> > > at
> > >
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
> > > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> > > ... 32 more
> > >
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > > For additional commands, e-mail: users-h...@tomcat.apache.org
> > >
> >
> >
------------------------------------------------------------------------
> > Lauren found her dream laptop. Find the PC that’s right for you.
> > <http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290>
------------------------------------------------------------------------
Microsoft brings you a new way to search the web. Try Bing™ now
<http://www.bing.com?form=MFEHPG&publ=WLHMTAG&crea=TEXT_MFEHPG_Core_tagline_try%20bing_1x1>