BIRT: The viewing session is not available or has expired

by Jay Jonas

If you are using…

WebViewer.display()

from a Eclipse RCP View calling to display a BIRT report and your report is open without any problem within the view, I know how much you are happy with BIRT.

However, if when you click on Print Report toolbar command, and  choose HTML print format, you see your report opens in a Internet Explorer window with a exception as follows, maybe you want to read the rest of this post.

This seems to be a Internet Explorer policy with iframe, cookies and cross-site.

Here you are the complete stack trace:

org.eclipse.birt.report.exception.ViewerException: The viewing session is not available or has expired.
 at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(BaseReportEngineServlet.java:158)
 at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doPost(BaseReportEngineServlet.java:224)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
 at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.eclipse.birt.report.servlet.BaseReportEngineServlet.service(BaseReportEngineServlet.java:116)
 at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
 at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
 at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)
 at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:318)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
 at org.mortbay.jetty.Server.handle(Server.java:326)
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
 at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:939)
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
 at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
 at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

A initial workaround for this is change the default browser used: go to Window >Preferences > Report Design > Preview. First, check the Always use external browsers checkbox. Right below there is a link to set the external browser preference, just do it. Finally, you may also want to set the host and port the viewer starts on using the Preview > Preview Server entry.

Sorry, but this was the prelude, because despite you change the default browser to another, e.g. Mozilla Firefox, the report always opens with Internet Explorer and the exception is throwed.

The actual workaround is disable the Internet Explorer Protected Mode for your site zone or something like that. Mine was intranet zone, it was easy! These are the steps:

  1. Open IE.
  2. From the IE command bar, choose Tools and then Internet Options.
  3. In the Internet Options window, click on the Security tab.
  4. Below the Security level for this zone area (in my case, it’s Intranet), and directly above the Custom level… and Default level buttons, uncheck the Enable Protected Mode checkbox.
    Note: disabling Protected Mode requires a restart of IE, as you may have seen next to the checkbox in this step.
  5. Click OK on the Internet Options window.
  6. If you’re prompted with a Warning! dialog box, advising that The current security settings will put your computer at risk, click the OK button.
  7. Close IE and then open it up again.

As I was advised by Jason I filed the bug ID 333931. The initial discussion about this started in BIRT forum on this topic.

That’s it!

Advertisements

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

%d bloggers like this: