Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error starting struts app in tomcat

 
Jay Richards
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a web-app that works fine in resin but does not work in tomcat. i always get this error:
Mar 24, 2003 3:32:00 PM org.apache.commons.digester.Digester startElement
SEVERE: Begin event threw exception
java.lang.NoSuchMethodException: Bean has no property named loginRequired
at org.apache.commons.digester.SetPropertyRule.begin(SetPropertyRule.jav
a:193)
at org.apache.commons.digester.Rule.begin(Rule.java:200)
at org.apache.commons.digester.Digester.startElement(Digester.java:1268)

at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXP
arser.java:459)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Abst
ractXMLDocumentParser.java:221)
at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNames
paceBinder.java:874)
at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamespaceBi
nder.java:591)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidat
or.java:748)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElemen
t(XMLDocumentFragmentScannerImpl.java:747)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
LDocumentFragmentScannerImpl.java:329)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:525)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:581)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
ava:1175)
at org.apache.commons.digester.Digester.parse(Digester.java:1543)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet
.java:944)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:468)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:934)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:82
1)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3420)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
608)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347
)
at org.apache.catalina.core.StandardService.start(StandardService.java:4
97)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:218
9)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

===========================
my web.xml looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>1</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/struts-config.xml
</param-value>
</init-param>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>mapping</param-name>
<param-value>com.fltic.crm.UserActionMapping</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>

<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>
================================
and part of my struts-config.xml is
/data-sources>

<form-beans>
<form-bean name="loginForm"
type="com.fltic.crm.form.LoginForm"/>
<form-bean name="userAccountForm"
type="com.fltic.crm.form.UserAccountForm"/>
<form-bean name="addTaskForm"
type="com.fltic.crm.form.AddTaskForm"/>
<form-bean name="taskActivityForm"
type="com.fltic.crm.form.TaskActivityForm"/>
<form-bean name="policyNonFLTICForm"
type="com.fltic.crm.form.PolicyNonFLTICForm"/>
<form-bean name="contactInfoForm"
type="com.fltic.crm.form.ContactInfoForm"/>
<form-bean name="personalInfoForm"
type="com.fltic.crm.form.PersonalInfoForm"/>
<form-bean name="busEmpInfoForm"
type="com.fltic.crm.form.BusEmpInfoForm"/>
<form-bean name="familyPropInfoForm"
type="com.fltic.crm.form.FamilyPropInfoForm"/>
</form-beans>

<global-forwards>
<forward name="login" path="/login.jsp"/>
</global-forwards>

<action-mappings>
<action path="/Login"
type="com.fltic.crm.action.LoginAction"
validate="true"
input="/login.jsp"
name="loginForm"
scope="session" >
<forward name="TM" path="/TmMainTaskList.do"/>
<forward name="Manager" path="/ManagerMain.do"/>
<forward name="Admin" path="/AdminMain.do"/>
</action>

<action path="/Logoff"
type="com.fltic.crm.action.LogoffAction">
<forward name="success" path="/login.jsp"/>
</action>

<!-- TM Action Mappings were transfers to struts-config-tm.xml -->

<!-- TM Specific Mappings [Start]-->
<action path="/TmMainTaskList"
type="com.fltic.crm.action.tm.TaskListAction"
scope="request" >
<set-property property="loginRequired" value="true"/>
<forward name="success" path="/tm-main.jsp"/>
</action>
================================
the error is in loginRequired property which is already defined in my web.xml in the file UserActionMapping
here's the java file:
package com.fltic.crm;

import org.apache.struts.action.ActionMapping;

public class UserActionMapping extends ActionMapping {

protected boolean loginRequired = false;

public UserActionMapping() {

super();
}

public void setLoginRequired(boolean loginRequired) {

this.loginRequired = loginRequired;
}

public boolean isLoginRequired() {

return loginRequired;
}
}
============================
what do i need to let my struts app works because it do works in resin.

please help me.

thanks a lot everyone.
 
K�vin Sotter
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I have the same error and I can't find information to resolve it. Does somebody have the answer ?
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have not had the need to extend ActionMapping till now, so finding this solution took a bit of work and understanding. Here's what I found.

Struts 1.0 allows you to specify an alternate ActionMapping class to be used for holding action mappings. This is done with the "mapping" initialization parameter to the Struts controller servlet (as you have done).
This is however deprecated in Struts 1.1 (I found this in the javadoc comment for the class ActionServlet). Struts 1.1 allows you to define different ActionMapping classes for different modules/actions. This can be configured using the "className" attribute of each <action> element, or globally for a module by using the "type" attribute of the <action-mappings> element.

This would mean changing your struts-config.xml to do one of the following:

<action-mappings type="com.fltic.crm.UserActionMapping">

OR

<action
path="/TmMainTaskList"
type="com.fltic.crm.action.tm.TaskListAction"
scope="request"
className="com.fltic.crm.UserActionMapping">
<set-property property="loginRequired" value="true"/>
<forward name="success" path="/tm-main.jsp"/>
</action>

I hope this solution fixes your problem. Please do let us know.
Sheldon
 
leroi luca
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Sheldon Fernandes !!!

You're fantastic.
It's good: my program does a good work now !

bye
 
Aakash Dodiya
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your class path.
if u not set it then please reset as below.

System classpath is irrelevant.
You run a struts application through a web/application server.
As far as the server is concerned, the classpath is
1 - the directory /WEB-INF/classes
2 - jar files in /WEB-INF/lib/(struts.jar)
3 - server library files. eg with Tomcat jar files in the directories [TOMCAT]/shared/lib and [TOMCAT]/common/lib
[ August 21, 2005: Message edited by: Aakash Dodiya ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic