Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 14th, 2003, 12:08 PM
Registered User
 
Join Date: Aug 2003
Location: London, Ontario, Canada.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 18-Sample App-Compilation

Hi,

I have completed the coding for the Sample App in Chapter 18, When I try and compile the application, the compiler reports that it cannot find the struts objects. Below is the compiler output. Does anyone have any ideas why the struts jar file in the lib folder is not being found?

Thanks,
Paul

C:\jakarta-tomcat-4.1.24-LE-jdk14\webapps\begjsp-ch18\WEB-INF\classes>javac comexample\*.java
com\example\EmployeeForm.java:9: package org.apache.struts.action does not exist

import org.apache.struts.action.ActionForm;
                                ^
com\example\EmployeeForm.java:15: cannot resolve symbol
symbol : class ActionForm
location: class com.example.EmployeeForm
public class EmployeeForm extends ActionForm
                                  ^
com\example\ValidateEmployeeAction.java:9: package org.apache.struts.action does
 not exist
import org.apache.struts.action.ActionForm;
                                ^
com\example\ValidateEmployeeAction.java:10: package org.apache.struts.action doe
s not exist
import org.apache.struts.action.ActionForward;
                                ^
com\example\ValidateEmployeeAction.java:11: package org.apache.struts.action doe
s not exist
import org.apache.struts.action.Action;
                                ^
com\example\ValidateEmployeeAction.java:12: package org.apache.struts.action doe
s not exist
import org.apache.struts.action.ActionMapping;
                                ^
com\example\ValidateEmployeeAction.java:13: package org.apache.struts.action doe
s not exist
import org.apache.struts.action.ActionErrors;
                                ^
com\example\ValidateEmployeeAction.java:14: package org.apache.struts.action doe
s not exist
import org.apache.struts.action.ActionError;
                                ^
com\example\ValidateEmployeeAction.java:15: package org.apache.struts.action doe
s not exist
import org.apache.struts.action.ActionServlet;
                                ^
com\example\ValidateEmployeeAction.java:28: cannot resolve symbol
symbol : class Action
location: class com.example.ValidateEmployeeAction
public class ValidateEmployeeAction extends Action
                                            ^
com\example\ValidateEmployeeAction.java:30: cannot resolve symbol
symbol : class ActionMapping
location: class com.example.ValidateEmployeeAction
  public ActionForward perform(ActionMapping mapping,
                               ^
com\example\ValidateEmployeeAction.java:31: cannot resolve symbol
symbol : class ActionForm
location: class com.example.ValidateEmployeeAction
                              ActionForm form,
                              ^
com\example\ValidateEmployeeAction.java:30: cannot resolve symbol
symbol : class ActionForward
location: class com.example.ValidateEmployeeAction
  public ActionForward perform(ActionMapping mapping,
         ^
com\example\ValidateEmployeeAction.java:37: cannot resolve symbol
symbol : class ActionErrors
location: class com.example.ValidateEmployeeAction
    ActionErrors errors = new ActionErrors();
    ^
com\example\ValidateEmployeeAction.java:37: cannot resolve symbol
symbol : class ActionErrors
location: class com.example.ValidateEmployeeAction
    ActionErrors errors = new ActionErrors();
                              ^
com\example\ValidateEmployeeAction.java:43: cannot resolve symbol
symbol : class ActionError
location: class com.example.ValidateEmployeeAction
      ActionError error = new ActionError("error.missing.name");
      ^
com\example\ValidateEmployeeAction.java:43: cannot resolve symbol
symbol : class ActionError
location: class com.example.ValidateEmployeeAction
      ActionError error = new ActionError("error.missing.name");
                              ^
com\example\ValidateEmployeeAction.java:44: cannot resolve symbol
symbol : variable ActionErrors
location: class com.example.ValidateEmployeeAction
      errors.add(ActionErrors.GLOBAL_ERROR,error);
                 ^
com\example\ValidateEmployeeAction.java:50: cannot resolve symbol
symbol : class ActionError
location: class com.example.ValidateEmployeeAction
      ActionError error = new ActionError("error.missing.department");
      ^
com\example\ValidateEmployeeAction.java:50: cannot resolve symbol
symbol : class ActionError
location: class com.example.ValidateEmployeeAction
      ActionError error = new ActionError("error.missing.department");
                              ^
com\example\ValidateEmployeeAction.java:51: cannot resolve symbol
symbol : variable ActionErrors
location: class com.example.ValidateEmployeeAction
      errors.add(ActionErrors.GLOBAL_ERROR,error);
                 ^
com\example\ValidateEmployeeAction.java:57: cannot resolve symbol
symbol : class ActionError
location: class com.example.ValidateEmployeeAction
       ActionError error = new ActionError("error.missing.skills");
       ^
com\example\ValidateEmployeeAction.java:57: cannot resolve symbol
symbol : class ActionError
location: class com.example.ValidateEmployeeAction
       ActionError error = new ActionError("error.missing.skills");
                               ^
com\example\ValidateEmployeeAction.java:58: cannot resolve symbol
symbol : variable ActionErrors
location: class com.example.ValidateEmployeeAction
      errors.add(ActionErrors.GLOBAL_ERROR,error);
                 ^
com\example\ValidateEmployeeAction.java:64: cannot resolve symbol
symbol : class ActionForward
location: class com.example.ValidateEmployeeAction
      return new ActionForward(mapping.getInput());
                 ^
25 errors

pdtt
Reply With Quote
  #2 (permalink)  
Old September 15th, 2003, 10:03 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There's a problem with your CLASSPATH by the look of it.

Make sure that it points to the struts.jar file wherever you have installed it.

Doesn't really matter as Tomcat won't load the later TLD files anyway.

Reply With Quote
  #3 (permalink)  
Old September 15th, 2003, 05:00 PM
Registered User
 
Join Date: Aug 2003
Location: London, Ontario, Canada.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you. As you suggested, I put the direct path to the jar file in the CLASSPATH variable and the compile worked.
Reply With Quote
  #4 (permalink)  
Old September 15th, 2003, 05:28 PM
Registered User
 
Join Date: Aug 2003
Location: London, Ontario, Canada.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rollopa,

If you read this...

Now that my classes have compiled, I am getting a "The requested resource (/begjsp-ch18/inputContent.jsp) is not available" error on my page when I run the application. When I start Tomcat, It is loading a bunch of struts objects, but does not seem to be creating any errors. I created a simple html only jsp page in the same directory and received the same error. Below is the Tomcat startup messages. Any ideas?

15-Sep-2003 6:13:41 PM org.apache.commons.modeler.Registry loadRegistry
INFO: Loading registry information
15-Sep-2003 6:13:41 PM org.apache.commons.modeler.Registry getRegistry
INFO: Creating new Registry instance
15-Sep-2003 6:13:42 PM org.apache.commons.modeler.Registry getServer
INFO: Creating MBeanServer
15-Sep-2003 6:13:46 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 8080
Starting service Tomcat-Standalone
Apache Tomcat/4.1.24-LE-jdk14
15-Sep-2003 6:14:03 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
e
15-Sep-2003 6:14:03 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
l=true
15-Sep-2003 6:14:04 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='resources.application', returnNull=true
15-Sep-2003 6:14:04 PM org.apache.struts.tiles.TilesPlugin init
INFO: Tiles definition factory loaded for module ''.
15-Sep-2003 6:14:04 PM org.apache.struts.validator.ValidatorPlugIn initResources

INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
15-Sep-2003 6:14:05 PM org.apache.struts.validator.ValidatorPlugIn initResources

INFO: Loading validation rules file from '/WEB-INF/validation.xml'
15-Sep-2003 6:14:08 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
e
15-Sep-2003 6:14:08 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
l=true
15-Sep-2003 6:14:09 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.webapp.example.Alternate Applicatio
nResources', returnNull=true
15-Sep-2003 6:14:09 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.webapp.example.Applicati onResource
s', returnNull=true
15-Sep-2003 6:14:09 PM org.apache.struts.webapp.example.memory.MemoryData basePlu
gIn init
INFO: Initializing memory database plug in from '/WEB-INF/database.xml'
15-Sep-2003 6:14:09 PM org.apache.struts.validator.ValidatorPlugIn initResources

INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
15-Sep-2003 6:14:09 PM org.apache.struts.validator.ValidatorPlugIn initResources

INFO: Loading validation rules file from '/WEB-INF/validation.xml'
15-Sep-2003 6:14:11 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
e
15-Sep-2003 6:14:11 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
l=true
15-Sep-2003 6:14:12 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.webapp.exercise.Applicat ionResourc
es', returnNull=true
15-Sep-2003 6:14:15 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
e
15-Sep-2003 6:14:15 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
l=true
15-Sep-2003 6:14:16 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.webapp.upload.UploadReso urces', re
turnNull=true
15-Sep-2003 6:14:17 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
e
15-Sep-2003 6:14:17 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
l=true
15-Sep-2003 6:14:18 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.webapp.validator.Applica tionResour
ces', returnNull=true
15-Sep-2003 6:14:18 PM org.apache.struts.validator.ValidatorPlugIn initResources

INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
15-Sep-2003 6:14:18 PM org.apache.struts.validator.ValidatorPlugIn initResources

INFO: Loading validation rules file from '/WEB-INF/validation.xml'
15-Sep-2003 6:14:20 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
e
15-Sep-2003 6:14:20 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
l=true
15-Sep-2003 6:14:21 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.webapp.tiles.dev1-1.ApplicationRes
ources', returnNull=true
15-Sep-2003 6:14:21 PM org.apache.struts.tiles.TilesPlugin init
INFO: Tiles definition factory loaded for module ''.
15-Sep-2003 6:14:22 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.webapp.tiles.dev1-1.ApplicationRes
ources', returnNull=true
15-Sep-2003 6:14:22 PM org.apache.struts.tiles.TilesPlugin init
INFO: Tiles definition factory loaded for module '/tutorial'.
15-Sep-2003 6:14:22 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.webapp.tiles.dev1-1.ApplicationRes
ources', returnNull=true
15-Sep-2003 6:14:22 PM org.apache.struts.tiles.TilesPlugin init
INFO: Tiles definition factory loaded for module '/test'.
15-Sep-2003 6:14:22 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.webapp.tiles.dev1-1.ApplicationRes
ources', returnNull=true
15-Sep-2003 6:14:22 PM org.apache.struts.tiles.TilesPlugin init
INFO: Tiles definition factory loaded for module '/examples'.
15-Sep-2003 6:14:26 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on port 8080
15-Sep-2003 6:14:26 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
15-Sep-2003 6:14:26 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=30/170 config=C:\jakarta-tomcat-4.1.24-LE-jdk14\conf
\jk2.properties
Reply With Quote
  #5 (permalink)  
Old September 15th, 2003, 05:36 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check your web.xml file in /web-inf/ for your application. When you get the "resource not available error" it seems that the application didn't load properly.

Quickest way to validate web.xml is open it in IE.

I will have to re-install struts and re-do chapter 18 to check your other errors so give me some time. :)

For me chapter 18 failed completely because Tomcat couldn't load the custom tld files, a problem I will have to struggle again with now.

There's also log files in /your-tomcat-dir/logs
Reply With Quote
  #6 (permalink)  
Old December 12th, 2004, 10:40 PM
Registered User
 
Join Date: Dec 2004
Location: hk, hk, Hong Kong.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi pdtt
I have problem to compile the program.
I have set the classpath:
C:\Program Files\Apache Tomcat
4.0\webapps\ROOT\begjsp-ch18\WEB-INF\lib\struts.jar
Is it wrong?

when I compile it:
C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\begjsp-ch18\WEB-INF\classes>javac com\example\*.java
com\example\DepartmentDigester.java:3: package
org.apache.struts.digester does not exist
.........

Can you show your classpath to me?
I want to ask one more thing,My tomcat program has ROOT folder,
should I put the begjsp-ch18 into the ROOT?


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is anybody have sample app on Zend Framewok snowbydave1 Pro PHP 0 November 18th, 2008 10:52 AM
A question on bookstore sample app and pointbase partho_choudhury JSP Basics 0 April 9th, 2004 02:10 AM
A question on bookstore sample app and pointbase partho_choudhury Pro JSP 0 April 9th, 2004 02:09 AM



All times are GMT -4. The time now is 04:59 AM.


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