problem deploying jsps with tomcat

R

Ryan

The only java beans I can get to work are the ones that come in the example
directory.

I made a simple jsp and put it in the 'cal' package under the examples
directory. It works fine if use the TableBean that comes with tomcat as
follows:

<jsp:useBean id="table" scope="session" class="cal.TableBean" />

If I save TableBean as TableBean2.java and I only change the class name and
the constructor to TableBean2 and recompile, I then use the following to
call it in my jsp

<jsp:useBean id="table" scope="session" class="cal.TableBean2" />

I get the following set of errors: I get these errors everywhere I use a
bean I create. I do not get errors when I use the default beans. Is there a
configuration parameter i need to set? I don't see it in any books.

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

An error occurred at line: 13 in the jsp file: /jsp/cal/hw6.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\Tomcat_new\work\Standalone\localhost\examples\jsp\cal\hw6_jsp.java:63:
cannot resolve symbol
symbol : class TableBean2
location: package cal
cal.TableBean2 table = null;
^



An error occurred at line: 13 in the jsp file: /jsp/cal/hw6.jsp

Generated servlet error:
C:\Tomcat_new\work\Standalone\localhost\examples\jsp\cal\hw6_jsp.java:65:
cannot resolve symbol
symbol : class TableBean2
location: package cal
table = (cal.TableBean2) pageContext.getAttribute("table",
PageContext.SESSION_SCOPE);
^



An error occurred at line: 13 in the jsp file: /jsp/cal/hw6.jsp

Generated servlet error:
C:\Tomcat_new\work\Standalone\localhost\examples\jsp\cal\hw6_jsp.java:68:
cannot resolve symbol
symbol : class TableBean2
location: package cal
table = (cal.TableBean2)
java.beans.Beans.instantiate(this.getClass().getClassLoader(),
"cal.TableBean2");
^
3 errors
 
F

fanfaron

I think you got a tomcat configuration error

I ran into a problem similar to this, what I did wrong is that my
tomcat is run by a JVM older than java Compiler that I used.

What I would do, is install java and tomcat from scratch and try it
again.

hope this help
 
S

Sudsy

Ryan said:
The only java beans I can get to work are the ones that come in the example
directory.

I made a simple jsp and put it in the 'cal' package under the examples
directory. It works fine if use the TableBean that comes with tomcat as
follows:

<jsp:useBean id="table" scope="session" class="cal.TableBean" />

If I save TableBean as TableBean2.java and I only change the class name and
the constructor to TableBean2 and recompile, I then use the following to
call it in my jsp
<snip>

So how, precisely, did you compile it? If I was in the cal subdirectory
then I would issue the following command:

javac -d .. TableBean2.java
 
J

Jj

looks like the compiled class file is not in the right classpath. please
make sure that you have the TableBean2.class somewhere in the classpath as
"cal/TableBean2.class". Or you can put the class in a jar file and put the
jar file in the class path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top