Bug 663608

Summary: Editing 'JBoss AS Datasources' group configuration > 'Connection Property' with blank value gives 'HTTP Status 500' and also don't allow any other operations
Product: [Other] RHQ Project Reporter: Rajan Timaniya <rtimaniy>
Component: ConfigurationAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED NOTABUG QA Contact: Corey Welton <cwelton>
Severity: medium Docs Contact:
Priority: low    
Version: 4.0.0CC: lkrejci
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-17 10:41:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 616081, 663377    
Attachments:
Description Flags
server log
none
screenshot none

Description Rajan Timaniya 2010-12-16 11:29:43 UTC
Created attachment 469120 [details]
server log

Description of problem:
Editing 'JBoss AS Datasources' group configuration > 'Connection Property' with blank value gives 'HTTP Status 500' and also don't allow any other operations.

2010-12-16 16:00:08,075 WARN  [org.jboss.resource.adapter.jms.inflow.JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@4c0833c9(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@49186b0b destination=queue/AlertConditionQueue isTopic=false tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5)
org.jboss.mq.SpyJMSException: Asynchronous close from server.; - nested throwable: (java.io.IOException: Close request from the server or transport layer.)
	at org.jboss.mq.SpyJMSException.getAsJMSException(SpyJMSException.java:72)
...
2010-12-16 16:00:10,062 ERROR [org.quartz.impl.jdbcjobstore.JobStoreCMT] MisfireHandler: Error handling misfires: Failed to obtain DB connection from data source 'NoTxRHQDS': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/NoTxRHQDS' javax.naming.NameNotFoundException: NoTxRHQDS not bound
org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'NoTxRHQDS': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/NoTxRHQDS' javax.naming.NameNotFoundException: NoTxRHQDS not bound [See nested exception: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/NoTxRHQDS' javax.naming.NameNotFoundException: NoTxRHQDS not bound]
	at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:167)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3108)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3887)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3907)
Caused by: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/NoTxRHQDS' javax.naming.NameNotFoundException: NoTxRHQDS not bound
	at org.quartz.utils.JNDIConnectionProvider.getConnection(JNDIConnectionProvider.java:166)
	at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:112)
	at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:164)
	... 3 more
2010-12-16 16:00:10,095 WARN  [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.postgresql.util.PSQLException: FATAL: database "null" does not exist)
...

Version-Release number of selected component (if applicable):
JON-2.4.1 build #42 (build number: 10963:0a53ca3)

How reproducible:
Always

Steps to Reproduce:
1) Create a group of JBoss AS Datasources with at least 2 members
2) Navigate group -> configuration
3) Edit 'Connection Property' (select property for edit which has value for one resource and no-value (null) for other resource)
   NoTxRHQDS > Char.encoding=UTF-8
   RHQDS > Char.endoding=
4) Unset property value which has value, click on 'OK' and 'Save'
  
Actual results:
JON-Server shows 'HTTP Status 500' and also don't allow any other operations.

Expected results:
JON-Server should not give 'HTTP Status 500' and not stop any operation. If 'Connection Property' doesn't allow blank value then system should give user error message.

Additional info:
Please refer attached files for server log and screenshot.

Comment 1 Rajan Timaniya 2010-12-16 11:32:02 UTC
Created attachment 469121 [details]
screenshot

Comment 2 Lukas Krejci 2010-12-17 10:41:33 UTC
RHQ can't know what values are valid/invalid for the connection properties which is why we don't do any validation on them.

The dramatic consequences seen in the description were caused by the fact that NoTxRHQDS is a datasource used by the RHQ server itself. Therefore if it becomes defunct, the whole server stops functioning properly because it looses its database connectivity.

I don't think there's anything we can do about this but to warn the users to be careful when updating properties of datasources because other applications are usually dependent on them. But then this is something an admin should be well aware of.