• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compiling problem :-( Help!

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there guys,
I'm trying to run some JSPs here and it's creating a problem. I'm using Tomcat 4.1.12 as my server.
There is an application which starts by calling the file mail.jsp. This file links to a class file WebMailBean.class. I've placed the class file in the directory:
TOMCAT_HOME\webapps\WebMail\classes
This is the error I'm getting when I call mail.jsp in IE. There are many more occurances of the error, but I've just shown the first two. I think it's not finding my class file or something:

----------------------------------
An error occurred at line: 2 in the jsp file: /mail.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\Tomcat4.1\work\Standalone\localhost\WebMail\mail_jsp.java:42: cannot resolve symbol
symbol : class WebMailBean
location: class org.apache.jsp.mail_jsp
WebMailBean webMail = null;
^
An error occurred at line: 2 in the jsp file: /mail.jsp
Generated servlet error:
D:\Tomcat4.1\work\Standalone\localhost\WebMail\mail_jsp.java:44: cannot resolve symbol
symbol : class WebMailBean
location: class org.apache.jsp.mail_jsp
webMail = (WebMailBean) pageContext.getAttribute("webMail", PageContext.SESSION_SCOPE);
^
-----------------------------------------
And here is my mail.jsp:
---------------------------------
<%@ page language='java' %>
<jsp:useBean id='webMail' class='WebMailBean' scope='session'/>
<jsp:setProperty name='webMail' property='protocol'/>
<jsp:setProperty name='webMail' property='host'/>
<jsp:setProperty name='webMail' property='port'/>
<jsp:setProperty name='webMail' property='user'/>
<jsp:setProperty name='webMail' property='password'/>
<%-- Is the user logged in to the store? --%>
<% if(!webMail.isConnected()) { %>

<jsp:forward page='login.jsp'/>

<% } %>
<html>
<head><title>WebMail</title></head>
<body>
<%-- Does a command need to be executed? --%>
<%
if(request.getParameter("command") != null) {
webMail.doCommand(request);
}
%>
<%-- Change the current folder, if necessary. --%>
<jsp:setProperty name='webMail' property='folder'/>
<%-- Display the messages in this folder. --%>
<h2><jsp:getProperty name='webMail' property='folderName'/></h2>
<a href='write.jsp?to=&subject='>Compose</a> |
<a href='logout.jsp'>Logout</a>
<form method='post' action='<%= request.getRequestURI() %>'>
Folder:
<select name='folder'>
<% String[] folderNames = webMail.getFolderNames();
for(int i = 0; i < folderNames.length; ++i) { %>
<option><%= folderNames[i] %></option>
<% } %>
</select>
<input type='submit' value='Go'>
</form>
<% int messageCount = webMail.getMessageCount();
if(messageCount == 0) { %>
<h1>No messages</h1>
<% } else { %>
<form method='post' action='mail.jsp'>
<table border='1'>

<tr>
<td>Check</td>
<td>Date</td>
<td>From</td>
<td>Subject</td>
<td>Size</td>
</tr>

<% webMail.setMessage(0); %>
<% for(int i = 1; webMail.getNextMessage(); ++i) { %>

<tr>
<td><input type='checkbox' name='number'
value='<%= webMail.getMessageNumber() %>'></td>
<td><jsp:getProperty name='webMail'
property='messageSentDate'/></td>
<td><jsp:getProperty name='webMail'
property='messageFrom'/></td>
<td>
<a href='<%= "read.jsp?message=" +
webMail.getMessageNumber() %>'>
<jsp:getProperty name='webMail'
property='messageSubject'/>
</a>
</td>
<td><jsp:getProperty name='webMail'
property='messageSize'/></td>
</tr>
<% } %>
</table>

<input type='submit' name='command' value='Delete'>
<input type='submit' name='command' value='Copy'>
<input type='submit' name='command' value='Move'>

<select name='to'>

<option value=''>Selected Messages To:</option>
<% String[] otherFolders = webMail.getOtherFolderNames();
for(int i = 0; i < otherFolders.length; ++i) { %>

<option><%= otherFolders[i] %></option>
<% } %>
</select>
</form>

<% } %>
</body>
</html>
-------------------------------------
Thanks for your patience guys. Appreciate it.
Cheers,
- A.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aliasger -- Your JSP is trying to pull the object from session. Unless you specifically put it there, it won't be found.
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello Aliasger,
One possible cause of the error is that you have not packaged your WebMailBean to something like com.WebMailBean). This seem to be a requirement with tomcat version 4.1.x. Unpackaged beans work fine with earlier tomcat versions (e.g. 4.0) though.
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try by keeping the classes under
TOMCAT_HOME\webapps\classes\[PACKAGE_ROOT]
 
No holds barred. And no bars holed. Except this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic