incubator-ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yusaku Sako (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AMBARI-1129) Updating service configuration for a service via the api fails with a sql error
Date Fri, 11 Jan 2013 01:21:11 GMT

     [ https://issues.apache.org/jira/browse/AMBARI-1129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Yusaku Sako updated AMBARI-1129:
--------------------------------

    Affects Version/s: 1.2.0
    
> Updating service configuration for a service via the api fails with a sql error
> -------------------------------------------------------------------------------
>
>                 Key: AMBARI-1129
>                 URL: https://issues.apache.org/jira/browse/AMBARI-1129
>             Project: Ambari
>          Issue Type: Bug
>          Components: controller
>    Affects Versions: 1.2.0
>            Reporter: John Speidel
>            Assignee: John Speidel
>             Fix For: 1.2.0
>
>         Attachments: AMBARI-1129.patch
>
>
> In ServiceConfigMappingDAO, the where clause of the sql query is built incorrectly. In
the below code snippet, the argument "?5" is used in the where clause and there are only three
arguments that get set. The 5 should be changed to a 3.
> TypedQuery<ServiceConfigMappingEntity> query =
> entityManagerProvider.get().createQuery(
> "SELECT config FROM ServiceConfigMappingEntity config"
> + " WHERE "
> + " config.clusterId = ?1"
> + " AND config.serviceName = ?2"
> + " AND config.configType IN ?5",
> ServiceConfigMappingEntity.class);
> return daoUtils.selectList(query, clusterId, serviceName, configTypes);
> As a result, the query fails because there is no arg 5.  This results in the below stack
trace:
> java.lang.IllegalArgumentException: You have attempted to set a parameter at position
3 which does not exist in this query string SELECT config FROM ServiceConfigMappingEntity
config WHERE config.clusterId = ?1 AND config.serviceName = ?2 AND config.configType IN ?5.
> at org.eclipse.persistence.internal.jpa.QueryImpl.setParameterInternal(QueryImpl.java:820)
> at org.eclipse.persistence.internal.jpa.QueryImpl.setParameterInternal(QueryImpl.java:801)
> at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:451)
> at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:1)
> at org.apache.ambari.server.orm.dao.DaoUtils.setParameters(DaoUtils.java:57)
> at org.apache.ambari.server.orm.dao.DaoUtils.selectList(DaoUtils.java:33)
> at org.apache.ambari.server.orm.dao.ServiceConfigMappingDAO.findByServiceAndType(ServiceConfigMappingDAO.java:63)
> at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66)
> at org.apache.ambari.server.orm.dao.ClearEntityManagerInterceptor.invoke(ClearEntityManagerInterceptor.java:41)
> at org.apache.ambari.server.state.ServiceImpl.updateDesiredConfigs(ServiceImpl.java:296)
> at org.apache.ambari.server.controller.AmbariManagementControllerImpl.updateServices(AmbariManagementControllerImpl.java:2107)
> ...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message