Unable to import resource from discovery queue into JBoss ON due to a null value for resource's availability_type

Solution Verified - Updated -

Issue

  • Remoting CLI script not working anymore
  • DiscoveryBoss.importResources is not working anymore
  • I get the following error message:

    Exception in thread "main" org.rhq.enterprise.client.script.CLIScriptException: javax.script.ScriptException: sun.org.mozilla.javascript.internal.WrappedException: Wrapped javax.ejb.EJBException: [Warning] java.lang.RuntimeException: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state (<Unknown source>#38) in <Unknown source> at line number 38
        at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:298)
        at org.rhq.enterprise.client.commands.ScriptCommand.execute(ScriptCommand.java:108)
        at org.rhq.enterprise.client.ClientMain$StartupConfiguration.process(ClientMain.java:141)
        at org.rhq.enterprise.client.ClientMain.main(ClientMain.java:161)
    Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.internal.WrappedException: Wrapped javax.ejb.EJBException: [Warning] java.lang.RuntimeException: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state (<Unknown source>#38) in <Unknown source> at line number 38
        at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:110)
        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:232)
        at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:287)
        ... 3 more
    
  • The following error and warning messages appear in the server log:

    WARN  [org.rhq.enterprise.server.resource.ResourceAvailabilityManagerBean] Could not insert cached current availabilities for newly imported Resources: org.postgresql.util.PSQLException: ERROR: null value in column "availability_type" violates not-null constraint
    ERROR [org.hibernate.util.JDBCExceptionReporter] Batch entry 0 update RHQ_RESOURCE set UUID='4ff64a4e-4566-46d6-88be-c5fdedf001eb', RESOURCE_KEY='localhost.localdomain RHQ Agent', NAME='RHQ Agent', ANCESTRY='10048_:_10001_:_localhost.localdomain', INVENTORY_STATUS='COMMITTED', CONNECTED='0', VERSION='4.2.0.JON.3.0.1.GA', DESCRIPTION='RHQ Management Agent', CTIME='1353005533201', MTIME='1353012795148', ITIME='1353012795148', MODIFIED_BY='admin', LOCATION=NULL, RESOURCE_TYPE_ID='10086', PARENT_RESOURCE_ID='10001', RES_CONFIGURATION_ID='10881', PLUGIN_CONFIGURATION_ID='10882', AGENT_ID='10001', PRODUCT_VERSION_ID='10002' where ID='10051' was aborted.  Call getNextException to see the cause.
    WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 25P02
    ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: current transaction is aborted, commands ignored until end of transaction block
    ERROR [org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with session
    org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
        at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        ...
        at $Proxy465.updateInventoryStatus(Unknown Source)
        at org.rhq.enterprise.server.discovery.DiscoveryBossBean.updateInventoryStatus(DiscoveryBossBean.java:290)
        at org.rhq.enterprise.server.discovery.DiscoveryBossBean.checkStatus(DiscoveryBossBean.java:1073)
        at org.rhq.enterprise.server.discovery.DiscoveryBossBean.importResources(DiscoveryBossBean.java:994)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        ...
    Caused by: java.sql.BatchUpdateException: Batch entry 0 update RHQ_RESOURCE set UUID='4ff64a4e-4566-46d6-88be-c5fdedf001eb', RESOURCE_KEY='localhost.localdomain RHQ Agent', NAME='RHQ Agent', ANCESTRY='10048_:_10001_:_localhost.localdomain', INVENTORY_STATUS='COMMITTED', CONNECTED='0', VERSION='4.2.0.JON.3.0.1.GA', DESCRIPTION='RHQ Management Agent', CTIME='1353005533201', MTIME='1353012795148', ITIME='1353012795148', MODIFIED_BY='admin', LOCATION=NULL, RESOURCE_TYPE_ID='10086', PARENT_RESOURCE_ID='10001', RES_CONFIGURATION_ID='10881', PLUGIN_CONFIGURATION_ID='10882', AGENT_ID='10001', PRODUCT_VERSION_ID='10002' where ID='10051' was aborted.  Call getNextException to see the cause.
        at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
        at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection$StatementHandler.invoke(AbstractJdbc23PooledConnection.java:455)
        at $Proxy51.executeBatch(Unknown Source)
        at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeBatch(CachedPreparedStatement.java:476)
        at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:774)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:247)
        ... 157 more
    
  • Unable to import resource from discovery queue due to null availability_type

Environment

  • JBoss Operations Network (ON) 3.1, 3.1.1
  • Resource being imported does not have a corresponding row in the database table rhq_resource_avail
  • ON system has been upgraded from a version prior to 3.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content