Thursday, February 24, 2011

ArcIMS, Tomcat and IReport Issues

Team,
I got a task to create some new IReport Templates. IReports will compile the report template into .jasper files which can be called from a .jsp application. It’s all Java and open source.
 This IReport application was installed on a Windows 2003 Server running ArcIMS 9.2 Build 514.2165, Apache Tomcat 5.5 and JDK 1.5.0_15.  
The first problem I faced was, the reports were blank. In the preview it will work fine. But when the .jsp file calls the .jasper file, only the Header and Footer will show-up but not the detailed data section of the report. I posted the problem in this link.
After researching many links I copied few selected .jar files of the IReport\modules\ext folder to the Tomcat\lib folder then I got this error.
================================================================
ERROR: failed to generate report...
...Error: java.lang.ClassCastException: cannot assign instance of net.sf.jasperreports.engine.base.JRBaseRectangle to field net.sf.jasperreports.engine.base.JRBasePen.penContainer of type net.sf.jasperreports.engine.JRPenContainer in instance of net.sf.jasperreports.engine.base.JRBasePen
================================================================
Again did some more research and I found copying .jar files in the %JAVA_HOME%\jre\lib\ext folder might help? But it didn’t.
The biggest problem was to find the exact .jar files which is required by the IReport latest version 4.0. Whenever I copied the new version .jar files either ArcIMS will break or IReports will not work. IReports latest version 4.0 never worked for me.
Then finally I decided to rollback with an advice of a friend. There was an IReport 1.3.3 version installed on the same server. Once I rolled back to this old version then everything started to work fine.
In conclusion with the existing ArcIMS/Java and Tomcat combination IReport latest version 4.0 will not work.
If I find a workaround I will post back again.

Tuesday, February 8, 2011

Could not load type Pagebase


This error showed up when I uploaded my ASP.NET AJAX enabled website to my IIS Webhosting service provider. I was breaking my head and thinking what went wrong.

I published my application in a sub-folder inside the main root folder.
The new application I was trying to publish was inside a subfolder like www.advancedtechnologyworks.com\PrayerHelp\
I was checking the Web.Config file inside the sub-folder “PrayerHelp” and all was fine.
Then finally I discovered there was another “Web.Config” on the main domain which was causing this issue.
The Web.Config file was like this
<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
       <appSettings/>
       <connectionStrings>
       </connectionStrings>
       <system.web>
              <compilation debug="true" targetFramework="4.0">
              </compilation>
              <authentication mode="Windows"/>
              <pages pageBaseType="PageBase" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
              </pages>
              <anonymousIdentification enabled="true"/>
              <customErrors mode="Off"/>
              <profile enabled="false">
                     <properties>
                           <!-- Available values for the StyleSheetTheme attribute: "Green", "Brown", "Red".-->
                           <add name="StylesheetTheme" defaultValue="Red" allowAnonymous="true"/>
                     </properties>
              </profile>
       </system.web>
</configuration>

I also identified this “PageBase.cs” file was inside the “App_Code” folder in the main domain folder.
I created the same “App_Code” folder inside the sub-folder “PrayerHelp” and copied this “PageBase.cs” file.  Eureka!  Everything started to work.
So when this error shows up, examine all the Web.Config files and see whether there is a reference to a new class file and make sure that class file is placed inside the App_Code folder.
Hope this tip helps someone.


All Blogs so far ...