Jump to content
We've recently updated our Privacy Statement, available here ×

Problem with JDBC Datasource


mpenningroth

Recommended Posts

I have a jdbc datasource that works fine with iReport, but when I use the datasource in jasperserver, the connection fails. The driver is available to tomcat etc.

 

If I use a jndi resource defined for the same jdbc datasource, it works fine.

 

The jdbc driver is not from a standard database, I wonder if there are other options that can be set.

 

Here is my stack trace:

Caused by: java.util.NoSuchElementException: Could not create a validated object

at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:851)

at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)

... 89 more

14:14:51,468 ERROR JSErrorPage_jsp,http-8080-Processor23:146 -

java.util.NoSuchElementException: Could not create a validated object

at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:851)

at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)

at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.JdbcDataSourceService.createConnection(JdbcDataSourceService.java:58)

at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.BaseJdbcDataSource.setReportParameterValues(BaseJdbcDataSource.java:52)

at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.JdbcDataSourceService.setReportParameterValues(JdbcDataSourceService.java:66)

at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:556)

at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:314)

at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.executeReport(EngineServiceImpl.java:686)

at com.jaspersoft.jasperserver.api.engine.jasperreports.domain.impl.ReportUnitRequest.execute(ReportUnitRequest.java:60)

at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.execute(EngineServiceImpl.java:248)

at com.jaspersoft.jasperserver.war.action.ViewReportAction.verifyData(ViewReportAction.java:110)

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

When you define a JDBC data source in JS, a connection pool managed by Apache Commons DBCP is created. It looks like this driver is not compatible in some way with what DBCP expects.

 

Mark, have you tried creating a JNDI data source using the same driver and using that for your report data source?

 

 

Sherman

JasperSoft

Link to comment
Share on other sites

Shermann,

Yes the jndi works fine. I am sure that the jadb driver in question does not support the javax extensions for connection pooling. (It has its own pooling with a different interface.) I guess I was wondering if DBCP has options that can be set on a driver specific case that would allow it to work. I know that several middle tier servers implement their own pooling on top of drivers that do not directly support connection pooling. (jndi for one...).

Regards,

Mark

Link to comment
Share on other sites

In looking at the DBCP documentation and some Google links, there maybe an issue with auto commit, read only and transaction isolation settings. Does your driver use these settings? Or are they not implemented?

 

 

Sherman

JasperSoft

Link to comment
Share on other sites

Shermann,

The problem was the readOnly settings. Our database doesn't really support a readOnly connection and since we support methods, we really couldn't easily enforce it from the jdbc api.

I rebuilt our driver as a test, and when I don't throw an exception when attempting to set the connection as readonly, the jdbc connection worked fine.

Thanks,

Mark

Link to comment
Share on other sites

After reading the dubious jdbc specification, the setReadOnly method is just a hint to the database and does not mean that the transaction is prevented from updating the database. I went ahead and modified our jdbc driver to pretty much treat the setReadOnly method as a no-op.
Link to comment
Share on other sites

  • 1 year later...

Mpenningroth wrote:

  • I have a jdbc datasource that works fine with iReport, but when I use the datasource in jasperserver, the connection fails.  The driver is available to tomcat etc.

I am finding this also.  I am running a separate standalone installation of iReport 3.0.0, and I installed JasperServer 3.0.  I defined a JDBC data source in iReport, and tested it.  It succeeds.

Notice in the URL that it uses a non-standard (for MS SQL Server) port number.  It took me a while to find that, and until I got that right, of course I couldn't connect.  Once I found out the actual port number, the connection worked from within iReport.

However, from JasperServer, using the same definition, the test fails.  Unfortunately, I haven't figured out how to get the error messages from a failure within JasperServer or tomcat or apache or wherever the error be.  Tomcat is running...

Does anyone have a clue why it would succeed from iReport and fail from JasperServer, on the same machine?

  • If I use a jndi resource defined for the same jdbc datasource, it works fine.

What is a jndi resource?  Would use of this help me?

Thanks,

René

 

 

UPDATE, 12 November 2008:  I do now have this working on for both my desktop JasperServer and iReport, but not on the JasperServer that I have installed on the machine which actually holds the SQL Server installation referenced...  Curious...

 

So why is that I can define a JDBC data source for JasperServer running on my desktop, pointing to a SQL Server machine, but on the SQL Server machine itself, where I have set up Tomcat and MySQL as services, andJasperServer is running, I am not able to connect to the local SQL Server upon performaing a test of the data source...

 

Code:


Post Edited by René Valencourt at 11/12/08 21:03
Link to comment
Share on other sites

I found that placing the sqljdbc.jar file in C:\Program Files\JasperSoft\jasperserver-3.0\java\jre\lib\ext solved the problem. However, I would rather not proliferate the driver file if it not be required. Is there a classpath variable somewhere that I should set to point to the primary location of the sqljdbc.jar file?



Post Edited by PlexPro at 10/12/2009 20:21
Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...