PDA

View Full Version : Error in struts appeared when go to run a script with LogFactory, Log classes but I c


lse
04-05-2010, 07:55 AM
I have the text:
Dynamic Web Application
Development using
XML and Java
David Parsons
ISBN: 9781844805419
well,
I build/compile war files success ...

yesterday, I was able to to the same for struts apps[app=changed name], but today I am getting errors for Struts only, i can NOT run struts completelly, I use TOMCAT, Well???
Error in struts appeared when go to run a script with LogFactory, Log classes but I continue run non-struts apps success!

ERRORS
HTTP Status 404 - /strutswebapp/page1.htm

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

type Status report

message /strutswebapp/page1.htm

description The requested resource (/strutswebapp/page1.htm) is not available.

2222222222
HTTP Status 404 - /strutswebapp/home.jsp

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

type Status report

message /strutswebapp/home.jsp

description The requested resource (/strutswebapp/home.jsp) is not available.


eg
Examples15\Examples\Example 15-3 Struts Global Forward App\java
Page1Action.java

package com.webhomecover.action;

import org.apache.struts.action.* ;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.servlet.http.*;

public class Page1Action extends Action
{
private static Log log = LogFactory.getLog(Page1Action.class);

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
if (log.isInfoEnabled())
{
log.info("In Page1Action");
}
return mapping.findForward("success");
}
}

brad211987
04-05-2010, 12:57 PM
I'm personally not familiar with struts, but I would check in your web.xml file for your web application. Since you are getting a 404 error, I'm assuming a servlet path is not present or not correct in the web.xml.

More detail on the problem may help diagnose it a bit too.

lse
04-05-2010, 03:12 PM
since I use build.xml for this text assignments in Struts etc chapters to build file.war, and in another Struts app non using build.xml tested now success (from another book), use only compilations manually javac, well may the problem be on build.xml? I compile success, but this for sure means success run?

see attach

lse
04-05-2010, 04:37 PM
But, since not found neither file.htm/file.html, what error must be?

lse
04-05-2010, 04:38 PM
any debug tip?

ckeyrouz
04-05-2010, 05:04 PM
What is the context of your web application?

I mean where it is located under tomcat?

Can you please provide me with the full path of your web application?

The error 404 means the file is not found due to either in the way you are writing the name of the file to be called (java is case sensitive) or because you are pointing to an invalid path due to a different context of the web application.

lse
04-05-2010, 06:13 PM
C:\Users\User\Documents\TextBooksDataFiles\R+.ex+.Practice works as on\xml-java\Examples15\Examples\Example 15-1 Struts Routing App\strutswebapp

I run same app success but now start to malfunction(same dir)...

ckeyrouz
04-05-2010, 07:23 PM
I would like the folder under webapps under tomcat where the war file is deployed.

lse
04-05-2010, 08:08 PM
C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18\webapps\strutswebapp

lse
04-05-2010, 09:24 PM
problem solved--->moved app folder to a bath without "+"

C:\Users\User\Documents\TextBooksDataFiles\R+.ex+.Practice works as on\xml-java\Examples15\Examples\Example 15-1 Struts Routing App\strutswebapp

new
C:\Users\User\Documents\TextBooksDataFiles\JAVA\xml-java\Examples15\Examples15\Examples\Example 15-2 Struts Action Routing App\java