Reports works in Studio, but not on Server

0

When running a report in jaspersoft studio it succesfully generates a report, with data adapted from a container of a postgres database on a ssh. the server is running as a jaspersoft for docker server on the same ssh.

however, after publishing the report to the jasperserver, when running the report on the server I get the following error trace:

com.jaspersoft.jasperserver.api.JSException: jsexception.error.creating.connection Arguments: at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.JdbcDataSourceService.createConnection(JdbcDataSourceService.java:64) at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.BaseJdbcDataSource.setReportParameterValues(BaseJdbcDataSource.java:49) at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.JdbcDataSourceService.setReportParameterValues(JdbcDataSourceService.java:69) at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:1823) at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runWithDataSource(EngineServiceImpl.java:1169) at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runReport(EngineServiceImpl.java:1051) at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportRunnable.run(EngineServiceImpl.java:946) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at
java.lang.Thread.run(Thread.java:748) Caused by: org.postgresql.util.PSQLException:
    Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:207) at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) at
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136) at
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29) at
org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21) at
org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31) at
org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24) at
org.postgresql.Driver.makeConnection(Driver.java:393) at
org.postgresql.Driver.connect(Driver.java:267) at
java.sql.DriverManager.getConnection(DriverManager.java:664) at
java.sql.DriverManager.getConnection(DriverManager.java:247) at
org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75) at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.JdbcDriverManagerConnectionFactory.createConnection(JdbcDriverManagerConnectionFactory.java:36) at
org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148) at
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106) at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.TibcoDriverManagerImpl.unlockConnection(TibcoDriverManagerImpl.java:68) at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.JdbcDataSourceService.createConnection(JdbcDataSourceService.java:56)
 ... 9 more Caused by: java.net.ConnectException: Connection refused (Connection refused) at
java.net.PlainSocketImpl.socketConnect(Native Method) at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at
java.net.Socket.connect(Socket.java:589) at
java.net.Socket.connect(Socket.java:538) at
org.postgresql.core.PGStream.<init>(PGStream.java:60) at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:101)
 ... 26 more

any ideas what the problem is? and is there a way to see what the remaining 26 errors are?

I've used the jaspersoft for docker from https://github.com/TIBCOSoftware/JS-Docker
and the datasource is from: https://github.com/docker-library/postgres

the connection of the containers in the ssh:

mit.navn.marcus's picture
Joined: Oct 4 2018 - 1:10am
Last seen: 8 months 2 weeks ago

4 Answers:

2

> Caused by: java.net.ConnectException: Connection refused (Connection refused) at

This seems to suggest there's a problem with connecting to your postgresql from JasperReports Server. Have you tried testing the data source from JasperReports Server to make sure the connection is good. In the Data Source page, select "Test Connection".

https://community.jaspersoft.com/documentation/tibco-jasperreports-serve...

hozawa's picture
44219
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 month 6 days ago
0

Edit the published report and select proper database (which you have created in your server). OR 

Select proper database in Jasper studio while publishing to Jasper server.

If still not able to connect to db, restart your Jasperserver service and your connected db.

 

miwagada's picture
Joined: Nov 23 2015 - 1:32am
Last seen: 5 months 2 weeks ago
0

@miwagada Thanks for your answer, I have the report on the server connected to the correct database (since it works on jaspersoft studio) my problem is that when I run the report on the server I get the mentioned error trace.

 edited original post for more clear language. 

mit.navn.marcus's picture
Joined: Oct 4 2018 - 1:10am
Last seen: 8 months 2 weeks ago
0

Hello and thanks for your accurate answer @hozawa (I wasn't aware of being able to add data sources so this helped me a lot)

it indeed seems like on my dockerized jaspersoft server I can't get a connection to my dockerized datasource. However if I run the standard jasperreport server service (from https://community.jaspersoft.com/project/jasperreports-server/releases ) and use the same parameters I can get a connection to my dockerised data source. So the problem must be in how I've made my dockerised jasperreport server.

Do you have any idea what it might possibly be?

mit.navn.marcus's picture
Joined: Oct 4 2018 - 1:10am
Last seen: 8 months 2 weeks ago
Feedback
randomness