Have any questions?
+44 1234 567 890
Setting up Development with ReportServer 3.0
In this tutorial we describe how to set up a development environment based on Eclipse to look into ReportServer 3.0 Community Edition as well as to have an ideal environment for developing ReportServer scripts. With ReportServer 3.0 we have significantly simplified the process of setting up a development environment. Nevertheless there are quite a few steps that we need to follow. In short these are:
- Download a recent version of Eclipse
- Download GWT 2.7
- Configure Eclipse to use GWT
- Download ReportServer
- Download additional libraries
- Setup the project in Eclipse
- Start ReportServer from within Eclipse
In the following we'll go through these step by step.
Download Eclipse
First step is to download a recent version of Eclipse. Eclipse comes in many prepackaged variants. The best to start with ReportServer development is the Java IDE. It is available from https://eclipse.org/ide/. At the time of writing the latest Eclipse version is Mars.2 which you can download for your preferred platform from https://eclipse.org/downloads/packages/eclipse-ide-java-developers/mars2.
Once you've downloaded Eclipse, start it up and create a new workspace. Before we, however, create any new projects we will need to set up GWT (in version 2.7).
You might want to increase the available main memory for Eclipse. This is beyond the scope of this tutorial, but a bit of googling should get you there.
Download GWT
ReportServer is build on top of GWT (http://www.gwtproject.org/). To set up GWT we will need to download the GWT SDK 2.7 as well as set up the GWT developer tools in Eclipse. First step is to download the GWT SDK which is available from the GWT download page. Make sure to get version 2.7 (the latest stable version at the time of writing). If a newer version appears you will find the older versions in the GWT download archive.
Once downloaded, unpack the archive and put the folder gwt-2.7.0 somewhere safe. We'll need it shortly when setting up GWT in Eclipse.
Configure Eclipse to use GWT
Next, we will set up GWT in Eclipse. There are several tutorials (including an official tutorial) out there discussing the basics of using GWT with Eclipse. For this tutorial, we assume that you have worked with Eclipse before and are thus not going into too much detail.
To install the GWT Plugin (i.e., the Google Plugin) for Eclipse, get the latest plugin link from https://developers.google.com/eclipse/docs/download. Within Eclipse choose Install new Software from the Help menu bar, add the latest plugin url as a repository and choose to install the Google Plugin for Eclipse. Note that you do not need to install the Developer Tools or any of the SDKs.
Follow the instructions and when the plugin was successfully installed, restart Eclipse.
Next we are going to link the previously downloaded GWT 2.7 SDK. For this we open the Eclipse preferences and go to Google > Web Toolkit. Here we click Add and choose the previously downloaded gwt-2.7.0 folder. Close the preferences. This concludes setting up GWT in Eclipse.
Download ReportServer
Next, we need to download the ReportServer 3.0.1 sources as well as binaries. (The latter will be used to get most of the necessary libraries.) Sources and binaries are available from sourceforge.
Once downloaded, unpack both archives. The sources should contain a single folder ReportServer which in turn contains three folders: metamodel, src and war.
Download Additional Libraries
Besides the ReportServer sources and binaries we need some additional libraries to successfully compile ReportServer. These are
- Juel (Version 2.2.7)
- SLF4J (to get decent logs)
- rs-entityservices.jar
- rs-saiku.jar
- rs-mockup.jar
You can get Juel from http://juel.sourceforge.net/. We'll be using the juel-api-2.2.7.jar that comes with Juel.
SLF4J is a logging framework and we will be using the slf4j-simple logger to set up a basic logging. You can download slf4j from http://www.slf4j.org/download.html. Look for version 1.7.12 (although the latest version will probably work as well).
As for the three remaining jars, you can download them directly via the above links.
Setup the project in Eclipse
We now have everything we need to setup ReportServer in Eclipse. For this we go back to our empty Eclipse workspace open the Java perspective (if it is not already open) and choose to create a new Web Application Project (right click in Project Exporer, new > Other... Then choose Google > Web Application Project).
In the upcoming wizard provide the following configuration.
Project Name | ReportServer |
Package | net.datenwerke |
Use Google App Engine | disable |
Generate project sample code | disable |
Hit Finish to create the project. You should now have a more or less empty project that has a src folder with the single empty package net.datenwerke as well as a war folder containing WEB-INF/lib/gwt-servlet.jar and WEB-INF/web.xml.
Copy Libraries: In the following we are going to copy the necessary libraries to WEB-INF/lib. First copy the perviously downloaded additional libraries:
- juel-api-2.2.7.jar
- slf4j-simple-1.7.12.jar
- rs-entityservices.jar
- rs-saiku.jar
- rs-mockup.jar
Next, we are going to copy most of the libraries from the ReportServer binaries over. In the unpacked ReportServer binaries that you downloaded earlier you will also find a WEB-INF/lib folder. Copy all the jars from that folder to the new project WEB-INF/lib folder except for the following jars:
- gwt-servlet-2.7.0.jar
- reportserver.jar
- rs-schemaupdate.jar
- slf4j-ext-1.7.12.jar
Copy war: Next we are going to copy the relevant files from the ReportServer sources' war directory. In the ReportServer sources' war directory you will also find a WEB-INF directory containing two xml files web.xml and sun-jaxws.xml. Copy both files to the project's WEB-INF directory thereby overwriting the web.xml file that is already present. Directly beneath the war directory in the unpacked sources you should find additional files and folders (favicon.ico, licenses, ReportServer.html and resources). Copy these to the package's war directory.
Copy metamodel: Within the unpacked sources you should find a folder metamodel. Copy this folder directly into the project folder.
Copy sources: Finally we can copy the src folder from the unpacked ReportServer sources into the project. You'll be notified that the folder already exists: choose to overwrite it.
If all went well you should now have a view similar to the following on the right.
With ReportServer it is usually easier to work with a hierarchical package outline rather than the default flat outline. To switch the outline click on the small down-arrow on the topbar of the Package Explorer and choose Package Presentation > Hierarchical. This is also the view in the screenshot on the right.
As you can see there are still quite a few errors because we have not yet properly set up the classpath. To do so right-click the project and choose Properties. In the properties window go to Java Build Path. There in the Source tab choose Add Folder... and choose the metamodel folder. Next go to the Libraries tab and click Add Jars.... Go to WEB-INF/lib and choose all jars within that directory.
Once you've closed the properties panel, Eclipse will start a recompilation and this time it should finish without any errors. Congratulations, you have just compiled ReportServer for the first time. Next we will discuss how to start ReportServer from within Eclipse.
Starting ReportServer
In order to start ReportServer we first need to prepare a database and configure the connection settings. Installing a database is out of the scope of this tutorial so we have to assume that you already have one of the supported database systems running. In the unpacked binaries archive you will find a folder called ddl which contains SQL scripts to set up the necessary structures. Choose the script for your database and execute it.
Further information on the database setup is also given in the ReportServer Configuration Guide.
Now that we have a database ready, we need to tell ReportServer how to access it. For this we'll copy a sample configuration file from the binaries archive over to the project folder. The sample configuration is called persistence.properties.example and can be found in WEB-INF/classes in the binaries archive. Copy the file into the src folder within your Eclipse project. That is, it should be next to the other config files such as reportserver.properties.
Once you've copied the file, rename it to persistence.properties and open it for editing. It contains examples for connections to various databases. Configure the database settings and save the file.
Before we can start ReportServer there is one final folder that we should copy from the binaries archive to our Eclipse project. In the archive you should find a folder called pkg which contains the base configuration installed during the first start of ReportServer as well as the demo data. Copy the folder to the war folder within your Eclipse project.
Now all that is left is to start ReportServer. For this open the package net.datenwerke where you should find a file called ReportServer.gwt.xml. Right click the file and choose Run As > Web Application (GWT Super Dev Mode). As soon as Eclipse starts ReportServer we can stop it again, since we need to make some additional adjustment. Now that we have started ReportServer once, Eclipse has create a Run Configuration. We can open the configuration by clicking on the run button from the toolbar (round green button with play arrow) and choose Run Configurations... (see screenshot).
On the left you should find a run configuration called ReportServer. Choose that Arguments tab on the right. This allows us to specify arguments for the JVM. What we are interested in is the main memory setting which by default is 512 MB which is too little for ReportServer. Increase this to at least 2 GB, for example, change the VM arguments to be:
-Xmx3g -XstartOnFirstThread
Hit Apply and the Run to finally start ReportServer. If all went well you should see something akin to the following output on the console:
Runing CodeServer with parameters: [-noprecompile, -port, 9876, -sourceLevel, 1.7, -bindAddress, 127.0.0.1, -launcherDir, /Users/arno/Downloads/mySpace/ReportServer/war, -logLevel, INFO, net.datenwerke.ReportServer] Super Dev Mode starting up workDir: /var/folders/w7/6gcxpbxn3n18ss_vm48847w00000gn/T/gwt-codeserver-2852183346399272654.tmp Loading Java files in net.datenwerke.ReportServer. Ignored 1 unit with compilation errors in first pass. Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors. Module setup completed in 5030 ms The code server is ready at http://127.0.0.1:9876/ Code server started in 5154 ms [main] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: net.datenwerke.rs.utils.hibernate.MySQL5Dialect [main] INFO net.datenwerke.rs.EnvironmentValidator - _____ _ _____ | __ \ | | / ____| | |__) |___ _ __ ___ _ __| |_| (___ ___ _ ____ _____ _ __ | _ // _ \ '_ \ / _ \| '__| __|\___ \ / _ \ '__\ \ / / _ \ '__| | | \ \ __/ |_) | (_) | | | |_ ____) | __/ | \ V / __/ | |_| \_\___| .__/ \___/|_| \__|_____/ \___|_| \_/ \___|_| | | |_| Version: Unknown Code Version: 2016-03-24-23-46-15 VM Args: -Xmx3g -Dfile.encoding=UTF-8 rs.configdir: Not Configured ### DB Config ### hibernate.dialect: net.datenwerke.rs.utils.hibernate.MySQL5Dialect (OK) hibernate.connection.driver_class: com.mysql.jdbc.Driver (OK) hibernate.connection.url: jdbc:mysql://localhost:3306/rs (OK) hibernate.connection.username: root hibernate.connection.password: **** hibernate.default_schema: Connection Test: OK Schema Version: RS3.0-7
In the current configuration, logging goes a bit overboard, so expect to see quite a few warnings of hibernate that can, however, be safely ignored.
Once ReportServer has started, you should see a URL in the Development Mode tab, such as:
http://127.0.0.1:8888/ReportServer.html
Pointing your browser to this URL will result in GWT starting to perform a compilation of the client side code (the browser should look like the screenshot on the right). In the Eclipse Console you should see something along the following lines
GET /recompile/reportserver Job net.datenwerke.ReportServer_1_0 starting job: net.datenwerke.ReportServer_1_0 binding: gxt.user.agent=gecko1_9 binding: user.agent=gecko1_8 binding: user.agent.os=mac Compiling module net.datenwerke.ReportServer Ignored 1 unit with compilation errors in first pass. Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Compilation may take several long minutes, so this is the perfect time to get a fresh cup of coffee and congratulate yourself on being almost done.
Once compilation has finished you should see the following entries in the Console:
Unification traversed 136884 fields and methods and 12755 types. 12701 are considered part of the current module and 12701 had all of their fields and methods traversed. Compiling 1 permutation Compiling permutation 0... Linking per-type JS with 12685 new types. prelink JS size = 39424903 prelink sourcemap = 39424903 bytes and 674224 lines postlink JS size = 39267502 postlink sourcemap = 39267502 bytes and 670633 lines Source Maps Enabled Compile of permutations succeeded Compilation succeeded -- 218,495s Linking into /var/folders/w7/6gcxpbxn3n18ss_vm48847w00000gn/T/gwt-codeserver-2852183346399272654.tmp/net.datenwerke.ReportServer/compile-2/war/reportserver; Writing extras to /var/folders/w7/6gcxpbxn3n18ss_vm48847w00000gn/T/gwt-codeserver-2852183346399272654.tmp/net.datenwerke.ReportServer/compile-2/extras/reportserver Link succeeded Linking succeeded -- 2,131s 221,143s total -- Compile completed
More important, your browser should have reloaded and now show you the ReportServer login screen. As per any new installation ReportServer will have created a user called root with password root. Congratulations, you are now setup.
Happy Coding