当前位置: 首页 > 知识库问答 >
问题:

XML解析异常org.XML.sax.saxParseException cvc-elt.1

乜明朗
2023-03-14

我的XML包含

<?xml version="1.0" encoding="UTF-8"?>
<organization:Organization xmlns:organization="http://www.bonitasoft.org/ns/organization/6.0.0-beta-016">
......
</organization:Organization>

有关完整XML文件,请查看:https://github.com/bonitasoft/bonita-examples/blob/master/rest-api-example/src/main/resources/acme.XML

我在服务器端(Java和Tomcat):

org.xml.sax.SAXParseException;行号:2;列号:106;CVC-ELT.1:找不到元素“organization:organization”的声明。(下面是完整的堆栈跟踪)

我将“organization”标记仅改为 ...

我仍然得到同样的错误:cvc-elt.1:找不到元素“organization”的声明

当我将xmlns URI更改为

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

谁能解释一下。

我正在尝试运行Bonitasoft文档中提到的REST API示例:http://documentation.Bonitasoft.com/create-your-first-project-web-rest-api-and-maven-0(我猜这是纯粹的XML解析问题&与Bonitasoft代码无关)

谁能帮我解决这个问题。

非常感谢你抽出时间。

全堆栈跟踪:

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

共有1个答案

哈烨熠
2023-03-14

错误不能找到元素'organization:organization的声明,表明您正在尝试根据某个模式验证XML实例。该模式将包含某些命名空间中的许多元素的定义。它使用名称空间http://documentation.bonitasoft.com/organization-xml-schema/1.1的事实表明,这是模式所需的正确名称空间。如果是这种情况,那么使用您自己发明的不同名称空间将导致您观察到的错误。这纯粹是一个您是否正在使用模式中定义的名称空间的问题。

 类似资料:
  • 问题内容: 我需要解析一个Xml文档并将值存储在文本文件中,当我解析普通数据(如果所有标签都包含数据)时,它的工作状况很好,但是如果任何标签中都没有数据,则它会抛出“ NullpointerException”这样做,为避免出现空指针异常,请使用示例代码Sample xml来建议我: 码: 问题答案: 只需检查对象是否不是:

  • 问题内容: 当我尝试解析xml时,出现以下异常:- 我用来解析xml的代码如下:- 我试图解析已为休眠编写的xml,实际上它是一个休眠映射文件。 我尝试解析的xml如下: 请帮忙。 问题答案: 我用下面的代码,这对我来说很好。

  • 我使用以下代码通过 JAXB 取消绑定 XML。responseXML 包含从 Web 服务调用返回的 XML 字符串。 以下是取消编组时发生的异常。 有人帮忙解决这个问题。 下面是从XSD自动生成的TestACK类 下面是示例XML

  • com.fasterxml.jackson.databind.jsonMappingException:属性“wallpaper”的setter定义冲突:在RializerCache._CreateAndCache2(deserializerCache.java:298)...com.fasterxml.jackson.databind.objectMapper._ReadMapandClose(

  • 我有一个包含OClass对象的列表。我想创建这个对象的JSON。下面是我的代码: com.fasterxml.jackson.databind.jsonMappingException:未发现用于com.ontotext.trree.owlim_ext.r类的序列化程序,也未发现用于创建BeanSerializer的属性(为了避免异常,禁用serializationconfig.serializa

  • 我有一些从XML文件加载应用程序上下文的单元测试: 这将引发一个异常: 我的单元测试类位于以下文件夹中: myproj/myproj配置dal/src/test/java/com/mypatterns/api/data/impl/LogTest。JAVA 资源文件位于: myproj/myproj配置dal/src/test/resources/test应用程序上下文。xml 我尝试将xml文件以