• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem deploying servlet

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Here's the deal. Up until recently I've been deploying all my web apps within the tomcat directory structure. I decided it was time for me to experiment and develop an application outside of the tomcat umbrella. So I created a testapp outside of the tomcat directory. It's location:

C:\testapp\

I've got tomcat pointed to the app properly... both stadard JSP and HTML pages wotk fine. The problem I'm having is in accessing local servlets to the application. Here's what I've done so far.

1. I've compiled a servlet... lets call it testservlet.
2. I've placed the testservlet servlet into the WEB-INF\classes directory of the new application. So the path to the servlet, including the servlet name is:

C:\testapp\WEB_INF\classes\testservlet.class


3 I've added the servlet to the web.xml descriptor file for the application:

C:\testapp\WEB_INF\web.xml

with the following servlet entry (as suggested by O'Reilly's Tomcat book)

<servlet>
<servlet-name>testservlet</servlet-name>
<servlet-class>testservlet</servlet-class>
</servlet>

And what I get when I try to access the servlet via a JSP page using the code:

testservlet ts = new testservlet();

I get "testservlet cannot be resolved to a type"

Any suggestions? I know what I'm missing is probably pretty simple but it's driving me nuts. HELP!! ;-)

Dave B
 
Dave Berkheimer
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me clarify things here by saying that what I'm really trying to access is a standard class as opposed to a traditional servlet.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All classes should be in a package other than the default.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you create a servlet-mapping entry?

If so, post it.
Also, post the URL you're using when trying to access your servlet.

If an example app would help, go to http://simple.souther.us and download the SimpleServlet war file.

You can either drop it in the webapps directory and let Tomcat unpack it for you or unpack it with the jar command and put it wherever you like on your file system.
 
reply
    Bookmark Topic Watch Topic
  • New Topic