Link to home
Start Free TrialLog in
Avatar of dreams4ever
dreams4ever

asked on

Calling an action class from a jar file

I have a struts application . I now add a jar file to the lib of the main struts application, the jar file  is another struts application.

Now from the main struts application I have a jsp which calls a form bean and an action class from the second jared struts application .

In my main strutsconfig .xml I have an action mapping for the second action class and the form bean definition .

When I deploy my application I get an error in my server console

<Servlet: "action" failed to preload on startup in Web application: "ABCSYSTEM".
javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/struts-config.xml
      at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:769)
      at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:745)
      at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:687)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:333)
      at javax.servlet.GenericServlet.init(GenericServlet.java:258)

Please Advice

Thanks
Avatar of fargo
fargo

the struts-config.xml is not parsed correctly.
Check the tag position, closing etc in the struts-config.xml file.

fargo
Avatar of dreams4ever

ASKER

everythis is closed perfectly

when I add this to the form-beans definition I get this exception

<form-bean name="XYZStrutActionForm" type="com.xyz.simulator.actions.XYZStrutActionForm" />  

when I remove this line I get no exception on my server .

Thanks
>> everythis is closed perfectly
 everything is closed perfectly



Avatar of bloodredsun
You need to make sure that the form-bean tag is located in the correct place in the xml file and that it is surrounded by the form-bean tag and also that the class file declared exists and is on the classpath, and that you haven't made a spelling mistake in the declaration of the type attribute, e.g.

...
<struts-config>
    <form-beans>
          <form-bean name="XYZStrutActionForm" type="com.xyz.simulator.actions.XYZStrutActionForm" />  

PS fargo, you really don't need to sign your name on every post! we know it's you by the title of the comment and it just adds redundant extra lines to the thread :-)
<form-beans >
  <form-bean name="XYZStrutActionForm" type="com.xyz.simulator.actions.XYZStrutActionForm"/>  
    <form-bean name="loginForm" type="com.abc.ltab.form.LoginForm" />
</form-beans >


The below form bean is called from the jared file . Jar file is in the proper class path. which gives the exception

  <form-bean name="XYZStrutActionForm" type="com.xyz.simulator.actions.XYZStrutActionForm"/>  

Thanks
ASKER CERTIFIED SOLUTION
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
bloodredsun, you are keeping an eye on me -:)
bloodredsun
I dont have any jar files  in my WEB-INF folder

Thanks
And in your WEB-INF/lib folder?

So the bean file is found at WEB-INF/classes/com/xyz/simulator/actions/XYZStrutActionForm.class

and it extends ActionForm, correct?
bloodredsun,

  I created the action class and the form bean in my main struts application and called other classes from the jar file which works perfectly

Thanks for all the comments