Home > GLASSFISH / J2EE / JAVA PERFORMANCE > IReport / Jasper Reports – Configure Jasper Report Server on Glassfish 2.1

IReport / Jasper Reports – Configure Jasper Report Server on Glassfish 2.1


While installing the performance reporting package that i worked on last month (mysql, jmeter, jasperserver, ireport), i encountered several problems in the last phase, when i was trying to deploy the Jasper Report Server under Glassfish Application Server 2.1

Now, according to the documentation that Jasper Server comes with, things should be pretty simple, and everything should work out of the box, by running some preconfigured ant scripts, and modifying some configuration files for database access. Well, as usual, things were a little harder than the nice pdf document was describing.

  1. Problem number 1: When trying to deploy Jasperserver.war using “js-ant deploy-webapp-ce”, as described in the documentation, the installer halts
    After “excavating” all configuration files, and log files, i still haven’t found a solution to that. It just hangs, and i have to close my ssh session. That made me give up installing this way, and made me turn to installing the Jasperserver.war file directly from the Glassfish Admin Console. That takes us to problem number 2.
  2. Problem number 2: JasperServer and Glassfish 2.1 conflict in commons-logging.jar
    The problem appears after having configured all database information according to the documentation, and trying to deploy the war file from the Glassfish Admin Console. Although the application looks like it was deployed, calling it will return a server error.
    Digging the glassfish log files, will reveal the following conflict: 

    [#|2009-09-30T12:52:26.718+0200|SEVERE|sun-appserver2.1|javax.enterprise.system.container.web|_ThreadID=24;_ThreadName=Thread-167;_RequestID=593b93d9-2a16-49d0-a728-05c3427502b4;|WebModule[/jasperserver]PWC1257: Error configuring application listener of class com.jaspersoft.jasperserver.war.util.SecurityContextHolderStrategyInitializer
    java.lang.ExceptionInInitializerError
    ………
    Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1517f9b for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Priority) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1517f9b for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Priority))
    .........
    Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1517f9b for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Priority)
    ........
    Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority

    Now, this remembered me about a conflict i had when we were trying to deploy our application over a Glassfish 2.1, in a SUSE distribution. Guess what? The very same logging problem.
    That made me try deploying with the commons-logging-1.1.1.jar, which if i am not mistaking, is the library used for load balancing with mod_jk (see my other article on this subject) The thing to do here is to replace the /opt/glassfish/lib/commons-logging.jar with commons-logging-1.1.1.jar
    Now try deploying again, and see if you get the same messages. In the worse case scenario, restart your glassfish domain.

  3. Problem number 3: JasperServer JDBC Resources and Connection Pools are not configured

    java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource [See nested exception: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource]] 

    Well, this should be solved by the automatic installer (see problem1). But as you remember, that does not work. Now, some words come into my mind from my very first System Administrator: RTFM !

    Now, by carefully reading the documentation once again, you will notice the chapter 6, called “Additional Installation Information”. Head to subchapter 6.8, “Notes on Database connection for Glassfish”. Quoting the documentation provided by JasperServer people now:
    “To deploy the datasource definition manually, you can run a command similar to the following:
    asadmin add-resources “<js-install>/buildomatic/build_conf/default/js-glassfish-ds.xml”

    That’s right, this small piece of script will add all JDBC Pools and resources needed by JasperServer. Just make sure to configure them right from the beginning

  4. Problem number 4: MYSQL Connection Library Missing
    Wrong class name or classpath for Datasource Object
    java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
     

    This one is pretty simple, but took me a little while to find it. The problem resides in the fact that after creating a new domain (instead of the default domain1), my Mysql connector library wasn’t there anymore. Now i don’t really know if the installer copies the required libraries in the right folders, but i just supposed that it didn’t (no more time to research now). Therefore, i called my old pal, “Mr. Workaround”.

    Solution: i copied the mysql connector library into ./domains/reporting/lib/ext/mysql-connector-java-5.1.5.jar, where “reporting” is the name of my glassfish domain.

     

Now you are ready to deploy your jasperserver war file once more. Follow the glassfish log files at all times, they will give you precious information back.

That’s it. Things should work now, and i should be going back to my stuff. Hope somebody will make use of this. I surely researched a lot for solving all these problems.

Cheers,

Alex

About these ads
  1. No comments yet.
  1. No trackbacks yet.

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: