REST API example mentioned in documentation doesn't work. org.xml.sax.SAXParseException; cvc-elt.1: Cannot find the declaration of element 'organization:Organization'.

Hi,
I am trying to run the REST API example mentioned in the documentation : http://documentation.bonitasoft.com/create-your-first-project-web-rest-api-and-maven-0

But , I get this error on server side (tomcat) :
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 106; cvc-elt.1: Cannot find the declaration of element ‘organization:Organization’.
(Full stack trace is below)

XML file is here : https://github.com/bonitasoft/bonita-examples/blob/master/rest-api-example/src/main/resources/ACME.xml

Can some one help me to resolve this.
Thank you very much for your time.
Best Regards
Chakra

2015-08-25 16:37:19.885 +0900 org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet catchAllExceptions
SEVERE: Can’t import organization. Please check that your file is well-formed
org.bonitasoft.web.toolkit.server.ServiceException: Can’t import organization. Please check that your file is well-formed
at org.bonitasoft.console.server.service.OrganizationImportService.run(OrganizationImportService.java:62)
at org.bonitasoft.web.toolkit.server.ServiceServletCall.run(ServiceServletCall.java:92)
at org.bonitasoft.web.toolkit.server.ServiceServletCall.doPost(ServiceServletCall.java:72)
at org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.bonitasoft.console.common.server.login.filter.AuthenticationFilter.isAuthorized(AuthenticationFilter.java:152)
at org.bonitasoft.console.common.server.login.filter.AuthenticationFilter.doAuthenticationFiltering(AuthenticationFilter.java:134)
at org.bonitasoft.console.common.server.login.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.bonitasoft.engine.identity.OrganizationImportException: USERNAME=install | org.bonitasoft.engine.xml.SValidationException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 106; cvc-elt.1: Cannot find the declaration of element ‘organization:Organization’.
at org.bonitasoft.engine.api.impl.IdentityAPIImpl.importOrganization(IdentityAPIImpl.java:1427)
at org.bonitasoft.engine.api.impl.IdentityAPIImpl.importOrganization(IdentityAPIImpl.java:1414)
at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:467)
at org.bonitasoft.engine.api.impl.ServerAPIImpl$2.call(ServerAPIImpl.java:436)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:312)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(ServerAPIImpl.java:443)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:278)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:131)
at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:88)
at com.sun.proxy.$Proxy18.importOrganization(Unknown Source)
at org.bonitasoft.console.server.service.OrganizationImportService.run(OrganizationImportService.java:60)
… 38 more
Caused by: org.bonitasoft.engine.xml.SValidationException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 106; cvc-elt.1: Cannot find the declaration of element ‘organization:Organization’.
at org.bonitasoft.engine.xml.SAXValidator.validate(SAXValidator.java:91)
at org.bonitasoft.engine.xml.SAXValidator.validate(SAXValidator.java:80)
at org.bonitasoft.engine.xml.parse.SAXParser.validate(SAXParser.java:138)
at org.bonitasoft.engine.identity.xml.ImportOrganization.execute(ImportOrganization.java:131)
at org.bonitasoft.engine.api.impl.IdentityAPIImpl.importOrganization(IdentityAPIImpl.java:1425)
… 51 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 106; cvc-elt.1: Cannot find the declaration of element ‘organization:Organization’.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1906)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:746)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:379)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:605)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3138)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:880)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.jaxp.validation.StreamValidatorHelper.validate(StreamValidatorHelper.java:155)
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:116)
at javax.xml.validation.Validator.validate(Validator.java:124)
at org.bonitasoft.engine.xml.SAXValidator.validate(SAXValidator.java:89)
… 55 more

Answer from elias.ricken

which is the version of Bonita BPM embedded in your server? Modify your pom.xml to use the same version for the artifact ‘bonita-client’ and replace the xml file by the one exported from the Bonita Studio.


for technical reasons, the xmlns has changed between the version 6.2.1 and 7.0.0, making the xml file incompatible (even if the only difference is the xmlns).

Regards,
Elias

Hi,

which is the version of Bonita BPM embedded in your server? Modify your pom.xml to use the same version for the artifact ‘bonita-client’ and replace the xml file by the one exported from the Bonita Studio.

Regards,
Elias

Hi Elias ,
Thank you very much for the answer. Your suggestion works.
I modified my pom.xml before posting this question. Now, I just used the xml file exported from the Bonita Studio.
The only difference I can see is the xmls URI path
i.e.,
WORKING ONE :

 <organization:Organization xmlns:organization="http://documentation.bonitasoft.com/organization-xml-schema/1.1">

OLD ONE:

 <organization:Organization xmlns:organization="http://www.bonitasoft.org/ns/organization/6.0.0-beta-016">

Could you please explain this.
Thank you very much

Hi,

for technical reasons, the xmlns has changed between the version 6.2.1 and 7.0.0, making the xml file incompatible (even if the only difference is the xmlns).

Regards,
Elias

Thank you Elias :slight_smile: . I will paste your comment’s in answer field & mark it

Thanks!