Wednesday 13 November 2013

Resolving NameAlreadyBoundException in Jasper

If you are running multiple instances of JasperReports Server v5.x in same machine we may encountered this NameAlreadyBoundException 10990 exception.

Root cause is


Caused by: java.io.IOException: Cannot bind to URL
[rmi://localhost:10990/jasperserver]:
javax.naming.NameAlreadyBoundException: jasperserver [Root exception is
java.rmi.AlreadyBoundException: jasperserver]
at javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:826)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:431)
at org.springframework.jmx.support.ConnectorServerFactoryBean.afterPropertiesSet(ConnectorServerFactoryBean.java:187)
at
 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at
 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 26 more
Caused by: javax.naming.NameAlreadyBoundException: jasperserver [Root exception is java.rmi.AlreadyBoundException: jasperserver]
at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:139)
at com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:226)
at javax.naming.InitialContext.bind(InitialContext.java:419)
at javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:643)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:426)
... 29 more
Caused by: java.rmi.AlreadyBoundException: jasperserver
at sun.rmi.registry.RegistryImpl.bind(RegistryImpl.java:153)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)



Solution for above is 

On one of the instances,

Change the port number on ../jasperserver-pro/WEB-INF/js.diagnostic.properties

Change the default diagnostic port 10990 to 10991(or some thing like 10992,10993).

Now you have one instance running on port 10990 and another running on port 10991.

Database Remote Access

Remote Access of DataBase in Different Host by use of following comment


mysql > GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' IDENTIFIED BY ‘PASSWORD’;

Example :
mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY ‘root’;

above command gives access for all privileges. we can grand specific privilege also.


1. Select permission

mysql> GRANT SELECT ON *.* TO 'USERNAME'@'%' IDENTIFIED BY ‘PASSWORD’;

2. Select and update permission

mysql> GRANT SELECT,UPDATE ON *.* TO 'USERNAME'@'%'  IDENTIFIED BY ‘PASSWORD’;