p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning JavaServer Pages (http://p2p.wrox.com/forumdisplay.php?f=162)
-   -   Ch 19 not working either... (http://p2p.wrox.com/showthread.php?t=29526)

resolutions May 19th, 2005 03:26 PM

Ch 19 not working either...
 
Ok......... I skipped over my last problem(s) (ch18) and continued to chapter 19 ...
I downloaded struts 1.2.4 (same as book uses), followed directions, and got ant to do the build just fine. I go to my tomcat manager page, and see that the struts app was on there, and I go to
http://localhost:8080/struts-base/index.jsp and get a....

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
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:370)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:291)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


root cause

java.lang.NullPointerException
    org.apache.struts.taglib.TagUtils.retrieveMessageR esources(TagUtils.java:1219)
    org.apache.struts.taglib.TagUtils.message(TagUtils .java:1082)
    org.apache.struts.taglib.bean.MessageTag.doStartTa g(MessageTag.java:226)
    org.apache.jsp.index_jsp._jspx_meth_bean_message_0 (org.apache.jsp.index_jsp:125)
    org.apache.jsp.index_jsp._jspService(org.apache.js p.index_jsp:86)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:322)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:291)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.


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

Apache Tomcat/5.5.9



sooooo..... I had a (perhaps) symilar problem with chapter 18 WebWork example, chapter 18 Spring I could not try because there is NO file that contains the properties I was instructed to change (I added an errata for this), and with chapter 19 I have this problem. So far the framework section of the book seems rather flawed to me.


diegoborgh May 31st, 2005 03:06 AM

same problem here


jon_eaves May 31st, 2005 06:59 PM

Looking at the error message it appears that you are missing a message properties file required by the taglib.

Both Chapter 18 and Chapter 19 have paragraphs that discuss this file and it's location and Chapter 18 contains some contents for that file.

While debugging JSP can be confusing at times, and simple configuration errors seems to create massive failures, your issues seem to stem from a single problem that should be simple to fix.

Creating so many examples for a book is very time consuming and is prone to human mistakes. We tried very hard to minimise those and do apologise for any that have survived the editing process.

There is an upside, debugging is a very important skill for software developers, so look at this as a head start to your competition that you'll have already been able to identify and work out these issues.

Searching these and other forums and using Google will also be invaluable tools for furthering your knowledge of Java development.

guacamole82 July 7th, 2005 03:17 PM

In regards to the Spring framework example... I am having the same problem as mentioned above. The build.xml simply does not contain any of the mentioned properties on page 570. I did download the latest version of Spring which is slightly newer than the one used in the book but I doubt that a drastic change would occur between 1.0 and 1.1. If the properties aren't in build.xml, where are they?

If anyone has been able to figure this out please let me know.

Thanks in advance.

suneel_agrawal April 12th, 2006 11:42 PM

Jon,

  I'm getting following error on JBoss:-
================================================== ===================
00:26:27,474 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException
        at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:254)
        at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:256)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.valves.CertificatesValve.invok e(CertificatesValve.java:246)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.catalina.core.StandardContext.invoke(St andardContext.java:2415)
        at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:180)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatcherValve.java:171)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:172)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:509)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:174)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.coyote.tomcat4.CoyoteAdapter.service(Co yoteAdapter.java:223)
        at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:594)
        at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:392)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:565)
        at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:619)
        at java.lang.Thread.run(Thread.java:534)
00:26:27,474 ERROR [Engine] ----- Root Cause -----
java.lang.NullPointerException
        at org.apache.struts.taglib.TagUtils.retrieveMessageR esources(TagUtils.java:1175)
        at org.apache.struts.taglib.TagUtils.message(TagUtils .java:1038)
        at org.apache.struts.taglib.bean.MessageTag.doStartTa g(MessageTag.java:224)
        at org.apache.jsp.login_jsp._jspx_meth_bean_message_0 (login_jsp.java:102)
        at org.apache.jsp.login_jsp._jspService(login_jsp.jav a:68)
        at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:137)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
        at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:210)
        at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:256)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.valves.CertificatesValve.invok e(CertificatesValve.java:246)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.catalina.core.StandardContext.invoke(St andardContext.java:2415)
        at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:180)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatcherValve.java:171)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:172)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:509)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:174)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.coyote.tomcat4.CoyoteAdapter.service(Co yoteAdapter.java:223)
        at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:594)
        at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:392)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:565)
        at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:619)
        at java.lang.Thread.run(Thread.java:534)

================================================== ===================

I'm using following code:-
1) struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">

<struts-config>

    <global-exceptions>
        <exception
         key = "global.error.invalidlogin"
         path = "/login.jsp"
         scope = "request"
         type = "com.oreilly.struts.banking.service.InvalidLoginEx ception"/>
    </global-exceptions>

    <global-forwards>
        <forward name = "SystemFailure" path = "/systemerror.jsp"/>
        <forward name = "SessionTimeOut" path = "/sessiontimeout.jsp"/>
    </global-forwards>

    <action
     path = "/login"
     type = "com.oreilly.struts.banking.action.LoginAction "
     scope = "request"
     name = "loginForm"
     validate = "true"
     input = "/login.jsp">
     <forward name = "Success" path = "/home.jsp" redirect = "true"/>
     <forward name = "Failure" path = "/login.jsp" redirect = "true"/>
    </action>

    <action
     path = "/logout"
     type = "com.oreilly.struts.banking.action.LogoutActio n"
     scope = "reuest">
     <forward name = "Success" path = "/login.jsp" redirect = "true"/>
    </action>

    <form-beans>
        <form-bean
         name = "loginForm"
         type = "com.oreilly.struts.banking.form.LoginForm"/>
        <form-bean
          name = "accountInformationForm"
          type = "org.apache.struts.action.DynaActionForm">
          <form-property name = "accounts" type = "java.util.ArrayList"/>
        </form-bean>
        <form-bean
        name = "accountDetailForm"
        type = "org.apache.struts.action.DynaActionForm">
        <form-property name = "view" type = "com.oreilly.struts.banking.view.AccountDetailView "/>
        </form-bean>
    </form-beans>

    <message-resources parameter="BaseResources" null="false" scope="application"/>
</struts-config>
2)web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">

<web-app>
    <servlet>
        <servlet-name>simpleloginapp</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>host</param-name>
            <param-value>localhost</param-value>
        </init-param>
        <init-param>
            <param-name>port</param-name>
            <param-value>7001</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>simpleloginapp</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>
</web-app>
3)login.jsp
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>

<html:html>
<% System.out.println("Hello++++333++");%>
    <head>
        <title><bean:message key="title.login"/></title>
    </head>
<% System.out.println("Hello---------------");%>
    <body>
    suneel
    </body>
</html:html>

4) BaseResources.properties
title.login = Struts Online Banking

I'm accessing login.jsp via http://localhost:8081/SimpleLoginApp/login.jsp


Please help !

Thanks,
Suneel.


keeotee May 23rd, 2006 05:45 AM

suneel,

I can't say exactly what is wrong and why you are getting the results you are, specifically the error, but I can suggest you correct a couple other things first and then proceed.

Refer to page 596 in the book. Notice particularly that the order in which a struts-config file is laid out is not only important and required but can cause some stange errors.

From your struts-config file I see two things: one is that the form beans come after your action mappings, and two that your action mappings are not nested within <action-mappings>... </action-mappings>.

I'd make those two corrections and see what you get.

Benjamin_zyl May 17th, 2007 04:36 AM

Ch19-struts-base I go to http://localhost:8080/struts-base/index.jsp and finish ex2 ,input some things and submit get a ...


HTTP Status 500 -

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

type Exception report

message

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

exception

javax.servlet.ServletException: Servlet execution threw an exception


root cause

java.lang.NoClassDefFoundError: org/apache/oro/text/perl/Perl5Util
    org.apache.commons.validator.GenericValidator.matc hRegexp(GenericValidator.java:72)
    org.apache.struts.validator.FieldChecks.validateMa sk(FieldChecks.java:238)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.apache.commons.validator.ValidatorAction.execu teValidationMethod(ValidatorAction.java:567)
    org.apache.commons.validator.Field.validateForRule (Field.java:827)
    org.apache.commons.validator.Field.validate(Field. java:906)
    org.apache.commons.validator.Form.validate(Form.ja va:174)
    org.apache.commons.validator.Validator.validate(Va lidator.java:367)
    org.apache.struts.validator.DynaValidatorForm.vali date(DynaValidatorForm.java:110)
    org.apache.struts.action.RequestProcessor.processV alidate(RequestProcessor.java:928)
    org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:204)
    org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1194)
    org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

what's happened?





All times are GMT -4. The time now is 06:49 PM.

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