Configure Tomcat for JavaBeans & classes

Posted on 2002-07-28
Last Modified: 2012-08-14
Developing a web application on Tomcat 4.0 with JSPs in a M-V-C structure, I am using several JavaBeans to encapsulate various data objects, but currently on a very steep learning curve.

The JavaBean (a Java class file) is not currently being recognised by Tomcat.  I have tried to put the files concerned in the <<install>>/common/classes directory and in the application <<appl>>/WEB-INF/classes directory - both with no success.  I have added the correct <Context> object to the <<install>>/conf/server.xml file that points to my application directory.  There seems to be a lot of information about adding servlets to the local <<appl>>/WEB-INF/web.xml file, but does not seem to be an equivalent XML definition for a Java class/bean.

Surely there must be a simple way for Tomcat to recognise Java class files???

Looking forward to any help on this.

Question by:robertcarr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 19

Accepted Solution

cheekycj earned 50 total points
ID: 7184105
Are the class files in a package?

if they are make sure you are putting them in your <<app>>/WEB-INF/classes/package/path/classfile.class


Author Comment

ID: 7184980
Thanks for the suggestion.  I wasn't using a package (the project isn't really that big - yet).  However, got me thinking...

If I imported the .class file :
<%@ page language='java' import=<<JavaBean>> %>
before declaring useBean, it seems to work.

So what I will probably do with the multitude of beans yet to write, is put them all in a package then import it to the JSPs as required.

It's probably a fudge, but it seems to work.  I still can't understand why changing the classpath had no effect. Looking forward to seeing a book that explains the details of Tomcat in simple terms!


Author Comment

ID: 7184982
Not quite the answer needed, but was a catalyst to finding a solution.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 19

Expert Comment

ID: 7185447
changing the classpath is not going to make your JSP/Application see the classes just allow Tomcat's Application Server a path to look for any Java classes that you maybe importing.

LVL 19

Expert Comment

ID: 7185449
A C?


Author Comment

ID: 7187700
Thanks cheekycj - I'm slowly getting there.  Painful but I think I can see the light.  
Anyway next problem is now JDBC.  I think there might be a 100 pointer waiting in the wings, if it hasn't already been asked...

Author Comment

ID: 7232185
Sorry about the C cheekcj.  Only new to the EE, I hadn't quite realised how the grading should work.  Should have been an 'A'.

Sorry for blemishing your previously faultless record.  No idea how to change the grade either.

Expert Comment

ID: 7284274
don't worry Robert, can happen to all of us read also

upgraded to A

JGould-EE Moderator

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Not everyone has adapted to a rapid advancement in technology; there are people who are reluctant or afraid to delve into this brave new world of IT. If you have a friend or a family member who suffers from the so-called technophobia, here is how yo…
A big percent of today’s marketing activity is performed through the online environment. The marketing strategies that have existed a decade ago no longer relate to what’s happening today. We’re currently facing a revolutionary era, called the digit…
In an interesting question ( here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question