1 Reply Latest reply: Jun 29, 2012 7:24 AM by 923577 RSS

    Error with @SchemaValidation

    923577
      Hi,

      I’m creating a proxy for webservices with wsimport and JAXWS.

      Everything seems to work fine but when I add @SchemaValidation to the webservice class, deployment on Glassfish and Weblogic goes wrong with the error message:

      cos-st-restricts.1.1: The type 'DateContentType' is atomic, so its {base type definition}, 'xs:anySimpleType', must be an atomic simple type definition or a built-in primitive datatype

      Does anybody know what this means?

      Is this a problem with the XSD’s or with SchemaValidation?

      Does anyone know a fix or workaround? The XSD’s are given so I can’t change them.


      Thank you,

      Best regards,
      Erik

      Complete stacktrace:

      [#|2012-06-25T17:08:46.390+0200|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=19;_ThreadName=Thread-2;|Exception while invoking class com.sun.enterprise.web.WebApplication start method
      java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: javax.servlet.ServletException: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: javax.xml.ws.WebServiceException: org.xml.sax.SAXParseException: cos-st-restricts.1.1: The type 'DateContentType' is atomic, so its {base type definition}, 'xs:anySimpleType', must be an atomic simple type definition or a built-in primitive datatype.
           at com.sun.enterprise.web.WebApplication.start(WebApplication.java:138)
           at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
           at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
           at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
           at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
           at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
           at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
           at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
           at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
           at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
           at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
           at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
           at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
           at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)
           at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)
           at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)
           at sun.reflect.GeneratedMethodAccessor762.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
           at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
           at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
           at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
           at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
           at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
           at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
           at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
           at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
           at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
           at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
           at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
           at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
           at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
           at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
           at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
           at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
           at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
           at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
           at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
           at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
           at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
           at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
           at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
           at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
           at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
           at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
           at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
           at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
           at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
           at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
           at java.lang.Thread.run(Thread.java:662)

      Edited by: Erik on 28-jun-2012 4:43
        • 1. Re: Error with @SchemaValidation
          923577
          Apparently wsimport used XMLGregorianCalender java attributes which caused the SchemaValidation problem.

          I solved it using a jaxb binding file so Calender java objects are used instead.

          binding file "bindings.xml":

          <?xml version="1.0" encoding="UTF-8" ?>
          <jaxb:bindings
          version="2.0"
          xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
          xmlns:xs="http://www.w3.org/2001/XMLSchema">
          <jaxb:globalBindings>
          <jaxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
          parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
          printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
          <jaxb:javaType name="java.util.Calendar" xmlType="xs:time"
          parseMethod="javax.xml.bind.DatatypeConverter.parseTime"
          printMethod="javax.xml.bind.DatatypeConverter.printTime"/>
          <jaxb:javaType name="java.util.Calendar" xmlType="xs:date"
          parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
          printMethod="javax.xml.bind.DatatypeConverter.printDate"/>
          <jaxb:serializable uid="1"/>
          </jaxb:globalBindings>
          </jaxb:bindings>

          and added "-b bindings.xml" to the wsimport command:

          wsimport -keep -Xnocompile -b bindings.xml some.wsdl

          Extra adapter.java files are generated for the conversion, don't forget to use them in your java project.


          Hope someone else will find this useful as well!