Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
|
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 13th, 2005, 02:04 PM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default tomcat error: using java beans

Hi, Hope you can help, I am trying to reference a java bean from a JSP page that is running on tomcat.

I'm not sure if I have put all the files in the correct directory or if I need to change my classpath in order to compile the java beans/jsp pages.

The java beans have all been added to one package called ceerd1.

Here is the error I get when I try to open the JSP file (index.jsp) on the server:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 31 in the jsp file: /ceerd1/index.jsp

Generated servlet error:
/usr/local/tomcat/work/localhost/_/ceerd1/index$jsp.java:86: Class org.apache.jsp.dynamicResultSet not found.
                dynamicResultSet dynRS = null;
                ^

The source for the java beans is this:

http://www.macs.hw.ac.uk/~ceerd1/dynamicResultSet.java


Here is the opening lines for the JSP file also:
http://www.macs.hw.ac.uk/~ceerd1/index.jsp

{NOTE: THIS IS JUST A TEMP DIRECTORY FOR STORING THE FILES. ITS NOT WHERE ALL THE OTHER FILES FOR THE SITE ARE KEPT}

The directory that the JSP files are put in is:
/tomcat/webapps/ROOT/ceerd1/

the java beans are put in:
/tomcat/webapps/examples/WEB-INF/classes

If you need mmore information about what I've wrote let me know.

Thanks

 
Old February 13th, 2005, 06:04 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I use directories as follows:

JSP including index.jsp :

...\Tomcat 5.0\webapps\myProject

Beans:

...\Tomcat 5.0\webapps\myProject\WEB-INF\classes\params

where params is the name of the package.

You should not need to alter the classpath if you use this structure, it is the default.






 
Old February 14th, 2005, 05:59 AM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried that but it is still producing the same result. I know its a pain to read someone elses code, but could you have a look at the JSP to see if I am referencing the java bean properly?

I was thinking maybe the since the JSP page isnt compiling properly the java bean's class file is missing from the same directory.

Thanks

 
Old February 15th, 2005, 01:30 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your code looks ok to me. I think you need to revert to the default directory structure. You should be able to see if your class compiles by looking to see if the class files are created and added to the folder.

Im pretty sure your error is with the directory as structure as opposed to your code.

 
Old February 15th, 2005, 01:38 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am assuming where you have put NOT NEEDED just for the post, in your application you are specifying the driver, password etc?

 
Old February 15th, 2005, 01:51 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello again!
If you are going to write a lot of classes I would use a compiler. This way you can compile and test your classes independanly of your JSP and be sure they work before referencing them from jsp.

De-bugging of classes is also far easier in a compiler than tomcat.

Net beans is a good downloadable compiler.

A good learning tool/compiler is BlueJ. I still use this a lot as you can test individual class in isolation very easily, assuming you only need to pass primitive data types to it. You can get this at

http://www.bluej.org/download/download.html

 
Old February 15th, 2005, 08:18 PM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks everyone for their advice, i did have the directories set up incorrectly, its running smooth now.

Thanks again :D






Similar Threads
Thread Thread Starter Forum Replies Last Post
Deployment Problem (JSP + Java Beans)!!!! sagar.singh JSP Basics 3 December 7th, 2007 02:03 AM
jsp and sql connectivity using java beans shraddhavs Pro JSP 1 July 16th, 2006 06:29 PM
jsp/java tomcat and mysql harshika JSP Basics 1 August 8th, 2005 03:01 PM
tomcat and java harshika Apache Tomcat 2 July 21st, 2005 03:09 AM
Good Project in JDBC,JSP,Servlets,Java Beans Pooja J2EE 3 August 26th, 2004 08:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.