JasperServer: workarounds for small problems

I wrote about the integration between JasperServer and Microsoft Active Directory last October. One of the readers of the post, Andrés Arenas, drew my attention to a problem: if an person input its user name one time in lowercases, another in uppercases, Jasper Reports Server creates two users in its repository. Here you have an excerpt of a screenshot that shows the problem clearly:

JasperServer Screenshot

Fortunately, if you follow the best practice of assigning permissions to the Active Directory groups imported, you won’t have problems. I’m sure that the solution to this issue would be to patch the source code that imports the users, but for a systems administrator this isn’t practical. A quick way to avoid this problem is to edit the file $JASPERSERVER_HOME/apache-tomcat/webapps/jasperserver/WEB-INF/jsp/templates/login.jsp and change the line:

  <input id="j_username" name="j_username" type="text"/>


  <input id="j_username" name="j_username" type="text" 
    style="text-transform:lowercase;" onkeyup="javascript:this.value=this.value.toLowerCase();"/>

On the other hand, I recently had to design a report for a tracking system where each user just could see its own data, not those saved by others. Therefore, the SQL statement must include the user name within the WHERE clause. My first option was to create a parameter named LoggedInUser of the class com.jaspersoft.jasperserver.api.metadata.user.domain.User and put this clause:

 where username = $P{LoggedInUser}.getFullName()

But I got the following exception:

  com.jaspersoft.jasperserver.api.JSExceptionWrapper: Report design not valid : 
    1. Parameter type not supported in query : LoggedInUser class 

A workaround to this problem is to create another string parameter, LoggedInUserName, and assign the expression $P{LoggedInUser}.getFullName() as its default value.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s