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
dreams4everAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

fargo
dreams4everAuthor Commented:
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
dreams4everAuthor Commented:
>> everythis is closed perfectly
 everything is closed perfectly



Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

bloodredsunCommented:
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 :-)
dreams4everAuthor Commented:
<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
bloodredsunCommented:
Okay. If  you are calling the form bean correctly it must mean that the bean cannot be loaded from the classpath. This could mean that the file is not present on the classpath or that there are conflicting versions on the classpath.

Please check that there are no other jars with that file in and that this file is not in the WEB-INF/classes folder either

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fargoCommented:
bloodredsun, you are keeping an eye on me -:)
bloodredsunCommented:
;-)
dreams4everAuthor Commented:
bloodredsun
I dont have any jar files  in my WEB-INF folder

Thanks
bloodredsunCommented:
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?
dreams4everAuthor Commented:
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


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.