Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

accessing my bean class files with jsp in tomcat4.1  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello fellows
I have been battling with making jsp pages access java beans class files with tomcat4.1.
I have a jsp file Useb.jsp which is a form it calls up another jsp file Use.jsp
<%@ page language="java" %>
<jsp:useBean id="BA" scope="session" class="BankAccount1" />
<jsp:setProperty name="BA" property ="sAccountID" param="sAccountID" />
<jsp:setProperty name="BA" property ="sPin" param="sPin" />

<html>
<head>
<title>Result Page</title>
</head>
<body bgcolor="fffffr">
<%
String sAccountID = BA.getsAccountID();
String sPin = BA.getsPin();
boolean validate = BA.AccountValidate();
if(validate == true)
{
out.println("The User Is Validated ");
}
else
{
out.println("The User Is Not Validated");
}
%>
</body>
</html>
which is supposed to call the bean class I hava compiled the bean class and copied the class file to tomcat (in stallation folder and path)C:\Program Files\Apache Group\Tomcat 4.1\webapps\ent1\WEB-INF\classes and the jsp files to C:\Program Files\Apache Group\Tomcat 4.1\webapps\ent1\jsp
but I get this error message when I submit the form in the jsp file tanks

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

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

An error occurred at line: 1 in the jsp file: /jsp/Use.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\ent1\jsp\Use_jsp.java:42: cannot find symbol
symbol : class BankAccount1
location: class org.apache.jsp.Use_jsp
BankAccount1 BA = null;
^



An error occurred at line: 1 in the jsp file: /jsp/Use.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\ent1\jsp\Use_jsp.java:44: cannot find symbol
symbol : class BankAccount1
location: class org.apache.jsp.Use_jsp
BA = (BankAccount1) pageContext.getAttribute("BA", PageContext.SESSION_SCOPE);
^



An error occurred at line: 1 in the jsp file: /jsp/Use.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\ent1\jsp\Use_jsp.java:47: cannot find symbol
symbol : class BankAccount1
location: class org.apache.jsp.Use_jsp
BA = (BankAccount1) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "BankAccount1");
^
3 errors


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:313)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:324)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Thread.java:595)



--------------------------------------------------------------------------------

Apache Tomcat/4.1.12-LE-jdk14
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your beans need to be packaged.
This is due to tightening of standards in j2sdk1.4.1 that doesn't permit the importing of non-packaged classes from packaged classes.
[ April 25, 2005: Message edited by: Ben Souther ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!