jdbc source requires a driverClassName value

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

    Bahman Movaqar - 2011-07-23

    Hi all,

    I'm trying to run a simple report using the following snippet:

    <span jsfc="jr:reportLink" value="Report">
        <jr:reportFrame value="/reports/productCategory.jasper" format="pdf">
            <jr:source id="jdbcSource" type="jdbc" value="jdbc:derby://localhost:1527/jsftest1">
                <f:attribute name="driverClassName" value="org.apache.derby.jdbc.ClientDriver" />
                <f:attribute name="username" value="jsf"/>
                <f:attribute name="password" value="123"/>
            </jr:source>
        </jr:reportFrame>
    </span>
    

    But when navigating to the page I get:

    WARNING: net.sf.jasperreports.jsf.engine.converters.InvalidDatabaseDriverException: jdbc report source type requires a driverClassName value!
    net.sf.jasperreports.jsf.convert.ConverterException: net.sf.jasperreports.jsf.engine.converters.InvalidDatabaseDriverException: jdbc report source type requires a driverClassName value!
        at net.sf.jasperreports.jsf.engine.converters.SourceConverterBase.convertFromValue(SourceConverterBase.java:95)
        at net.sf.jasperreports.jsf.component.UISource.decodeValue(UISource.java:383)
        at net.sf.jasperreports.jsf.component.UISource.processDecodes(UISource.java:335)
        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1047)
        at net.sf.jasperreports.jsf.component.UIReport.processDecodes(UIReport.java:425)
        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1047)
        at net.sf.jasperreports.jsf.component.UIReport.processDecodes(UIReport.java:425)
        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1047)
        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1047)
        at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:926)
        at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
        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)
    Caused by: net.sf.jasperreports.jsf.engine.converters.InvalidDatabaseDriverException: jdbc report source type requires a driverClassName value!
        at net.sf.jasperreports.jsf.engine.converters.JdbcSourceConverter.getConnection(JdbcSourceConverter.java:72)
        at net.sf.jasperreports.jsf.engine.converters.DatabaseSourceConverter.createSource(DatabaseSourceConverter.java:65)
        at net.sf.jasperreports.jsf.engine.converters.SourceConverterBase.resolveSource(SourceConverterBase.java:160)
        at net.sf.jasperreports.jsf.engine.converters.SourceConverterBase.convertFromValue(SourceConverterBase.java:93)
    

    It's a simple JSF2 + JPA2 application running on Tomcat 7. Let me know if you
    need any more information.

    TIA,

    --
    Bahman

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-07-23

    I forgot to add that Derby JDBC driver is in the classpath and is bundled
    with WAR file.

    --
    Bahman

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-07-23

    I tried the following (inspired by
    net.sf.jasperreports.jsf.engine.converters.JdbcSourceConverter):

    <jr:reportFrame value="/reports/productCategory.jasper" format="pdf"
                    width="100%" height="300px">
        <jr:source id="reportSource" type="jdbc" value="jdbc:derby://localhost:1527/jsftest1">
            <f:attribute name="net.sf.jasperreports.jsf.jdbc.driverClassName" value="org.apache.derby.jdbc.ClientDriver"/>
            <f:attribute name="net.sf.jasperreports.jsf.jdbc.username" value="jsf"/>
            <f:attribute name="net.sf.jasperreports.jsf.jdbc.password" value="123"/>
        </jr:source>
    </jr:reportFrame>
    

    There were no exceptions in Tomcat logs but I get a NPE in the report's
    iframe:

    java.lang.NullPointerException
        at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:134)
        at net.sf.jasperreports.jsf.engine.fill.DefaultFiller.doFill(DefaultFiller.java:132)
        at net.sf.jasperreports.jsf.engine.fill.DefaultFiller.fill(DefaultFiller.java:90)
        at net.sf.jasperreports.jsf.renderkit.ReportRenderer.encodeContent(ReportRenderer.java:85)
        at net.sf.jasperreports.jsf.component.UIOutputReport.encodeContent(UIOutputReport.java:122)
        at net.sf.jasperreports.jsf.lifecycle.RenderResponsePhaseListener.invokeContextCallback(RenderResponsePhaseListener.java:134)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1290)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:677)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1299)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:677)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1299)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:677)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1299)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:677)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1299)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:677)
        at net.sf.jasperreports.jsf.lifecycle.RenderResponsePhaseListener.beforePhase(RenderResponsePhaseListener.java:106)
        at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
        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)
    

    Not that this is the documented approach or anything. I just wanted to share
    my findings :-)

    --
    Bahman

     
  • Alonso Dominguez

    Thanks a lot for your efforts with the plugin and for the very useful feedback
    you're providing. My apologies for the headaches you're suffering caused by my
    lack of testing with this last release, I have no excuse, just wanted to say
    that after almost a year rewritting the whole plugin I wanted to get release
    it and receive feedback as soon as possible... didn't expect these stupid
    mistakes though...

    1. About the "jdbc source converter": Can't remember exactly what went through my mind when I decided to change the attribute names from "driverClassName" to "net.sf.jasperreports.jsf.driverClassName" (and so on), but realized that the latter is more cumbersome than the former, will switch it back to the previous form as I think it's more straightforward and it aligns with what documentation says.

    2. The NPE you're getting when filling the report contents is a bug when resolving the report converter during the DECODE_VALES jsf lifecycle's phase. I filed an bug report at SF's page and later today will have a new package file available for download (svn has been already updated at 1.0-beta-4 branch). This is the link to the bug report:
      https://sourceforge.net/tracker/?func=detail&aid=3376622&group_id=212447&atid
      =1021785

    kind regards and sorry for the inconvenience
    Alonso

     
  • Bahman Movaqar

    Bahman Movaqar - 2011-07-24

    re early release: sometimes it's the best strategy (been there, didn't do
    that, regret it now!) and it's no problem for me since you're quite fast-
    feedback :-)

    re attribute name: certainly 'driverClassName' is much easier to type and
    remember than the other one.

    re NPE: thanks for the fix. Eager to test it.

    re bug report: thanks for filing a report. The reason I didn't do so was that
    I was afraid it was just a silly mistake on my side. To lighten your work,
    just confirm my problem is a bug and I'll do the filing :-)

    --
    Bahman

     
  • Alonso Dominguez

    hate the fact of being releasing rubbish code, but i've been quite busy at job
    and also would like to end up with a stable release of this plugin too, since
    this is unpaid effort find oneself short of time to go through all the project
    management steps. As I said, I have no excuse, one thing is unexpected
    behaviour with "experimental features", other thing is the fact the core
    behaviour doesn't works... shame on me.... Anyway, I like to give always a
    fast response to any enquiry, I know how onself feels when working with stuff
    that promises to do "magic" (and it doesn't) and with lack of support (or slow
    feedback)...

    Back to the point: I closed the issue since I added a new test case that
    proves it to work, if you could be so kind (as you have been till now) to test
    it and provide feedback it would be great. If it doesn't work I'll reopen the
    issue again.

    let you know that I switched back the names for the JDBC source converter to
    the ones showed in documentation, I agree that this way is easier to do client
    code and the chance for a name conflict when developing is quite remote.

    If you continue to find unexpected behaviour when using the plugin you can
    file a bug report or just ask at the forums. If an invalid bug is reported
    it's no problem for me to close it as "INVALID" (providing a description) as
    well as It's no problem for me to create a bug report linked to a forum
    thread. The important thing is to have issues documented in some sort of way
    and, in this case, I could add more information to the bug report after
    researching from your findings ;)

    Hope you can go through all this painful beta-testing and find the plugin as
    an useful tool (even though it's a beta version). Thanks to people like you is
    easier (and quicker) to improve the code and end up with a stable final
    release (which I hope to get soon).

    Alonso

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks