You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Ramakant V. Kulkarni" <rk...@cisco.com> on 2001/10/05 00:54:58 UTC

Problem getting the Struts example to work on Tomcat

Hi,

I am new to Struts and am having a hard time getting the Struts Example
to work on my Tomcat 3.2.1

I have dumped the trace of the error below. I would really appreciate if
you can help me out with this. Thanks in advance.

New org.apache.struts.webapp.example.User
Begin event threw exception
java.lang.ClassNotFoundException: org.apache.struts.webapp.example.User
        java.lang.Class
java.net.URLClassLoader.findClass(java.lang.String)
        java.lang.Class
java.lang.ClassLoader.loadClass(java.lang.String, boolea
n)
        java.lang.Class
sun.misc.Launcher$AppClassLoader.loadClass(java.lang.Str
ing, boolean)
        java.lang.Class
java.lang.ClassLoader.loadClass(java.lang.String)
        void
org.apache.commons.digester.ObjectCreateRule.begin(org.xml.sax.Attr
ibutes)
        void
org.apache.commons.digester.Digester.startElement(java.lang.String,
 java.lang.String, java.lang.String, org.xml.sax.Attributes)
        void
org.apache.xerces.parsers.SAXParser.startElement(org.apache.xerces.
utils.QName, org.apache.xerces.framework.XMLAttrList, int)
        void
org.apache.xerces.validators.common.XMLValidator.callStartElement(o
rg.apache.xerces.utils.QName)
        boolean
org.apache.xerces.framework.XMLDocumentScanner.scanElement(org.a
pache.xerces.utils.QName)
        boolean
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher
.dispatch(boolean)
        boolean
org.apache.xerces.framework.XMLDocumentScanner.parseSome(boolean
)
        void
org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource
)
        java.lang.Object
org.apache.commons.digester.Digester.parse(java.io.Inpu
tStream)
        void org.apache.struts.webapp.example.DatabaseServlet.load()
        void org.apache.struts.webapp.example.DatabaseServlet.init()
        void
javax.servlet.GenericServlet.init(javax.servlet.ServletConfig)
        void org.apache.tomcat.core.ServletWrapper.doInit()
        void org.apache.tomcat.core.Handler.init()
        void org.apache.tomcat.core.ServletWrapper.init()
        void
org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(org.
apache.tomcat.core.Context)
        void
org.apache.tomcat.core.ContextManager.initContext(org.apache.tomcat
.core.Context)
        void org.apache.tomcat.core.ContextManager.init()
        void
org.apache.tomcat.startup.Tomcat.execute(java.lang.String[])
        void org.apache.tomcat.startup.Tomcat.main(java.lang.String[])
cannot load servlet name: database

Regards,
RK


Re: Problem getting the Struts example to work on Tomcat

Posted by Ajay Chitre <aj...@diligentteam.com>.
I am assuming you are starting Tomcat using \bin\startup.bat.  Right?  This
should set the classpath properly.  I wonder why you are having ClassNotFound
problem because this User.class does exist in the og\apache\struts\webapp\example
package.

Worse comes to worst, you can explode the war file and put web-inf\classes
in your classpath.

Also if time permits try using Tomcat 3.2.3.

Good luck.  Let me know how it goes!

-- Original Message --

>Hi Ajay,
>
>Thanks a lot for your interest in helping me out.
>
>I did more or less the same things that you mentioned in your mail. I had
>not
>added the <context ...
>to the server.xml file as I thought that the tomcat will do it itself.
This
>morning after going through your mail, I did
>add the <context .. to my server.xml file but the problem still persists.
>
>I am using the Tomcat3.2.1 with Xerces1.4.3 XML parser.
>
>Initially when I was using JAXP, it was giving some wierd errors and then
>when I
>moved to Xerces it started giving me this problem. Is there anything that
>I need
>to change in the struts-config.xml file of my struts-example?
>
>Looking forward for some more helpful suggestions from you.
>
>Thanks in advance.
>
>Regards,
>RK
>
>Ajay Chitre wrote:
>
>> Ramakant,
>>
>> I am not exactly sure when you're getting this message.  I am using Tomcat
>> 3.2.3 and this is what I did.
>>
>> 1)  Copied the struts-example.war file to C:\jakarta-tomcat-3.2.3\webapps
>> folder.
>>
>> 2)  In C:\jakarta-tomcat-3.2.3\conf\server.xml, I added the following
lines;
>>
>>         <Context path="/ex"
>>                  docBase="webapps/struts-example"
>>                  crossContext="false"
>>                  debug="0"
>>                  reloadable="true" >
>>         </Context>
>>
>> 3)  Started Tomcat and typed :  http://localhost:8080/ex
>>
>> This works for me.  Looks like you're having some classpath related problems.
>>  May be if you give me more info I can help.  Thanks.
>>
>> -- Original Message --
>>
>> >Hi,
>> >
>> >I am new to Struts and am having a hard time getting the Struts Example
>> >to work on my Tomcat 3.2.1
>> >
>> >I have dumped the trace of the error below. I would really appreciate
>if
>> >you can help me out with this. Thanks in advance.
>> >
>> >New org.apache.struts.webapp.example.User
>> >Begin event threw exception
>> >java.lang.ClassNotFoundException: org.apache.struts.webapp.example.User
>> >        java.lang.Class
>> >java.net.URLClassLoader.findClass(java.lang.String)
>> >        java.lang.Class
>> >java.lang.ClassLoader.loadClass(java.lang.String, boolea
>> >n)
>> >        java.lang.Class
>> >sun.misc.Launcher$AppClassLoader.loadClass(java.lang.Str
>> >ing, boolean)
>> >        java.lang.Class
>> >java.lang.ClassLoader.loadClass(java.lang.String)
>> >        void
>> >org.apache.commons.digester.ObjectCreateRule.begin(org.xml.sax.Attr
>> >ibutes)
>> >        void
>> >org.apache.commons.digester.Digester.startElement(java.lang.String,
>> > java.lang.String, java.lang.String, org.xml.sax.Attributes)
>> >        void
>> >org.apache.xerces.parsers.SAXParser.startElement(org.apache.xerces.
>> >utils.QName, org.apache.xerces.framework.XMLAttrList, int)
>> >        void
>> >org.apache.xerces.validators.common.XMLValidator.callStartElement(o
>> >rg.apache.xerces.utils.QName)
>> >        boolean
>> >org.apache.xerces.framework.XMLDocumentScanner.scanElement(org.a
>> >pache.xerces.utils.QName)
>> >        boolean
>> >org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher
>> >.dispatch(boolean)
>> >        boolean
>> >org.apache.xerces.framework.XMLDocumentScanner.parseSome(boolean
>> >)
>> >        void
>> >org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource
>> >)
>> >        java.lang.Object
>> >org.apache.commons.digester.Digester.parse(java.io.Inpu
>> >tStream)
>> >        void org.apache.struts.webapp.example.DatabaseServlet.load()
>> >        void org.apache.struts.webapp.example.DatabaseServlet.init()
>> >        void
>> >javax.servlet.GenericServlet.init(javax.servlet.ServletConfig)
>> >        void org.apache.tomcat.core.ServletWrapper.doInit()
>> >        void org.apache.tomcat.core.Handler.init()
>> >        void org.apache.tomcat.core.ServletWrapper.init()
>> >        void
>> >org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(org.
>> >apache.tomcat.core.Context)
>> >        void
>> >org.apache.tomcat.core.ContextManager.initContext(org.apache.tomcat
>> >.core.Context)
>> >        void org.apache.tomcat.core.ContextManager.init()
>> >        void
>> >org.apache.tomcat.startup.Tomcat.execute(java.lang.String[])
>> >        void org.apache.tomcat.startup.Tomcat.main(java.lang.String[])
>> >cannot load servlet name: database
>> >
>> >Regards,
>> >RK
>> >
>> >
>>
>> Ajay Chitre
>>
>> Diligent Team, Inc.
>> (Where Diligent People Work as a Team)
>>
>> http://www.DiligentTeam.com
>
>

Ajay Chitre

Diligent Team, Inc.
(Where Diligent People Work as a Team)

http://www.DiligentTeam.com



Re: Problem getting the Struts example to work on Tomcat

Posted by Ramakant Kulkarni <rk...@cisco.com>.
Hi Ajay,

Thanks a lot for your interest in helping me out.

I did more or less the same things that you mentioned in your mail. I had not
added the <context ...
to the server.xml file as I thought that the tomcat will do it itself. This
morning after going through your mail, I did
add the <context .. to my server.xml file but the problem still persists.

I am using the Tomcat3.2.1 with Xerces1.4.3 XML parser.

Initially when I was using JAXP, it was giving some wierd errors and then when I
moved to Xerces it started giving me this problem. Is there anything that I need
to change in the struts-config.xml file of my struts-example?

Looking forward for some more helpful suggestions from you.

Thanks in advance.

Regards,
RK

Ajay Chitre wrote:

> Ramakant,
>
> I am not exactly sure when you're getting this message.  I am using Tomcat
> 3.2.3 and this is what I did.
>
> 1)  Copied the struts-example.war file to C:\jakarta-tomcat-3.2.3\webapps
> folder.
>
> 2)  In C:\jakarta-tomcat-3.2.3\conf\server.xml, I added the following lines;
>
>         <Context path="/ex"
>                  docBase="webapps/struts-example"
>                  crossContext="false"
>                  debug="0"
>                  reloadable="true" >
>         </Context>
>
> 3)  Started Tomcat and typed :  http://localhost:8080/ex
>
> This works for me.  Looks like you're having some classpath related problems.
>  May be if you give me more info I can help.  Thanks.
>
> -- Original Message --
>
> >Hi,
> >
> >I am new to Struts and am having a hard time getting the Struts Example
> >to work on my Tomcat 3.2.1
> >
> >I have dumped the trace of the error below. I would really appreciate if
> >you can help me out with this. Thanks in advance.
> >
> >New org.apache.struts.webapp.example.User
> >Begin event threw exception
> >java.lang.ClassNotFoundException: org.apache.struts.webapp.example.User
> >        java.lang.Class
> >java.net.URLClassLoader.findClass(java.lang.String)
> >        java.lang.Class
> >java.lang.ClassLoader.loadClass(java.lang.String, boolea
> >n)
> >        java.lang.Class
> >sun.misc.Launcher$AppClassLoader.loadClass(java.lang.Str
> >ing, boolean)
> >        java.lang.Class
> >java.lang.ClassLoader.loadClass(java.lang.String)
> >        void
> >org.apache.commons.digester.ObjectCreateRule.begin(org.xml.sax.Attr
> >ibutes)
> >        void
> >org.apache.commons.digester.Digester.startElement(java.lang.String,
> > java.lang.String, java.lang.String, org.xml.sax.Attributes)
> >        void
> >org.apache.xerces.parsers.SAXParser.startElement(org.apache.xerces.
> >utils.QName, org.apache.xerces.framework.XMLAttrList, int)
> >        void
> >org.apache.xerces.validators.common.XMLValidator.callStartElement(o
> >rg.apache.xerces.utils.QName)
> >        boolean
> >org.apache.xerces.framework.XMLDocumentScanner.scanElement(org.a
> >pache.xerces.utils.QName)
> >        boolean
> >org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher
> >.dispatch(boolean)
> >        boolean
> >org.apache.xerces.framework.XMLDocumentScanner.parseSome(boolean
> >)
> >        void
> >org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource
> >)
> >        java.lang.Object
> >org.apache.commons.digester.Digester.parse(java.io.Inpu
> >tStream)
> >        void org.apache.struts.webapp.example.DatabaseServlet.load()
> >        void org.apache.struts.webapp.example.DatabaseServlet.init()
> >        void
> >javax.servlet.GenericServlet.init(javax.servlet.ServletConfig)
> >        void org.apache.tomcat.core.ServletWrapper.doInit()
> >        void org.apache.tomcat.core.Handler.init()
> >        void org.apache.tomcat.core.ServletWrapper.init()
> >        void
> >org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(org.
> >apache.tomcat.core.Context)
> >        void
> >org.apache.tomcat.core.ContextManager.initContext(org.apache.tomcat
> >.core.Context)
> >        void org.apache.tomcat.core.ContextManager.init()
> >        void
> >org.apache.tomcat.startup.Tomcat.execute(java.lang.String[])
> >        void org.apache.tomcat.startup.Tomcat.main(java.lang.String[])
> >cannot load servlet name: database
> >
> >Regards,
> >RK
> >
> >
>
> Ajay Chitre
>
> Diligent Team, Inc.
> (Where Diligent People Work as a Team)
>
> http://www.DiligentTeam.com


RE: Problem getting the Struts example to work on Tomcat

Posted by Ajay Chitre <aj...@diligentteam.com>.
Ramakant,

I am not exactly sure when you're getting this message.  I am using Tomcat
3.2.3 and this is what I did.

1)  Copied the struts-example.war file to C:\jakarta-tomcat-3.2.3\webapps
folder.

2)  In C:\jakarta-tomcat-3.2.3\conf\server.xml, I added the following lines;

        <Context path="/ex" 
                 docBase="webapps/struts-example" 
                 crossContext="false"
                 debug="0" 
                 reloadable="true" > 
        </Context>

3)  Started Tomcat and typed :  http://localhost:8080/ex

This works for me.  Looks like you're having some classpath related problems.
 May be if you give me more info I can help.  Thanks.



-- Original Message --

>Hi,
>
>I am new to Struts and am having a hard time getting the Struts Example
>to work on my Tomcat 3.2.1
>
>I have dumped the trace of the error below. I would really appreciate if
>you can help me out with this. Thanks in advance.
>
>New org.apache.struts.webapp.example.User
>Begin event threw exception
>java.lang.ClassNotFoundException: org.apache.struts.webapp.example.User
>        java.lang.Class
>java.net.URLClassLoader.findClass(java.lang.String)
>        java.lang.Class
>java.lang.ClassLoader.loadClass(java.lang.String, boolea
>n)
>        java.lang.Class
>sun.misc.Launcher$AppClassLoader.loadClass(java.lang.Str
>ing, boolean)
>        java.lang.Class
>java.lang.ClassLoader.loadClass(java.lang.String)
>        void
>org.apache.commons.digester.ObjectCreateRule.begin(org.xml.sax.Attr
>ibutes)
>        void
>org.apache.commons.digester.Digester.startElement(java.lang.String,
> java.lang.String, java.lang.String, org.xml.sax.Attributes)
>        void
>org.apache.xerces.parsers.SAXParser.startElement(org.apache.xerces.
>utils.QName, org.apache.xerces.framework.XMLAttrList, int)
>        void
>org.apache.xerces.validators.common.XMLValidator.callStartElement(o
>rg.apache.xerces.utils.QName)
>        boolean
>org.apache.xerces.framework.XMLDocumentScanner.scanElement(org.a
>pache.xerces.utils.QName)
>        boolean
>org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher
>.dispatch(boolean)
>        boolean
>org.apache.xerces.framework.XMLDocumentScanner.parseSome(boolean
>)
>        void
>org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource
>)
>        java.lang.Object
>org.apache.commons.digester.Digester.parse(java.io.Inpu
>tStream)
>        void org.apache.struts.webapp.example.DatabaseServlet.load()
>        void org.apache.struts.webapp.example.DatabaseServlet.init()
>        void
>javax.servlet.GenericServlet.init(javax.servlet.ServletConfig)
>        void org.apache.tomcat.core.ServletWrapper.doInit()
>        void org.apache.tomcat.core.Handler.init()
>        void org.apache.tomcat.core.ServletWrapper.init()
>        void
>org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(org.
>apache.tomcat.core.Context)
>        void
>org.apache.tomcat.core.ContextManager.initContext(org.apache.tomcat
>.core.Context)
>        void org.apache.tomcat.core.ContextManager.init()
>        void
>org.apache.tomcat.startup.Tomcat.execute(java.lang.String[])
>        void org.apache.tomcat.startup.Tomcat.main(java.lang.String[])
>cannot load servlet name: database
>
>Regards,
>RK
>
>



Ajay Chitre

Diligent Team, Inc.
(Where Diligent People Work as a Team)

http://www.DiligentTeam.com