Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Power BI Embedded Sample in Spring MVC framework

Requirements

  1. JDK (or JRE)
    Find the steps to add Java path to environment variable here
    To check if you have working JDK execute java -version in terminal

  2. Eclipse IDE (Download Eclipse for Enterprise Java Developers)

  3. Apache Tomcat (Download binary distributions)

Set up a Power BI app

  1. For Master user, register a Native app here and for Service Principal, register a Server-side web app by following this.

    Select "Read all datasets" and "Read all reports" permissions during Power BI app setup. Refer to thedocumentation for registering a Power BI app.

    Refer to the documentation for the complete list of Power BI permissions.

Steps to build and run

  1. Open Eclipse and Click Window > Show View > Select Servers.

  2. Setup Tomcat server

    1. Go to Servers tab, click No servers are available. Click this link to create new server...
    2. Select v9.0 Tomcat version from Apache
    3. Click Next
    4. Click browse, then select the folder which contains Tomcat
    5. Select JRE which is available through system variable
    6. Click Finish
    7. There should be a Tomcat server now in the Servers tab
  3. To import project, Click File > Open Project from File System > Click on Directory > Select PowerBIEmbedding folder > Finish

  4. Let Maven finish automatically downloading the dependencies in background.

  5. Add Tomcat server to the project

    1. Right click PowerBIEmbedding (project's name) from Project Explorer and then click Properties
    2. Select Targeted Runtimes
    3. Select Apache Tomcat from the list
    4. Click on Apply and Close
  6. Fill in the required parameters in Config.java file related to AAD app, Power BI report, workspace, and user account information.

  7. Run the project

    1. Right click project's name from Project Explorer
    2. Select Run As > Run on Server
    3. Select the created server and click Finish
    4. http://localhost:8080/appownsdatasample should open in browser

Important

For security reasons, in a real world application, password or secrets should not be stored in config. Instead, consider securing credentials with an application such as Key Vault.

Troubleshoot

Windows shows "File path too long" during Eclipse IDE setup extraction.

Skip the files during extraction whose paths are too long

Windows shows error popup while trying to run the eclipse.exe file.

Check the size of the extracted Eclipse setup folder. It should be ~599 MB.

Eclipse shows "Building has encountered a problem" or "Maven is not configured properly" error after importing the project.

  1. Delete folder named 2.6 from %userprofile%\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\ directory
  2. Right click project's name from Project Explorer > Maven > Update Project > Check Force Update of Snapshots/Releases > Click Ok

Eclipse shows "The server cannot be started because one or more of the ports are invalid. Open the server editor and correct the invalid ports." error while starting the Tomcat server.

  1. Click on Servers tab on the event log area of the IDE
  2. Double click on the server name which says "Tomcat v9.0 Server at localhost..."
  3. Set the Tomcat admin port to any available port (for e.g. 8079)

"Run on Server" option is not visible for running the project.

  1. Right click on the project > Properties > Project Facets
  2. Select Dynamic Web Module, Java, and JavaScript options are selected.
  3. Click on Apply and Close.