Help a Newbie PLZ: Accessing custom classes from servlet

From: Utter Newbie (dabba_at_yabbahey.com)
Date: 12/22/03


Date: Mon, 22 Dec 2003 10:57:44 -0700

I starting to learn about servlets (Book: Java for the web) and have
been using Resin as a servlet container. I'm trying to access a class
(StringUtil) from a servlet called Page2Servlet (which is compiled
successfully). StringUtil includes the:

package com.brainysoftware.java;

statement.

I'm using this import statement in Page2Servlet and it compiled
successfully:
import com.brainysoftware.java.StringUtil;

The class StringUtil is located under:

myApp\WEB-INF\classes\com\brainysoftware\java

All servlets are located in the classes directory.

Resin-3.0.4 is giving me the following error when I try to post from a
Servlet Page1Servlet to Page2Servlet:

500 Servlet Exception
java.lang.NoClassDefFoundError: com/brainysoftware/java/StringUtil
(wrong name: StringUtil)

Have I put the class in the wrong place? Should I include something in
myApp's web.xml file for the servlets to access the StringUtil class?
All I have now is some servlet definitions and:

 <servlet-mapping>
    <url-pattern>/servlet/*</url-pattern>
    <servlet-name>invoker</servlet-name>
  </servlet-mapping>
    <servlet-mapping>
    <url-pattern>/serv/*</url-pattern>
    <servlet-name>invoker</servlet-name>
  </servlet-mapping>

Everything else is the defaults for Resin...

I thought Resin would pick the class up automagically but no luck.

I find the most frustrating part of learning servlets is the
configuration, not the actual coding... Sigh... Any help appreciated.