Tuesday, March 25, 2014

How to configure JDNI in Japser Reporting Server on Mac!!!


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.
  1. Open context.xml file (path is given below in Mac OS X)
  2. Copy and paste existing resource and edit (given below how to do this) 
  3. Login to the server
  4. Goto view->repository->public->data source
  5. Right click Data Sources -> add resource -> Data Source
  6. Check Type as JNDI data source
  7. Give appropriate Name, ID and description 
  8. Give service name which specified in context.xml file
  9. Save the settings by specifying particular location for later use
  10. Test Connection to check success/failure


in Mac path for context.xml:
/Applications/jasperreports-server-5.5/apache-tomcat/webapps/jasperserver-pro/META-INF/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.

Happy Reading!!!


No comments:

Popular Posts