UCMDB and UD Practitioners Forum (Previously CMS)
cancel
Showing results for 
Search instead for 
Did you mean: 

uCMDB query can't have conditions

SOLVED
Go to solution
Highlighted
IntApp_1
Regular Collector

uCMDB query can't have conditions

I have uCMDB 9.0 (fundation) installed. I want to create a query of my own.

I am new to uCMDB. Following is what I did and got:

1. From Modeling Studio, created a new query, and then drag-n-dropped ConfigurationItem from the CI Types tab onto the Query Definition pane.

2. If I use Web Service running the query at this point, it returns all the CIs in this categoty as expected.

3. Then I right clicked the dropped element and selected "Query Node Properties". In the properties window, added a condition like [LastModifiedTime Greater ""] with Parameterized option set to Yes and a parameter name "startDate". Saved it.

4. Then with soap client tool I sent in following Web Service request but got error response:






Test

MyQuery




startDate
2010-09-01T00:00:00.000



ConfigurationItem





The error in the response is:
error was occured while invoke query [MyQuery] CMDB Operation Internal Error: class java.lang.IllegalArgumentException : In element number : 11, Number of parameters of the same property should be equal. in pattern: null, in condition: 1 : operation Tql Query: Get Ad Hoc Map With Pattern (By Pattern ID). Pattern [MyQuery];

I understand it's saying some numbers should match but was not. But I don't know what they are and how to check. Any suggestion what I did wrong?

 

 

P.S. This thread has been moevd from Application Perf Mgmt (BAC / BSM) Support and News Forum to CMS and Discovery Support and News Forum. - Hp forum Moderator

15 REPLIES
Amit Erental
Honored Contributor

Re: uCMDB query can't have conditions

Hi,

From a quick look it looks like your request is OK.

For the error, it means that the number of the Parameterized conditions for the same property in the pattern and in the request should match.

Make sure that the query with this name is saved with the Parameterized condition.

Make sure you do not have any other Parameterized condition that is not referenced in the request

looks for additional errors under the log folder C:\hp\UCMDB\UCMDBServer\runtime\log

IntApp_1
Regular Collector

Re: uCMDB query can't have conditions

Hi Amit,
Thanks for the response, appreciated!

I'm sure the condition was saved because I worked on this problem for more than two days already.

To simplify the test, I only have one parameter in the query, and this ONE condition was showed on the Attributes tab. I'm sure this was matched.

The error.log file contains the same error information as I posted, except the exception stacks:
2010-09-30 18:35:49,595 [902139140@qtp0-2755] (AbstractCmdbOpenApiCommand.java:60) ERROR - an error was occured at [Get Tql Result By Tql Name and parameters Command], ID: 883797659
com.hp.ucmdb.adapter.base.exception.UcmdbWSException: error was occured while invoke query [MyQuery] CMDB Operation Internal Error: class java.lang.IllegalArgumentException : In element number : 11, Number of parameters of the same property should be equal. in pattern: null, in condition: 1 : operation Tql Query: Get Ad Hoc Map With Pattern (By Pattern ID). Pattern [MyQuery]
at com.hp.ucmdb.adapter.command.query.impl.ExecuteTopologyQueryByNameWithParametersCmd.internalQueryExecute(ExecuteTopologyQueryByNameWithParametersCmd.java:83)
at com.hp.ucmdb.adapter.command.query.impl.AbstractCmdbOpenApiQueryCommand.internalExecute(AbstractCmdbOpenApiQueryCommand.java:46)
at com.hp.ucmdb.adapter.command.AbstractCmdbOpenApiCommand.execute(AbstractCmdbOpenApiCommand.java:52)
at com.hp.ucmdb.services.AbstractUcmdbServiceSkeleton.executeTopologyQueryByNameWithParameters(AbstractUcmdbServiceSkeleton.java:338)
at com.hp.ucmdb.services.UcmdbServiceMessageReceiverInOut.invokeBusinessLogic(UcmdbServiceMessageReceiverInOut.java:220)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:497)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:328)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:254)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:741)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

Any further idea?
Amit Erental
Honored Contributor

Re: uCMDB query can't have conditions

Hi,

If you invoke a request without the parameter for the current query, what are the results ?

Please attach a screenshot of the query definition
IntApp_1
Regular Collector

Re: uCMDB query can't have conditions

Hi Amit,
Without provinding the parameter it returned all the CIs under ConfigurationItem type.

Attached the screen as you requested.
Amit Erental
Honored Contributor

Re: uCMDB query can't have conditions

Hi,

Can you attach the screen where the Parameterized option is set ?
IntApp_1
Regular Collector

Re: uCMDB query can't have conditions

See attached.
Amit Erental
Honored Contributor

Re: uCMDB query can't have conditions

Hi,

Its seems setup correctly

try the same without a default value, or with a different parameter name (start_date for example)

IntApp_1
Regular Collector

Re: uCMDB query can't have conditions

without default value, with query name start_date and request name startDate, with both query and request using start_date, with both query and request for a string type attribute (such as Name vs. LastModifiedTime), they all return the same error.
Amit Erental
Honored Contributor

Re: uCMDB query can't have conditions

Hi

I guess something is wrong here... but have no idea what it is, maybe something in the request is missing or not in place.

did you tried to achieve the same with the ODB API, instead the Web Service API ?

Amit
IntApp_1
Regular Collector

Re: uCMDB query can't have conditions

I don't know what ODB API is. I don't think I have that API because I don't see it from documentation. But Thanks for all your time trying to help me. Really appreciated.
Amit Erental
Honored Contributor

Re: uCMDB query can't have conditions

Hi,

you are welcome

You have it OOTB. its documented in the same place as the Web Service API, in the UCMDB9.00_Dev_Ref pdf, page 343.

http://support.openview.hp.com/selfsolve/document/KM917032/binary/UCMDB9.00_Dev_Ref.pdf?searchIdentifier=-7d7ed7b3%3a12b5b25a787%3a29e0&resultType=document

Amit Erental
Honored Contributor

Re: uCMDB query can't have conditions

Hi,

Try use the CI attribute name in the soap xml, not the parameter name. see example in page 315:

disk_failures is an attribute name for the Disk CI type, not the parameter name

host_os is an attribute name for the HOST CI type

// assume the follow query was defined at UCMDB
// Query Name: exampleQuery
// Query sketch:
// Host
// / \
// ip Disk
// Query Parameters:
// Host-
// host_os (like)
// Disk-
// disk_failures (equal)

public void executeTopologyQueryByNameWithParametersDemo() {
ExecuteTopologyQueryByNameWithParameters request =
new ExecuteTopologyQueryByNameWithParameters();
CmdbContext cmdbContext = getContext();
//set cmdbcontext
request.setCmdbContext(cmdbContext);
//set query name
request.setQueryName("queryName");
//set parameters
ParameterizedNode hostParametrizedNode =
new ParameterizedNode();
hostParametrizedNode.setNodeLabel("Host");
CIProperties parameters = new CIProperties();
StrProps strProps = new StrProps();
StrProp strProp = new StrProp();
strProp.setName("host_os");
strProp.setValue("%2000%");
strProps.addStrProp(strProp);
parameters.setStrProps(strProps);
hostParametrizedNode.setParameters(parameters);
request.addParameterizedNodes(hostParametrizedNode);
ParameterizedNode diskParametrizedNode =
new ParameterizedNode();
diskParametrizedNode.setNodeLabel("Disk");
CIProperties parameters1 = new CIProperties();
IntProps intProps = new IntProps();
IntProp intProp = new IntProp();
intProp.setName("disk_failures");
intProp.setValue(30);
intProps.addIntProp(intProp);
parameters1.setIntProps(intProps);
diskParametrizedNode.setParameters(parameters1);
Amit Erental
Honored Contributor
Solution

Re: uCMDB query can't have conditions

See also in The Web Service API doc:

AppServer\webapps\site.war\amdocs\eng\doc_lib\Solutions_and_Integrations\CMDB_Schema\webframe.html

dateProp name is from CIProp\name type, which is the property name

IntApp_1
Regular Collector

Re: uCMDB query can't have conditions

You absolutely right!!! My request works now :)
Thank you so much for the help!!!
IntApp_1
Regular Collector

Re: uCMDB query can't have conditions

I love Amit and the solution :)
//Add this to "OnDomLoad" event