• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

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
0
dreams4ever
Asked:
dreams4ever
  • 5
  • 4
  • 2
1 Solution
 
fargoCommented:
the struts-config.xml is not parsed correctly.
Check the tag position, closing etc in the struts-config.xml file.

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



0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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 :-)
0
 
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
0
 
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
0
 
fargoCommented:
bloodredsun, you are keeping an eye on me -:)
0
 
bloodredsunCommented:
;-)
0
 
dreams4everAuthor Commented:
bloodredsun
I dont have any jar files  in my WEB-INF folder

Thanks
0
 
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?
0
 
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


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now