Recently when I try to generate a report from Jasper server, I got the below error and it took me lot of time to solve. So posting here to help others.
org.postgresql.util.PSQLException: ERROR: transaction is read-only Detail
One of the reason for getting this error is setting wrong Data source. Initially I set the data source as JDBC Driver. After doing all the possibilities , tried to change the data source from JDBC to JDNI, and it was worked successfully. Below are the steps to set JDNI drive on Jasper reporting server.
- Open context.xml file (path is given below in Mac OS X)
- Copy and paste existing resource and edit (given below how to do this)
- Login to the server
- Goto view->repository->public->data source
- Right click Data Sources -> add resource -> Data Source
- Check Type as JNDI data source
- Give appropriate Name, ID and description
- Give service name which specified in context.xml file
- Save the settings by specifying particular location for later use
- Test Connection to check success/failure
in Mac path for context.xml:
Changing resource in context.xml file:
<Resource name="jdbc/jasperserver" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="jasperdb" password="password" driverClassName="org.postgresql.Driver" validationQuery="SELECT 1" testOnBorrow="true" url="jdbc:postgresql://127.0.0.1:5432/jasperserver?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true" factory="com.jaspersoft.jasperserver.tomcat.jndi.JSBasicDataSourceFactory"/>
we need to modify name, username, password and url fields in the resource.
name: This will be used while configuring Dat Source
username: user name of your data base
password: Password of your data base
url: url of your data base.