• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

LoginBean doesn't compile

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am trying to deploy an application from Struts for Dummies. The app has some classes including LoginBean class and a UserDTO class. I am facing problems with these 2. UserDTO compiles ok but when I try to compile LoginBean I get this error:


C:\Documents and Settings\HP_Administrator>cd C:\Program Files\Apache Group\Tomc
at 5.5\webapps\Login5b\source\dummies\struts

C:\Program Files\Apache Group\Tomcat 5.5\webapps\Login5b\source\dummies\struts>j
avac LoginBean.java
LoginBean.java:91: cannot find symbol
symbol : class UserDTO
location: class dummies.struts.LoginBean
UserDTO user = new UserDTO(username, password, age, status);
^
LoginBean.java:91: cannot find symbol
symbol : class UserDTO
location: class dummies.struts.LoginBean
UserDTO user = new UserDTO(username, password, age, status);
^
2 errors


Can someone figure what the problem is. Shall really appreciate.

Thanks in advance.
Ricky James

The code of the 2 files is pasted below:



 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error message is telling you that you haven't included the UserDTO class in your compile-time classpath when you're trying to compile the LoginBean class.

I'd suggest you not compile classes into the same directory as the source, but specify a different destination directory. Either way, you must include the destination directory in your classpath. example:
 
Ricky James
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Merrill Higginson:
The error message is telling you that you haven't included the UserDTO class in your compile-time classpath when you're trying to compile the LoginBean class.

I'd suggest you not compile classes into the same directory as the source, but specify a different destination directory. Either way, you must include the destination directory in your classpath. example:



Hello Merrill,

Thanks for the reply and advice. I tried what you suggested but I got a lot of errors. The whole of the errors are pasted below. I think I might have to add something to the classpath. Can you please advise what I can do?

Thanks in advance.
Ricky

C:\Program Files\Apache Group\Tomcat 5.5\webapps\Login5b>javac -d WEB-INF/classe
s -classpath /WEB-INF/classes source/dummies/struts/*.java
source/dummies/struts/LoginAction.java:3: package javax.servlet.http does not ex
ist
import javax.servlet.http.HttpServletRequest;
^
source/dummies/struts/LoginAction.java:4: package javax.servlet.http does not ex
ist
import javax.servlet.http.HttpServletResponse;
^
source/dummies/struts/LoginAction.java:6: package org.apache.struts.action does
not exist
import org.apache.struts.action.Action;
^
source/dummies/struts/LoginAction.java:7: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionError;
^
source/dummies/struts/LoginAction.java:8: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionErrors;
^
source/dummies/struts/LoginAction.java:9: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionForm;
^
source/dummies/struts/LoginAction.java:10: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionForward;
^
source/dummies/struts/LoginAction.java:11: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionMapping;
^
source/dummies/struts/LoginAction.java:13: cannot find symbol
symbol: class Action
public class LoginAction extends Action
^
source/dummies/struts/LoginAction.java:15: cannot find symbol
symbol : class ActionMapping
location: class dummies.struts.LoginAction
public ActionForward execute( ActionMapping mapping,
^
source/dummies/struts/LoginAction.java:16: cannot find symbol
symbol : class ActionForm
location: class dummies.struts.LoginAction
ActionForm form,
^
source/dummies/struts/LoginAction.java:17: cannot find symbol
symbol : class HttpServletRequest
location: class dummies.struts.LoginAction
HttpServletRequest req
uest,
^
source/dummies/struts/LoginAction.java:18: cannot find symbol
symbol : class HttpServletResponse
location: class dummies.struts.LoginAction
HttpServletResponse response) throws Exception

^
source/dummies/struts/LoginAction.java:15: cannot find symbol
symbol : class ActionForward
location: class dummies.struts.LoginAction
public ActionForward execute( ActionMapping mapping,
^
source/dummies/struts/LoginForm.java:3: package javax.servlet.http does not exis
t
import javax.servlet.http.HttpServletRequest;
^
source/dummies/struts/LoginForm.java:5: package org.apache.struts.action does no
t exist
import org.apache.struts.action.ActionError;
^
source/dummies/struts/LoginForm.java:6: package org.apache.struts.action does no
t exist
import org.apache.struts.action.ActionErrors;
^
source/dummies/struts/LoginForm.java:7: package org.apache.struts.action does no
t exist
import org.apache.struts.action.ActionForm;
^
source/dummies/struts/LoginForm.java:8: package org.apache.struts.action does no
t exist
import org.apache.struts.action.ActionMapping;
^
source/dummies/struts/LoginForm.java:10: cannot find symbol
symbol: class ActionForm
public class LoginForm extends ActionForm
^
source/dummies/struts/LoginForm.java:15: cannot find symbol
symbol : class ActionMapping
location: class dummies.struts.LoginForm
public void reset(ActionMapping mapping, HttpServletRequest request)
^
source/dummies/struts/LoginForm.java:15: cannot find symbol
symbol : class HttpServletRequest
location: class dummies.struts.LoginForm
public void reset(ActionMapping mapping, HttpServletRequest request)
^
source/dummies/struts/LoginForm.java:21: cannot find symbol
symbol : class ActionMapping
location: class dummies.struts.LoginForm
public ActionErrors validate(ActionMapping mapping, HttpServletRequest reque
st)
^
source/dummies/struts/LoginForm.java:21: cannot find symbol
symbol : class HttpServletRequest
location: class dummies.struts.LoginForm
public ActionErrors validate(ActionMapping mapping, HttpServletRequest reque
st)
^
source/dummies/struts/LoginForm.java:21: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginForm
public ActionErrors validate(ActionMapping mapping, HttpServletRequest reque
st)
^
source/dummies/struts/LoginAction.java:32: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginAction
ActionErrors errors = new ActionErrors();
^
source/dummies/struts/LoginAction.java:32: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginAction
ActionErrors errors = new ActionErrors();
^
source/dummies/struts/LoginAction.java:33: cannot find symbol
symbol : class ActionError
location: class dummies.struts.LoginAction
ActionError error = new ActionError("error.login.invalid");
^
source/dummies/struts/LoginAction.java:33: cannot find symbol
symbol : class ActionError
location: class dummies.struts.LoginAction
ActionError error = new ActionError("error.login.invalid");
^
source/dummies/struts/LoginForm.java:23: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginForm
ActionErrors errors = new ActionErrors();
^
source/dummies/struts/LoginForm.java:23: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginForm
ActionErrors errors = new ActionErrors();
^
source/dummies/struts/LoginForm.java:26: cannot find symbol
symbol : class ActionError
location: class dummies.struts.LoginForm
errors.add("userName", new ActionError("error.username.required"));
^
source/dummies/struts/LoginForm.java:28: cannot find symbol
symbol : class ActionError
location: class dummies.struts.LoginForm
errors.add("password", new ActionError("error.password.required"));
^
Note: source/dummies/struts/LoginBean.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
33 errors

C:\Program Files\Apache Group\Tomcat 5.5\webapps\Login5b>

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This means you have not included all the files necessary for the project to run. It seems you have not included Struts library files. Please collect all necessary files or use Netbeans to work on the example
 
Ricky James
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vyas:
This means you have not included all the files necessary for the project to run. It seems you have not included Struts library files. Please collect all necessary files or use Netbeans to work on the example



Thanks for the reply Vyas. I'll try to use NetBeans.

Ricky
 
There is no "i" in denial. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic