Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6905561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:11:55+00:00 2026-05-27T08:11:55+00:00

I’m designing a jasper report using iReport which takes a parameter and fetches an

  • 0

I’m designing a jasper report using iReport which takes a parameter and fetches an image from a given URL:

The parameter is a user’s screen name in twitter, and the url is it’s profile image.

    <image>
       <reportElement x="4" y="51" width="73" height="64"/>
           <imageExpression><![CDATA["https://api.twitter.com/1/users/profile_image?screen_name="+$F{user_screen_name}+"&size=bigger"]]></imageExpression>
    </image>

It works great when the image exists. If it doesn’t the following exception is thrown:

    Error filling print... net.sf.jasperreports.engine.JRException: Error opening input stream from URL :
    https://api.twitter.com/1/users/profile_image?screen_name=CPTCurtisHervey&size=bigger 
    Setting up the file resolver... net.sf.jasperreports.engine.JRRuntimeException:
    net.sf.jasperreports.engine.JRException: Error opening input stream from URL :
    https://api.twitter.com/1/users/profile_image?screen_name=CPTCurtisHervey&size=bigger 
    at net.sf.jasperreports.repo.DefaultRepositoryService.getInputStream(DefaultRepositoryService.java:138)
    at net.sf.jasperreports.repo.RepositoryUtil.findInputStream(RepositoryUtil.java:186)     
    at net.sf.jasperreports.repo.RepositoryUtil.getBytes(RepositoryUtil.java:202)
    at net.sf.jasperreports.engine.JRImageRenderer.getInstance(JRImageRenderer.java:141)     
    at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:498)
    at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:441)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:257)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:468)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2037)     
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:761)     
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:291)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:133)     
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:903)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:813)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)
    at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:878)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: 
    net.sf.jasperreports.engine.JRException: Error opening input stream from URL : 
    https://api.twitter.com/1/users/profile_image?screen_name=CPTCurtisHervey&size=bigger     
    at net.sf.jasperreports.engine.util.JRLoader.getInputStream(JRLoader.java:314)
    at net.sf.jasperreports.repo.DefaultRepositoryService.getInputStream(DefaultRepositoryService.java:121)
    ... 19 more Caused by: java.io.FileNotFoundException: 
    https://api.twitter.com/1/users/profile_image?screen_name=CPTCurtisHervey&size=bigger     
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1401)     
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at java.net.URL.openStream(URL.java:1029)     
    at net.sf.jasperreports.engine.util.JRLoader.getInputStream(JRLoader.java:310)... 20 more 
    Print not filled. Try to use an EmptyDataSource...

How can i handle this situation in the jrxml file?

I would like to simply add a fixed URL address in case it can’t find one.

Anyone has any suggestions?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:11:55+00:00Added an answer on May 27, 2026 at 8:11 am

    I think you need to add an additional helper class to handle this. You need a static method boolean urlExists(String url) that would allow you to put this in the imageExpression:

    MyClass.urlExists($F{image_url}) ? $F{image_url} : $P{fallback_image}
    

    It would be a simple class to write… but clearly there’s additional complexity in adding in another .jar file. Without that method, I can’t see any way to do the processing in the .jrxml.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.