Solved

Configure Tomcat for JavaBeans & classes

Posted on 2002-07-28
8
718 Views
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.

0
Comment
Question by:robertcarr
  • 4
  • 3
8 Comments
 
LVL 19

Accepted Solution

by:
cheekycj earned 50 total points
Comment Utility
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


CJ
0
 

Author Comment

by:robertcarr
Comment Utility
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!

Rob
0
 

Author Comment

by:robertcarr
Comment Utility
Not quite the answer needed, but was a catalyst to finding a solution.
0
 
LVL 19

Expert Comment

by:cheekycj
Comment Utility
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.

CJ
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 19

Expert Comment

by:cheekycj
Comment Utility
A C?

:-(
0
 

Author Comment

by:robertcarr
Comment Utility
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...
0
 

Author Comment

by:robertcarr
Comment Utility
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.
0
 

Expert Comment

by:Jgould
Comment Utility
don't worry Robert, can happen to all of us read also

http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp

upgraded to A

JGould-EE Moderator
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now