Oddities of running JasperReports with Weblogic 9.2 on Windows

I posted this on the JasperReports forums but wanted also to put it here in case it helps someone out (since I have my Java topic going to the Java Blogs aggregator.

At work I am currently using Weblogic 9.2 running on Windows XP for web application development.  I am also using MyEclipse 6.5 to code and deploy to the Weblogic deployment.  We have also been using JasperReports since version 2.0.5.

For several months I had not been using Windows XP but a Mac. I had to switch due to work rules and just ran into a problem lately where I have not been able to run any reports.   This problem has not been happening on our Linux servers or workstations nor was it happening on the Mac.  The problem was when trying to load a report the application would throw the following exception:

java.lang.NullPointerException
at net.sf.jasperreports.engine.JRPropertiesMap.readObject(JRPropertiesMap.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
Truncated. see log file for complete stacktrace

I had seen this problem once before when trying to run a compiled report that was compiled with version 2 of the library on a server running version 3 of the library.  A class loading issue was the obvious cause but I couldn’t figure out why in this case because our system has been running JasperReports 3 for awhile now and I hadn’t gone back to version 2 so what was the problem.

Lucian pointed out that in version 3 I shouldn’t be getting this error because the sources for 3.0.1 don’t correspond to the error.  He said it looked like an older version and suggested finding out where the JRPropertiesMap class was being loaded from with:

System.out.println(JRPropertiesMap.class.getPackage().getImplementationVersion());

or

System.out.println(JRPropertiesMap.class.getResource("/net/sf/jasperreports/engine/JRPropertiesMap.class"));

The first call reported that I was in fact using JRPropertiesMap from version 2.0.5 of JasperReports.  Huh?  I haven’t been deploying Jasper 2.05 for ages.  We switched to version 3.0.1 awhile back.  I looked in my build paths for the various modules and only 3.0.1 was there and it was the only version of JasperReports in APP-INF/lib in the deployment.  Where was 2.0.5 coming from?

The second call above located the problem for me.   Weblogic caches things in your domain and it was caching, and loading, Jasper 2.0.5. In fact I had 4 versions of the library in there: 2.0.5, 3.0,3.0.1, and 3.1.0. On my system this location is located at “C:/opt/bea/user_projects/domains/f58_domain/servers/AdminServer/tmp/_WL_user/_appsdir_rocketscienceApp_dir/r6vnzf/APP-INF/lib/”.

Problem solved but I really don’t get what is going on here because it has been months since I deployed 2.0.5 with the application and the Windows XP machine I’m using now is brand new with a new install of WebLogic.  I copied over my workspace from the Mac and maybe thats where the problem started but I still find that improbable since a coworker, who’s on Vista, is also having the same problem.    Only the Windows boxes are having the problem.

Very odd indeed but at least I won’t be losing any more hair over this one.

Thanks again to Lucian for pointing me in the right direction!

3 thoughts on “Oddities of running JasperReports with Weblogic 9.2 on Windows

  1. Hey thanks for the post! Identified the same error on a project I’m working on. Your post help me identify it as a version issue, I upgraded, and that fixed it. Probably saved me a few hours of pulling my hair out!

    Like

  2. Wow. Glad I found this post. I’ve been experiencing the same problem for almost a week now. Thanks a lot!

    Like

  3. Gian-

    Glad I could help you. I actually just ran into this problem again the other day however I knew to look at the JARs before trying to run the app and removed the offending ones (this time jars that ship with Jasper for JFreeChart).

    Just totally nutty stuff.

    Like

Comments are closed.

%d bloggers like this: