?
Solved

Calling an action class from a jar file

Posted on 2006-04-04
13
Medium Priority
?
217 Views
Last Modified: 2010-04-01
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
Comment
Question by:dreams4ever
  • 5
  • 4
  • 2
11 Comments
 
LVL 11

Expert Comment

by:fargo
ID: 16370627
the struts-config.xml is not parsed correctly.
Check the tag position, closing etc in the struts-config.xml file.

fargo
0
 

Author Comment

by:dreams4ever
ID: 16370684
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
 

Author Comment

by:dreams4ever
ID: 16370692
>> everythis is closed perfectly
 everything is closed perfectly



0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:bloodredsun
ID: 16371004
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
 

Author Comment

by:dreams4ever
ID: 16371518
<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
 
LVL 29

Accepted Solution

by:
bloodredsun earned 2000 total points
ID: 16371573
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
 
LVL 11

Expert Comment

by:fargo
ID: 16371803
bloodredsun, you are keeping an eye on me -:)
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 16372727
;-)
0
 

Author Comment

by:dreams4ever
ID: 16372827
bloodredsun
I dont have any jar files  in my WEB-INF folder

Thanks
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 16374536
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
 

Author Comment

by:dreams4ever
ID: 16380940
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

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

If anyone asked you to network diagram of the internet, it was drawn in the form of a fluffy cloud which further became known as cloud computing. Popularly cloud computing is defined as workloads that run over the internet in a commercial provider’s…
In the below post we have mentioned the best hosting type for startups. Also, check out some of the superlative web hosting companies that are proposing affordable web hosting solutions to host your startup website.
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

809 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