Jump to content
We've recently updated our Privacy Statement, available here ×

Image not displayed in HTML View


rakeshenoch

Recommended Posts

Hi All,

I have an application which renders jasper reports as HTML view (default). There are others view available like PDF, RTF and XLS in the application. All my reports use a logo image and the path for which is provided by a parameter $P{LogoPath} of type String (I supply the url). The problem I'm facing is that the logo image is not visible in the HTML view, whereas in other views the logo image is visible. The exception I get when viewing HTML view is attached below

Nov 17, 2009 2:58:38 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet ImageServlet threw exception
javax.servlet.ServletException: No JasperPrint documents found on the HTTP session.
    at net.sf.jasperreports.j2ee.servlets.ImageServlet.service(ImageServlet.java:93)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:619)

For your information I have also registered ImageServlet in web.xml as

<servlet>
        <servlet-name>ImageServlet</servlet-name>
        <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ImageServlet</servlet-name>
        <url-pattern>/servlets/image</url-pattern>
    </servlet-mapping>

Thanks in advance,

Rakesh

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Hi Rakesh ,

Did you find a solution to this issue?  I was facing the same issue..It will be great if you can gv suggestion. I'm using Jasper-pro 3.5 and trying to get the report through webservice. Im able to generate the report in html format. but the chart(image) is not appearing. The chart is displaying when the report is run on jasper server directly.

 

Any suggestions will be appreciated.

Thank you,

Vandana

Link to comment
Share on other sites

Hi Vandana,

If I have understood your problem your problem correctly, then I have two suggestions for you.

  • I hope you have registered your ImageServlet in web.xml

<servlet>
        <servlet-name>ImageServlet</servlet-name>
        <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ImageServlet</servlet-name>
        <url-pattern>/servlets/image</url-pattern>
    </servlet-mapping>

  • Secondly, the JasperPrint object created after filling the report must be available in the session object. You can do this as mentioned below.

JasperPrint jasperPrint = JasperFillManager.fillReport(jreport, paramHashMap, connection);
request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "servlets/image?image=");

Hope this helps you.

Link to comment
Share on other sites

  • 11 months later...

Hi,

rakeshenoch
Wrote:

Hi Vandana,

If I have understood your problem your problem correctly, then I have two suggestions for you.

  • I hope you have registered your ImageServlet in web.xml

<servlet>
        <servlet-name>ImageServlet</servlet-name>
        <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ImageServlet</servlet-name>
        <url-pattern>/servlets/image</url-pattern>
    </servlet-mapping>

  • Secondly, the JasperPrint object created after filling the report must be available in the session object. You can do this as mentioned below.

JasperPrint jasperPrint = JasperFillManager.fillReport(jreport, paramHashMap, connection);
request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "servlets/image?image=");

Hope this helps you.

 

I use all this, but, since I update to 3.6.7, it doesn't work!!

Link to comment
Share on other sites

  • 2 years later...

Hi Idcl289,

I at first also facing the problem that you are facing.

I solved mine by changing the struts.xml. 

It is configuration problem in my case. 

I added this line 

<constant name="struts.action.excludePattern" value="/servlets/images*"/>

Hope it helps.

Elaine

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...