This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hi, I have just started to use WebSphere Application Developer in the last week and I have ran into difficulities in developing EJB's with a web-based client like JSP or a servlet. I have experience in developing EJB's with SUN's default package(deploytool) but the process is very different with WebSphere. I have worked through some tutorials but I can't get past a certain point! Here is what I have been doing: 1. I created a new Enterprise Application Project. 2. I created my EJB's in the Appropiate folder, added the appropiate methods and compiled the programs, etc. 3. I then generated the deploy and RMIC code for the Bean 4. I ran the test client to test the bean and I could create a new instance of the bean and play with the methods successfully, etc. 5. I created my web client, in this case a JSP, in the appropiate web folder. I encounter a problem at this point. I can't compile the JSP because the EJB imports in the JSP are not recognised, the JSP cannot find the beans. If I move the JSP into the same folder as the beans I cannot run them on the server? I have to be missing a step but I don't know what it is. If anyone has any ideas or a recommended tutorial which addresses these issues I would greatly appreciate it. Thanks
Your description suggests that you are attempting to access your EJBs directly from your JSPs. If you are having visibility problems, you may need to Edit Module Dependencies and/or update the Java Build Path for your Web Application module. However, I would suggest that you reconsider your design. Personally, I would NEVER attempt to access EJBs directly from a JSP. At a minimum, I would create an access or wrapper bean around the EJB and access the EJB through it. Your approach results in a lot of unnecessary code in the presentation layer, i.e. the JSP.