Search This Blog

2009-07-28

JavaEE with RAD 7.5 and WAS7

Hi guys,

as I promised to post my experiences with RAD7.5 (Rational Application Developer) and WAS7 (Websphere Application Server), I will now show you what I tried to implement during the WAS7 presentation/workshop using the RAD7 wizards and code snippets.

STEP1: I created a WebProject
STEP2: and added a Servlet

--> there was no code skeleton generated for the servlet. Netbeans generates you at least something like this.

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
/* TODO output your page here
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("Servlet Testservlet at " + request.getContextPath ());
out.println("");
out.println("");
*/
} finally {
out.close();
}
}
STEP3: I tried to deploy the WebProject to WAS7
--> RAD only allows you to deploy EAR files, so if you want to deploy only the war or ejb, you have to use the admin console. Very inconvenient. If you try to use the context menu and select run on server on the web project, you get the following exception:
Could not find a valid parent module to add to the server.

STEP4: I created a EJB Project
STEP5: and added a local stateless session bean, with some hello(String name) implementation
--> the wizard asks you to create a class diagram, which is a nice feature.
STEP6: I created a EAR project and added the EJB and the WebProject
STEP7: Invoke the local stateless session bean from the servlet
--> Of course, I could have coded this feature very easily by just adding the @EJB annotation but I wanted to see what the snippet produces, so I used the snippet: CALL a Session Bean Service method. The snippet wants to create an ejb reference and asks you to select the session bean. I selected my local stateless session bean and received the following error: Remote interface cannot be empty. So RAD tells me I can not invoke a local session bean from servlet where both projects are part of the same EAR? Interesting....
If I select remote even if the interface doesn't have a remote interface, RAD finally generates something...some code with compile errors...Welcome back to the world of EJB2.1 :) Feoijesfer is the name of the reference I had to enter... :)

protected FeoijesferRemote createFeoijesferRemote() {
= () ServiceLocatorManager.getRemoteHome(STATIC__REF_NAME, STATIC__CLASS);
try {
if ( != null)
return .create();
}catch (javax.ejb.CreateException ce) {
// TODO Auto-generated catch block
ce.printStackTrace();
} catch (RemoteException re) {
// TODO Auto-generated catch block
re.printStackTrace();
}return null;
}

private final static String STATIC__REF_NAME = "ejb/Feoijesfer_2";
private final static Class STATIC__CLASS = .class;

After this result I didn't want to waste any more time with RAD7.5. Of course it is now possible to create JavaEE applications with IBM products, but don't use the wizards I used. Do it yourself or switch to Netbeans.


1 comment:

  1. "Do it yourself or switch to Netbeans."

    you don't say. These IBM products underwhelm be with crippling bursts of wishywashyness. I feel physically ill every time I am forced to use them

    ReplyDelete