Help save net neutrality! Learn more.
Close

Tomcat Error configuring application listener

Help
2011-07-13
2012-10-10
  • Bahman Movaqar

    Bahman Movaqar - 2011-07-13

    Hi again,

    I'm not sure if my problem is related to JasperReports-JSF or Tomcat but I'd
    like to know what you folks think.

    I have a JSF2.0+JPA2.0 (Java EE 6 Web) project running in Tomcat 7. When I add
    the JAR files from lib/ directory of JR-JSF archive, Tomcat refuses to deploy
    the application. Below is the Tomcat log:

    Jul 14, 2011 3:17:03 AM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Error configuring application listener of class 
                net.sf.jasperreports.jsf.config.ConfigurationStartupListener
    
    java.lang.ClassNotFoundException: 
                net.sf.jasperreports.jsf.config.ConfigurationStartupListener
    
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
        at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
        at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
    

    I know that JR-JSF doesn't work with JSF2 yet but the stacktrace makes me
    think that there is some other issue rather than JSF2; perhaps a silly deploy
    mistake on my side? Please let me know if you need more information to crack
    this error.

    I'd appreciate any help/idea. TIA.

    PS: Using 1.0-beta4

    --
    Bahman

     
  • Alonso Dominguez

    Well, last JR-JSF beta version should work better with JSF2 than previous ones
    since now plugin's lifecycle has been aligned with JSF lifecycle.

    Anyway, as you've stated, this is not an issue related with JSF2 but a class
    loading one. It looks too weird since if Tomcat tried to load
    net.sf.jasperreports.jsf.config.ConfigurationStartupListener class it's
    because it could load the tag library definition bundled with the JAR file
    (it's there where that listener is configured).

    To help me understand the issue, would you be so kind to post here snippets
    from your web.xml and a list of the dependecies packaged with your WAR file?

    Regards,
    Alonso

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-07-14

    Hi there Alonso,

    My web.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="[url]http://java.sun.com/xml/ns/javaee[/url]" xmlns:xsi="[url]http://www.w3.org/2001/XMLSchema-instance[/url]" xsi:schemaLocation="[url]http://java.sun.com/xml/ns/javaee[/url] [url]http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd[/url]">
        <context-param>
            <param-name>javax.faces.PROJECT_STAGE</param-name>
            <param-value>Development</param-value>
        </context-param>
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>faces/index.xhtml</welcome-file>
        </welcome-file-list>
        <context-param>   
            <param-name>primefaces.THEME</param-name>
            <param-value>humanity</param-value> 
        </context-param>
    </web-app>
    

    Project dependencies:
    JSF 2.0
    JSTL 1.1
    EclipseLink 2.3.0
    Primefaces 2.2.1
    Derby JDBC driver
    jasperreports-jsf-1.0-beta-4.jar
    bcmail-jdk14-1.38.jar
    bcprov-jdk14-1.38.jar
    commons-beanutils-1.8.0.jar
    commons-collections-2.1.jar
    commons-digester-1.7.jar
    commons-io-1.3.jar
    itext-2.1.7.jar
    jasperreports-3.7.1.jar
    jxl-2.6.jar
    xml-apis-1.3.02.jar

    One thing that might be connected to this: when I add the JR-JSF namespace to
    index.xhtml NetBeans complains that "No library found for this namespace".

    --
    Bahman

     
  • Alonso Dominguez

    Thanks for the information, I was expecting you having configured the TLD file
    at web.xml but your last paragraph gave me the clue!

    I found a mistake in project's documentation. Tag library has changed from
    previous beta versions, new namespace should be:

    [url]http://jasperreportjsf.sf.net/tld/jasperreports-jsf-1_2.tld[/url]
    

    Will have the "getting started" page updated as soon as possible. Sorry again
    for this.
    Regards,
    Alonso

     
  • Alonso Dominguez

    mmm, well, last statement should fix the problem about netbeans blaming the
    missed namespace, but having a more deep thought, the missed class should be
    loaded anyway since jar file is in the classpath!

     
  • Alonso Dominguez

    Hi Bahman,

    By any means I try to reproduce the problem I can't get it. I tried to startup
    a Tomcat 7 with JSF 2.0, Spring 3.0.0 and Hibernate 3.5.x and mine seems to
    start perfectly (I just mean start, as you know support for JSF 2.0 is beyond
    this current version and should be considered experimental). Anyway, I can
    read following message at Tomcat log files:

    JRJSF_0023: JasperReports JSF Plugin initialized.
    

    I would like to have a follow up about this issue, did you get any further or
    still stuck at the same problem?

    Alonso

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-07-15

    Greetings Alonso,

    Now I'm back at my laptop (had a short weekend journey).

    Thanks for the update on tag library it fixed the NetBeans errors. But no more
    luck. I thought it might be my project configuration or some configuration
    problem with Tomcat; so created a new JSF2.0 project without JPA or any other
    library, added JR-JSF libraries to the project and tried to run it on Tomcat
    and the same happened.

    Now comes the funny part: I even created a JSF1.2 project, added JR-JSF
    libraries to the project and it didn't deploy either! I also tried with
    copying JR-JSF jar file to Tomcat lib/ but no luck. And creating projects with
    different Java EE versions (5 or 6) made no difference.

    At least now we can be sure it's not related to JSF version at all :-)

    --
    Bahman

     
  • Alonso Dominguez

    Yep, it's not about JSF version... I tried a new deployment with less
    dependencies on Tomcat 7 and faced the same issue whilst deploying same
    artefact at Tomcat 6 worked !! Can't understand a so weird behaviour...

    I filed a bug about this in Tomcat's bug database, hope receive a response
    soon:
    https://issues.apache.org/bugzilla/show_bug.cgi?id=51523

    Sorry for not being able to give more help about this...

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-07-18

    Greetings Alonso,

    I'll monitor the issue you just filed. Thank you for your time and patience.

    --
    Bahman

     
  • Alonso Dominguez

    After some discussion about this issue with the guy from Tomcat development
    team I eventually acknowledged the issue, I filed a bug in SF's database which
    can be found at URL:
    https://sourceforge.net/tracker/index.php?func=detail&aid=3371793&group_id=21
    2447&atid=1021785

    By the way, I also solved the mistake at the documentation in page "Getting
    Started" and the broken link to the TLD Documentation.

    P.S.: I'll avoid make any comments about how Tomcat deals with TLD definitions
    from version 7 and later... ;)

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-07-20

    Thanks for your efforts.

    I noticed that the issue is now fixed and closed. Is it applied to 1.0-beta4
    too or just to the trunk?

    --
    Bahman

     
  • Alonso Dominguez

    Since it was a very annoying issue that prevented the library to properly work
    I applied the patch to 1.0-beta-4 branch and trunk. So current download for
    1.0-beta-4 should work. Haven't commited changes in SVN though 'cos I did the
    fix late at home and forgot that step, it will be updated as soon as possible.

    Regards,
    Alonso

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-07-20

    Tested the new binary (beta4) and it deploys alright. Thank you.

    --
    Bahman

     

Log in to post a comment.