# Part 1. Getting Started with Web Development using Eclipse

This is the first in a two part article that looks at using Eclipse as a development environment for developing web applications that use the BusinessObjects XI3 Java SDK.

Eclipse is one of the leading development environments for Java applications and indeed other technologies such as C++ and is packed with features that greatly improve productivity and team working. What’s more as it is open source it is free!

The first article in this series looks at how to install and configure Eclipse for web development and the second article then looks at how to reference the BusinessObjects Java SDK in order to develop a BusinessObjects web application.

### Prerequisite Software

Eclipse is available in various packages depending on your development requirements. We can either use the Eclipse for Enterprise Java which includes the web development tools or we use the basic Eclipse for Java and then add on the web development tools. See the Compare Packages page for a summary of the differences between the versions.

Eclipse for Enterprise Java when installed is already setup for web development however it contains more features than we need to BOE web development. The instructions below use the basic Eclipse for Java and then step through adding on the required web development tools. If you are using Eclipse for Enterprise Java then you can skip down to the section “Configuring the Workspace for Web Development”.

Either download the Eclipse IDE for Java EE Developers or download the basic Eclipse IDE Eclipse Galileo (Eclipse classic 3.5.1) and then download the Web Tools Platform project and it’s prerequisites: EMF v2.5 Runtime, EMF XSD v2.5 Runtime and Graphical Editing Framework (GEF).

In addition to Eclipse you will also need a Java Development Kit – JDK 1.5 or above – which you can download from Sun and Apache Tomcat 5.5 or above which you can download from the Apache web site.

### Resources

For further information on Eclipse refer to their online documentation especially the getting started section.

If you want to learn Java Web Technology then there is detailed online course at gulland.com.

For reference materials on BusinessObjects SDK go to the SAP Support.

You may also wish to check out an online tutorial on using the Eclipse Web Tools Platform with Apache Tomcat.

### Install Eclipse

Eclipse is downloaded as a ZIP package. It doesn’t require installation and so you just unzip the package to a suitable folder – I use C:\Eclipse but you could also use C:\Program Files\Eclipse

Once unzipped you can launch Eclipse by running the file eclipse.exe. You probably want to create a shortcut to this executable on your desktop or in your start menu.

When you first launch eclipse it will as you to create a workspace. You can either accept the default however I prefer to create mine in a more accessible location. This workspace folder will contain all your work – the source code and the build packages.

For the remaining steps described below I’ll be using the following as the Eclipse installation folder,

C:\Eclipse\eclipse-java-galileo-win32

### Install the Eclipse Plugins for Web Application Development

Now that we’ve installed eclipse we need to install the web development plugins from the Web Tools Package.

1. Shutdown Eclipse if it is currently running
2. Copy the ZIP files that you have downloaded to the Eclipse ‘dropins’ folder which is found at,
3. C:\Eclipse\eclipse-java-galileo-win32\eclipse\dropins
4. Unzip each file to the current folder so that you have the following subfolders of the dropins folder,
5. emf-runtime-2.5.0
GEF-SDK-3.5.1
wtp-R-3.1.1-20090917225226
xsd-runtime-2.5.0
6. Now start up Eclipse and the plugins will be installed automatically.
7. To check that they have been successfully installed select ‘About Eclipse’ from the Help menu and in the dialog you’ll see 5 icons.
8. About Eclipse dialog displaying installed features

These icons represent the different features installed in Eclipse and the ‘wtp’ icon is for the Web Tools Project. Clicking this will display details of the version and features available in the Web Tools Project.

9. When you first launch Eclipse for the first time your view is of the welcome screen, select the icon to go to the workbench and we are now ready to configure eclipse for web development.

### Configuring Eclipse for Web Development

If you already have a project under development in eclipse then we need to create a new workspace that we can configure for web development. If however you have just installed Eclipse then you already have a new workspace and so we can go ahead and configure that one.

#### Create a New Workspace

If you need to create a new workspace then follow these steps otherwise skip to the next section.

1. From the File menu select New Workspace
2. Create a workspace folder in your preferred location

We can now configure this workspace for web development. Note, when you next launch eclipse you’ll be asked to select a workspace and so select this one. You may wish then to give it a name that refers to the project.

### Configuring the Workspace for Web Development

The first thing we do is to define Tomcat as the web application server,

1. Change the perspective to web development if not already (Eclipse for Enterprise Java may default to this): Window > Open Perspective > Other and then select Java EE from the list.
2. Next select Windows > Preferences and then in the list of items on the right select expand Server and select Runtime Environments.
3. Define runtime environment in preferences dialog

4. In the panel on the right click Add to add a new Tomcat server.
5. Select Apache Tomcat v5.5 and click Next
6. Enter path to Tomcat installation. Select the folder that contains the sub folders ‘bin’, ‘conf’ etc, for example C:\Tomcat\apache-tomcat-5.5.26
7. In the same dialog we need to specify the JDK that Tomcat will use to compile JSPs etc. To do this click on Installed JREs
8. In the next dialog click Add
9. Select Standard VM for JRE Type and click Next
10. Click Directory and select the JDK folder: C:\Program Files\Java\jdk1.5.0_11. Eclipse will now add the libraries for the JVM
12. Here select the checkbox next to the JDK you’ve just added. It should look something like the following
13. Preferences dialog displaying installed JREs

14. Click OK to close that dialog
15. Click Finish to adding new Tomcat server
Eclipse is now configured to use Tomcat as a web application server. When testing your web app you may wish to manually start and stop Tomcat yourself. To do this we need to open the server view,
17. From the Window menu select Show View > Servers. The Servers dialog will open in the workbench, you can move it around, I prefer to have mine in the same panel as the project explorer.

### Create a New Web Development Project

OK now we’ve setup Eclipse we can start a new project

1. Create a new Dynamic Web Project by right-clicking in the empty white space of the Package Explorer pane at the extreme left of the workbench, choosing New > Dynamic Web Project.
2. Give it a name such as ‘boe’
3. Creating a new dynamic web project

4. No further settings is required so just click finish.

### Create a Basic JSP

OK we can now create a simple JSP and then check that everything is working as expected.

1. Right click over the white space area in the project explorer and select New > JSP (you can also right click over any of the folders – Eclipse will always know to put new JSPs in the correct Web Content folder).
2. Create a new JSP

3. Enter a name for the JSP ‘simple’ and click Next. Note, when requesting a JSP page via a URL the name is case sensitive so it is a good idea not to mix case in JSP file names if possible.
4. Select any template – default is fine for our needs. Note, you can create your own JSP templates in Eclipse that can contain a default page layout or reference corporate CSS files.
5. You should now have a screen similar to the one below and we can now write some JSP code.
6. Eclipse workspace with a JSP openned for editing

7. Enter the following code between the ‘body’ tags,
8. This page was last viewed <%= session.getLastAccessedTime() %>
9. Save the JSP file by clicking the save icon or CTRL+s or from File > Save menu
10. Now we want to test the JSP page. To do this we run the app which will startup Tomcat, launch the Eclipse browser and then display the JSP. Note, by default Eclipse will use it’s internal browser however you can configure eclipse to use another browser installed on your worklstation. Goto Window > Preferences and then expand General and select Web Browser.

11. Run the project by clicking the Run icon or from the Run menu select Run.
12. Accept to run using the default Tomcat server and your JSP should display in the browser
13. Now go back to the JSP editor and add the following directive at the top of the page,
14. <%@ page import="java.util.*" %>
15. Next update the code within the body tags to look like the following,
16. <%
Date d = new Date(session.getLastAccessedTime());
%>

This page was last viewed <%= d.toString() %>
17. Save the JSP and go back to the eclipse browser tab and click the refresh icon. The JSP should now update with the change.
18. Eclipse workspace displaying the Eclipse internal browser with a JSP open

### Web Archive – How to create a war file from Eclipse

When we have finished with a project and want to deploy it elsewhere we create a WAR file. To do this,

1. Right click on the project and select Export > WAR file
2. Update the name or keep default and enter a Destination for where the WAR file will be created
3. Click Finish and your WAR file is generated.

You can now import the War file to your test or production environments. Refer to your application server documentation for instructions on how to deploy a web application from a WAR file.

That gets us started with creating web applications. In the next article we’ll look at how to setup Eclipse to use the BusinessObjects SDK and then create a simple logon page to test that all is set up correctly.

## 11 comments on “Part 1. Getting Started with Web Development using Eclipse”

1. broccolimustdie

i did all these things and followed part 2 too but getting following error

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: com/crystaldecisions/enterprise/ocaframework/idl/ImplServ/OSCAFactoryPackage/connection_failure
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

root cause

javax.servlet.ServletException: com/crystaldecisions/enterprise/ocaframework/idl/ImplServ/OSCAFactoryPackage/connection_failure
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet

2. agulland Post author

that seems to be a fairly generic error, do you know at what point in your code is throwing the error?

3. broccolimustdie

it was just some jars missing so i included whole library…. thanks for great post

4. broccolimustdie

agulland,

I am new to SDK and after successfully pulling report i have requirement to show prompts of that report to user using SDK…. I have downloaded sdkexample and trying to figure out things from it but as i am not programmer i have great deal of problem understanding the way there are 5-6 jsp files and all….. is there any easy to understand document which can help me Thanks in advance

5. agulland Post author

Samples are your best bet although they aren’t easiest for deciphering what’s going on. There’s a few more docs on the SAP website but they aren’t very detailed. If you don’t have experience of java and JSP it will be difficult to begin with. What might help is to start with what you have for viewing a doc and then add code for prompts, testing as you go to see how it fits together.

The tricky thing with prompts is that you need to display a page that allows a user to fill in prompt values and then take those to another page which displays the doc.

Good luck!

AL

6. harsha549

I followed both tutorials but still I am getting eventhough i installed the jar and placed in value in both classpath and path

org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 24

21: IEnterpriseSession eSession = null;
22:
23: try {
24: final ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
26: sSuccessFailMsg = “You have successfully logged on! BOE version: ” +
27: eSession.getEnterpriseVersion();

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

7. Al Gulland Post author

Hi,

The key error is,

java.lang.NoClassDefFoundError: org/aspectj/lang/Signature

and this means that your missing a required JAR library. I don’t recognise aspectj and a quick google looks like that this is part of Eclipse (http://www.eclipse.org/aspectj/) so maybe there’s an issue with your Eclipse install?

Were you able to create a Basic JSP as described above? Or if you’re using a more recent version of SAP BusinessObjects than the version mentioned in the article then there’s maybe additional required JARs

AL