Solved

To girinois || TimYates :-)

Posted on 2004-08-18
12
320 Views
Last Modified: 2013-11-24
With reference to my previous Q, Please tell me where i am wrong.
----------------
 My web.xml
----------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
      <filter>
            <filter-name> Filter </filter-name>
            <filter-class>de.grassgmbh.kalendartool.filters.MyFilter</filter-class>
      </filter>
      <servlet>
            <servlet-name>action</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>debug</param-name>
                  <param-value>3</param-value>
            </init-param>
            <init-param>
                  <param-name>detail</param-name>
                  <param-value>3</param-value>
            </init-param>
            <load-on-startup>0</load-on-startup>
      </servlet>
      <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
      </servlet-mapping>
</web-app>


------------------------
My struts-config.xml
------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
      <data-sources />
      <form-beans >
            <form-bean name="filterForm" type="de.grassgmbh.kalendartool.form.FilterForm" />
            <form-bean name="registerMaskForm" type="de.grassgmbh.kalendartool.form.RegisterMaskForm" />
            
      </form-beans>

      <global-exceptions />
      <global-forwards />
      <action-mappings >
            <action
                  attribute="filterForm"
                  input="/jsp/ManageCapacity/FilterList.jsp"
                  name="filterForm"
                  path="/filter"
                  scope="request"
                  type="de.grassgmbh.kalendartool.action.FilterAction"
                  unknown="false"
                  validate="false">
                  <forward
                        name="success"
                        path="/jsp/ManageCapacity/ShowList.jsp"
                        redirect="true"
                        contextRelative="false" />
            </action>
            <action
                  attribute="registerMaskForm"
                  input="/jsp/ManageCapacity/RegisterMaskList.jsp"
                  name="registerMaskForm"
                  path="/registerMask"
                  scope="request"
                  type="de.grassgmbh.kalendartool.action.RegisterMaskAction"
                  unknown="false"
                  validate="false">
                  <forward
                        name="reg_success"
                        path="/jsp/ManageCapacity/ShowList.jsp"
                        redirect="true"
                        contextRelative="false" />
            </action>

      </action-mappings>

      <controller
            bufferSize="4096"
            debug="0"
            locale="false"
            nocache="false"
            inputForward="false" />

      <message-resources null="true" parameter="de.grassgmbh.kalendartool.resources" />
      
      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
            <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
      </plug-in>
</struts-config>


Thanks.
0
Comment
Question by:sangeetha
  • 7
  • 3
  • 2
12 Comments
 
LVL 2

Author Comment

by:sangeetha
ID: 11830505
To give more overview:
----------------------------

KalendarTool
|
|____ src
|           |
|           |___ de.grassgmbh.kalendartool
|           |                   |
|           |                   |____ resources.properties
|           |
|           |___ de.grassgmbh.kalendartool.form
|           |                   |
|           |                   |___ FilterForm.java
|           |                   |___ RegisterMaskForm.java
|           |                  
|           |___ de.grassgmbh.kalendartool.action                  
|           |                   |
|           |                   |___ FilterAction.java
|           |                   |___ RegisterMaskAction.java
|           |
|           |___ de.grassgmbh.kalendartool.filters
|                               |
|                               |___ MyFilter.java
|
|_____ We-Root
               |
               |____ WEB-INF
               |           |
               |           |____ struts-config.xml, web.xml, etc..
               |
               |____ jsp
                           |
                           |____ ManageCapacity
                                            |
                                            |____ FilterList.jsp
                                            |____ RegisterMaskList.jsp
                                            |____ ShowList.jsp



and I have ShowList.jsp as follows:
-----------------------------------------


 ----------------------            -----------------------------
|   FilterList.jsp       |         |  RegisterMaskList.jsp     |
|                           |         |                                    |
 ----------------------            -----------------------------
  ------------------------------------------------------------
|                                                                             |
|                  show the list here                                 |
|                                                                             |
|                                                                             |
  ------------------------------------------------------------
0
 
LVL 35

Accepted Solution

by:
TimYates earned 150 total points
ID: 11830626
You need web.xml like this:

(sorry, I missed a bit out before)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
     <filter>
          <filter-name>Filter</filter-name>
          <filter-class>de.grassgmbh.kalendartool.filters.MyFilter</filter-class>
     </filter>
     <filter-mapping>
         <filter-name>Filter</filter-name>
         <url-pattern>*.jsp</url-pattern>
     </filter-mapping>
     <filter-mapping>
         <filter-name>Filter</filter-name>
         <url-pattern>*.do</url-pattern>
     </filter-mapping>
     <servlet>
          <servlet-name>action</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>debug</param-name>
               <param-value>3</param-value>
          </init-param>
          <init-param>
               <param-name>detail</param-name>
               <param-value>3</param-value>
          </init-param>
          <load-on-startup>0</load-on-startup>
     </servlet>
     <servlet-mapping>
          <servlet-name>action</servlet-name>
          <url-pattern>*.do</url-pattern>
     </servlet-mapping>
</web-app>

so that the filter will only be run if you go to a URL with *.jsp or *.do in the filename...

What error are you getting?
0
 
LVL 2

Author Comment

by:sangeetha
ID: 11830702
When i save the web.xml file, it shows the following error in my 'Console' Window:

16:15:59,300 INFO  [TomcatDeployer] undeploy, ctxPath=/KalendarTool, warUrl=file:/C:/Programme/jboss/server/default/deploy/KalendarTool.war/
16:15:59,347 INFO  [TomcatDeployer] deploy, ctxPath=/KalendarTool, warUrl=file:/C:/Programme/jboss/server/default/deploy/KalendarTool.war/
16:15:59,660 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
16:15:59,707 ERROR [Digester] Begin event threw exception
java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)

// blah...blah............

at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)
Caused by: java.lang.LinkageError: loader constraints violated when linking org/apache/struts/action/ActionMapping class
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:141)
      at org.apache.struts.config.FormBeanConfig.class$(FormBeanConfig.java:190)
      at org.apache.struts.config.FormBeanConfig.setType(FormBeanConfig.java:190)
      ... 97 more
16:15:59,707 ERROR [ActionServlet] Parsing error processing resource path
java.lang.reflect.InvocationTargetException
      at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
      at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
      at org.apache.commons.digester.Digester.startElement(Digester.java:1276)
      at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1635)

// blah...blah...

16:15:59,722 INFO  [Engine] StandardContext[/KalendarTool]Marking servlet action as unavailable
16:15:59,722 ERROR [Engine] StandardContext[/KalendarTool]Servlet /KalendarTool threw load() exception
javax.servlet.UnavailableException: Parsing error processing resource path
      at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:1035)
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 35

Expert Comment

by:TimYates
ID: 11830735
have you tried rebooting tomcat?
0
 
LVL 2

Author Comment

by:sangeetha
ID: 11830746
I doubled the points. I have *many* questions to compete with my points. :-D

Thanks for your wnoderful help so far. :-)
0
 
LVL 2

Author Comment

by:sangeetha
ID: 11830807
Yeahh.. i tried, but same result :-(
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 50 total points
ID: 11831046
What I suggest you do is the trial and error technique. For start get rid fo the

<filter>
          <filter-name>Filter</filter-name>
          <filter-class>de.grassgmbh.kalendartool.filters.MyFilter</filter-class>
     </filter>
     <filter-mapping>
         <filter-name>Filter</filter-name>
         <url-pattern>*.jsp</url-pattern>
     </filter-mapping>
     <filter-mapping>
         <filter-name>Filter</filter-name>
         <url-pattern>*.do</url-pattern>
     </filter-mapping>

part in your web.xml and try again. If it does not fail then the error is somewhere there, defining the filter. Then try to add tags one by one and try again. This will help you identify the problem.
0
 
LVL 2

Author Comment

by:sangeetha
ID: 11835601
0
 
LVL 2

Author Comment

by:sangeetha
ID: 11836923
0
 
LVL 35

Expert Comment

by:girionis
ID: 11838489
Any updates on this problem? Are you still getting the same error message?
0
 
LVL 2

Author Comment

by:sangeetha
ID: 11896710
sorry for late...it worked after i restart the application and deployed again. thanks for your help.
0
 
LVL 35

Expert Comment

by:girionis
ID: 11899947
:)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question