Support Article
Uncaught exception when importing XSD with SimpleType
SA-22797
Summary
Uncaught exception when importing XSD with SimpleType with Pega 7.1.9.
User is getting an uncaught exception when importing XSD. The XSD contains a SimpleType that is nested inside a restriction and SimpleContent. There are two xsd File_Object.xsd which imports cybox_common.xsd. User has verified the xsd using XMLSPY editor and they are valid.
The error happens when a SimpleType is nested inside Restriction. Please see an example below
<xs:simpleContent>
<xs:restriction base="cyboxCommon:BaseObjectPropertyType">
<xs:simpleType>
<xs:union memberTypes="FileObj:PackerClassEnum xs:string"/>
</xs:simpleType>
<xs:attribute name="datatype" type="cyboxCommon:DatatypeEnum" fixed="string">
<xs:annotation>
<xs:documentation>This field is optional and specifies the expected type for the value of the specified field.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:restriction>
</xs:simpleContent>
Error Messages
The following error message is seen
Caught unexpected exception: Caught exception while looking up XML schema components: Schema for namespace 'http://cybox.mitre.org/common-2' contains a simpleContent restriction with unrecognized content: simpleType
Following is the snippet of exception stacktrace from log:
--------------------------------------------------------------
@MyCO - Caught unexpected exception: Caught exception while looking up XML schema components: Schema for namespace 'http://cybox.mitre.org/common-2' contains a simpleContent restriction with unrecognized content: simpleType
com.pega.pegarules.pub.PRRuntimeException: Caught exception while looking up XML schema components: Schema for namespace 'http://cybox.mitre.org/common-2' contains a simpleContent restriction with unrecognized content: simpleType
at com.pega.pegarules.integration.engine.internal.mapping.xml.XMLTreeViewBuilder.generateMappingRules(XMLTreeViewBuilder.java:504)
at com.pega.pegarules.integration.engine.internal.util.PRServiceUtils.generateMappingRules(PRServiceUtils.java:1568)
at com.pegarules.generated.activity.ra_action_generaterules_57107c97e304e8d611c6d865bf8ea891.step6_circum0(ra_action_generaterules_57107c97e304e8d611c6d865bf8ea891.java:645)
at com.pegarules.generated.activity.ra_action_generaterules_57107c97e304e8d611c6d865bf8ea891.perform(ra_action_generaterules_57107c97e304e8d611c6d865bf8ea891.java:161)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3505)
at com.pegarules.generated.flow.ra_action_processmetadata_9982554fb78241fcacaf460c25e3ac3f.RunTaskActivity(ra_action_processmetadata_9982554fb78241fcacaf460c25e3ac3f.java:5443)
at com.pegarules.generated.flow.ra_action_processmetadata_9982554fb78241fcacaf460c25e3ac3f.Task_UTILITY61_circum0(ra_action_processmetadata_9982554fb78241fcacaf460c25e3ac3f.java:3047)
at com.pegarules.generated.flow.ra_action_processmetadata_9982554fb78241fcacaf460c25e3ac3f.perform(ra_action_processmetadata_9982554fb78241fcacaf460c25e3ac3f.java:620)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3505)
at com.pegarules.generated.StartFlow_071017_Y4eQmw0Y6OuVgKxzwKWCmA.StartFlow07_10_17(StartFlow_071017_Y4eQmw0Y6OuVgKxzwKWCmA.java:167)
at com.pegarules.generated.StartFlow_071017_Y4eQmw0Y6OuVgKxzwKWCmA.invoke(StartFlow_071017_Y4eQmw0Y6OuVgKxzwKWCmA.java:76)
at com.pega.pegarules.generation.internal.library.LibraryRuntime.resolveAndinvokeFunctionViaReflection(LibraryRuntime.java:133)
at com.pega.pegarules.generation.internal.library.LibraryRuntime.invokeLibraryRuntime(LibraryRuntime.java:110)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeLibraryRuntime(Executable.java:9000)
at com.pega.pegarules.priv.generator.LibrarySupport.resolveAndInvokeFunctionViaReflection(LibrarySupport.java:181)
at com.pegarules.generated.pega_procom_flow.StartFlow(pega_procom_flow.java:639)
at com.pegarules.generated.activity.ra_action_completeassignment_e2da40fb3dc4f751f68784977f6bf076.step24_circum0(ra_action_completeassignment_e2da40fb3dc4f751f68784977f6bf076.java:2411)
at com.pegarules.generated.activity.ra_action_completeassignment_e2da40fb3dc4f751f68784977f6bf076.perform(ra_action_completeassignment_e2da40fb3dc4f751f68784977f6bf076.java:517)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3505)
at com.pegarules.generated.callActivity_071017_xvj4o_pyNDBZ4Gy293rekg.callActivity07_10_17(callActivity_071017_xvj4o_pyNDBZ4Gy293rekg.java:122)
at com.pegarules.generated.callActivity_071017_xvj4o_pyNDBZ4Gy293rekg.invoke(callActivity_071017_xvj4o_pyNDBZ4Gy293rekg.java:82)
at com.pega.pegarules.generation.internal.library.LibraryRuntime.resolveAndinvokeFunctionViaReflection(LibraryRuntime.java:133)
at com.pega.pegarules.generation.internal.library.LibraryRuntime.invokeLibraryRuntime(LibraryRuntime.java:110)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeLibraryRuntime(Executable.java:9000)
at com.pega.pegarules.priv.generator.LibrarySupport.resolveAndInvokeFunctionViaReflection(LibrarySupport.java:181)
at com.pegarules.generated.pega_rules_utilities.callActivity(pega_rules_utilities.java:1630)
at com.pegarules.generated.activity.ra_action_performflowaction_b47344d0280662530139fce7e72cd84c.step18_circum0(ra_action_performflowaction_b47344d0280662530139fce7e72cd84c.java:1706)
at com.pegarules.generated.activity.ra_action_performflowaction_b47344d0280662530139fce7e72cd84c.perform(ra_action_performflowaction_b47344d0280662530139fce7e72cd84c.java:365)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3505)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:10563)
at com.pegarules.generated.activity.ra_action_finishassignment_d0045083e1b45f7e2330fe3464a87513.step10_circum0(ra_action_finishassignment_d0045083e1b45f7e2330fe3464a87513.java:1435)
at com.pegarules.generated.activity.ra_action_finishassignment_d0045083e1b45f7e2330fe3464a87513.perform(ra_action_finishassignment_d0045083e1b45f7e2330fe3464a87513.java:229)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3505)
at com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivitiesAlt(ThreadRunner.java:646)
at com.pega.pegarules.session.internal.mgmt.PRThreadImpl.runActivitiesAlt(PRThreadImpl.java:461)
at com.pega.pegarules.session.internal.engineinterface.service.HttpAPI.runActivities(HttpAPI.java:3358)
at com.pega.pegarules.session.external.engineinterface.service.EngineAPI.processRequestInner(EngineAPI.java:385)
at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.performTargetActionWithLock(PRSessionProviderImpl.java:1270)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1008)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:841)
at com.pega.pegarules.session.external.engineinterface.service.EngineAPI.processRequest(EngineAPI.java:331)
at com.pega.pegarules.session.internal.engineinterface.service.HttpAPI.invoke(HttpAPI.java:852)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl._invokeEngine_privact(EngineImpl.java:315)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.invokeEngine(EngineImpl.java:263)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.invokeEngine(EngineImpl.java:240)
at com.pega.pegarules.priv.context.JNDIEnvironment.invokeEngineInner(JNDIEnvironment.java:278)
at com.pega.pegarules.priv.context.JNDIEnvironment.invokeEngine(JNDIEnvironment.java:223)
at com.pega.pegarules.web.impl.WebStandardImpl.makeEtierRequest(WebStandardImpl.java:574)
at com.pega.pegarules.web.impl.WebStandardImpl.doPost(WebStandardImpl.java:374)
at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:370)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:411)
at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethodPropagatingThrowable(AppServerBridgeToPega.java:223)
at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethod(AppServerBridgeToPega.java:272)
at com.pega.pegarules.internal.web.servlet.WebStandardBoot.doPost(WebStandardBoot.java:121)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
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.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:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
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(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: com.pega.pegarules.pub.PRException: Schema for namespace 'http://cybox.mitre.org/common-2' contains a simpleContent restriction with unrecognized content: simpleType
Steps to Reproduce
1. Download File_Object.xsd and cybox_common.xsd in to the same folder. For personal edition those files must be copied in \temp\StaticContent\global\ServiceExport, in this case it is C:\PRPCPersonalEdition\temp\StaticContent\global\ServiceExport) folder.
2. Navigate to Designer Studio>Integration>Connectors>Connector and MetaData Wizard.
3. Select Data Mapping Rules from Purpose drop-down.
4. Select XSD from MetaData Drop-down.
5. Provide RuleSet Name, Rule Set version and Base Class and click "Next" button.
6. Select "Local File Name" radio button from "Load XML Schema Document".
7. Click on "Choose File" button and navigate to the folder where the xsds has been copied. For Personal edition they will be in \temp\StaticContent\global\ServiceExport
8. Select File_Object.xsd file and click "Next" in designer studio.
9. Move pass the "Review Previous Section" by clicking next button.
10. In "Select Elemets" section select "File" and click "Next".
11. Select all available rule types in "Select Rule Types" section and click "Next".
12. Click "Next" in "Add Substitute Rule" section.
At this point user witnesses the below error:
Caught unexpected exception: Caught exception while looking up XML schema components: Schema for namespace 'http://cybox.mitre.org/common-2' contains a simpleContent restriction with unrecognized content: simpleType
ROOT CAUSE/EXPLANATION
This is expected behavior from https://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html#Simple_Type_Definitions.
3.14.3 Constraints on XML Representations of Simple Type Definitions
Schema Representation Constraint: Simple Type Definition Representation OKIn addition to the conditions imposed on <simpleType> element information items by the schema for schemas, all of the following must be true :
1 The corresponding simple type definition, if any, must satisfy the conditions set out in Constraints on Simple Type Definition Schema Components (§3.14.6).
2 If the <restriction> alternative is chosen, either it must have a
base
[attribute] or a <simpleType> among its [children], but not both.3 If the <list> alternative is chosen, either it must have an
itemType
[attribute] or a <simpleType> among its [children], but not both. 4 Circular union type definition is disallowed. That is, if the <union> alternative is chosen, there must not be any entries in the
memberTypes
[attribute] at any depth which resolve to the component corresponding to the<simpleType>.Published May 21, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.