This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Eclipse Collections Categorically: Level up your programming game and have Donald Raab on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Perform() not called in Action class - Struts on Weblogic 6.0

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!!!
I am trying to invoke an EJB from the Action class. However, the perform method is not called - the println's do not show up on the server console nor is any error thrown.
---------<<<<Struts-config.xml Entry>>>>-------------
<!-- ========== Form Bean Definitions ================= -->
<form-beans>
<form-bean name="submitForm"
type="hansen.playground.SubmitForm"/>
</form-beans>
<!-- ========== Action Mapping Definitions ============ -->
<action-mappings>
<action path="/submit"
type="hansen.playground.SubmitAction"
name="submitForm"
input="/submit.jsp"
scope="request">
<forward name="success" path="/submit.jsp"/>
<forward name="failure" path="/submit.jsp"/>
</action>
</action-mappings>
-----------------------------------

-------<<<Action class's perform method>>>-------
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws IOException, ServletException {
System.out.println("perform called !!!");
SubmitForm f = (SubmitForm) form; // get the form bean
// and take the last name value
String lastName = f.getLastName();
// Translate the name to upper case
//and save it in the request object
request.setAttribute("lastName", lastName.toUpperCase());

/***** Calling EJB ***************************/
String op="";
try {
System.out.println("getting initial context");
Context ctx = getInitialContext();
System.out.println("initial context got !!");
DemoHome home = (DemoHome) ctx.lookup("Demo");
System.out.println("home got !!");
Demo ac = null;
try {
ac = (Demo) home.create();
System.out.println("create called!!");
if (ac==null)
System.out.println("ac is null!");
}
catch (Exception ee) {
System.out.print("exception 1");
}
System.out.println("going to call method!");
if (ac!= null)
op = ac.demoSelect();
else
System.out.println("ac is null->error!!");
//out.println(ac.demoSelect());
//out.println("string got!!");
System.out.println("String="+op);
}
catch (Exception e) {

e.printStackTrace();
System.out.println("error 2");
}
/*********************************************/
// Forward control to the specified success target
return (mapping.findForward("success"));
}
---------------------------------------
What is wrong???
 
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic