Community
Participate
Working Groups
I created an MDR by following the steps outlined under http://cmdbf.org/schema/1-0-0/datamodel I then run the MDR on the apache server. This will bring up the COSMOS UI in the internal browser. The MDR is shown in the navigation tree. At this point I submit the following query. <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2007 IBM Corporation. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM - Initial API and implementation --> <!-- This query selects all students --> <s:query xmlns:s="http://cmdbf.org/schema/1-0-0/datamodel"> <s:itemTemplate id="items"> <s:recordConstraint> <s:recordType namespace="" localName="student"/> </s:recordConstraint> </s:itemTemplate> </s:query> Afterwards I get the following exception: [ERROR] CSMS0118E Error occurred while executing operation. Incoming SOAP message is: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><s:query xmlns:s="http://cmdbf.org/schema/1-0-0/datamodel"> <s:itemTemplate id="items"> <s:recordConstraint> <s:recordType localName="student" namespace="" /> </s:recordConstraint> </s:itemTemplate> </s:query></soapenv:Body></soapenv:Envelope> java.lang.NullPointerException at org.eclipse.cosmos.dc.provisional.cmdbf.services.query.service.impl.CMDBfQueryOperation.processItemTemplates(CMDBfQueryOperation.java:165) at org.eclipse.cosmos.dc.provisional.cmdbf.services.query.service.impl.CMDBfQueryOperation.execute(CMDBfQueryOperation.java:135) at org.eclipse.cosmos.dc.provisional.cmdbf.services.query.service.impl.CMDBfQueryOperation.execute(CMDBfQueryOperation.java:122) at org.eclipse.cosmos.dc.provisional.cmdbf.query.AbstractQueryService.GraphQuery(AbstractQueryService.java:81) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.cosmos.dc.provisional.cmdbf.receiver.CosmosMessageReceiver.invokeBusinessLogic(CosmosMessageReceiver.java:134) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Unknown Source)
Created attachment 105537 [details] Screen shot showing error
I traced the problem and found out that it may not be a bug. The NPE is due to the fact that the generated code for the QueryHandlerFactory contains methods that return null. protected IItemTemplateHandler createItemHandler() throws CMDBfServiceException { return null; } I suppose the developer should implement this method before trying to submit a query. David can you comment on this?
That must mean we need to generate more code. For some reason when I implemented it, I had thought I only needed to implement the one method, but apparently the framework ends up calling this method as well. I think we need to do one of two things here... either we need to change the toolkit so that it generates the minimum necessary for this method as well, or we should change the framework to be able to more gracefully handle a null being returned.
(In reply to comment #3) The generated code could throw a message exception instead of returning null such as throwing "method not implemented" exception. This is similar to what the abstract class is doing throw unsupportedHandler(IQueryTransformerConstants.RECORD_CONSTRAINT_ELEMENT); If we do this then AbstractQueryHandlerFactory.unsupportedHandler has to be protected instead of private.
Added default implementation for the QueryHandlerFactory methods. The methods return "Hello World" records. This will allow the user to submit a query and see a simple item in the COSMOS UI.
Created attachment 111066 [details] patch that fixes the bug
Sheldon, why did you mark that patch for the IPLog? I had thought we only needed to do that if the person attaching the patch was not a committer at the time.
closing to cleanup bugzilla