This discussion is archived
4 Replies Latest reply: Oct 31, 2012 10:12 AM by 963521 RSS

Problems with JAX-WS and @SchemaValidation

963521 Newbie
Currently Being Moderated
Hello,

i am deploying into wl11gR1 (wl10.3.5) an application with a few webservices implemented using JAX-WS and Stateless EJB JWS implementation. The WS uses resources from a WSDL with a complex XSD system (multiple dependendies). Problems appears when add the @SchemaValidation anottation. The trace is:

javax.xml.ws.WebServiceException: org.xml.sax.SAXParseException: src-resolve.4.2: Error resolving component 'ns2:testElementType'. It was detected that 'ns2:testElementType' is in namespace 'test-namespace', but components from this namespace are not referenceable from schema document 'file:/TestService_schema6.xsd'. If this is the incorrect namespace, perhaps the prefix of 'ns2:testElementType' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/TestService_schema6.xsd'.
     at com.sun.xml.ws.server.ServerSchemaValidationTube.<init>(ServerSchemaValidationTube.java:69)
     at com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext.createValidationTube(ServerTubeAssemblerContext.java:221)
     at weblogic.wsee.jaxws.tubeline.standard.StandardTubelineDeploymentListener$17.createServer(StandardTubelineDeploymentListener.java:191)
     at weblogic.wsee.jaxws.WLSTubelineAssemblerFactory$TubelineAssemblerImpl.createServer(WLSTubelineAssemblerFactory.java:216)
     at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:213)
     at weblogic.wsee.jaxws.WLSContainer$WLSEndpointFactory$WLSEndpointImpl.<init>(WLSContainer.java:623)
     at weblogic.wsee.jaxws.WLSContainer$WLSEndpointFactory.createEndpoint(WLSContainer.java:576)
     at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:231)
     at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:496)
     at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:539)
     at weblogic.wsee.jaxws.JAXWSDeployedServlet.getEndpoint(JAXWSDeployedServlet.java:183)
     at weblogic.wsee.jaxws.JAXWSServlet.registerEndpoint(JAXWSServlet.java:135)
     at weblogic.wsee.jaxws.JAXWSServlet.init(JAXWSServlet.java:64)
     at weblogic.wsee.jaxws.JAXWSDeployedServlet.init(JAXWSDeployedServlet.java:54)
     at javax.servlet.GenericServlet.init(GenericServlet.java:241)
     at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
     at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
     at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
     at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
     at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
     at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
     at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
     at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
     at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
     at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
     at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
     at weblogic.wsee.deploy.WseeWebappModule.activate(WseeWebappModule.java:146)
     at weblogic.wsee.deploy.WSEEEjbModule.activate(WSEEEjbModule.java:414)
     at weblogic.wsee.deploy.AppDeploymentExtensionFactory.activate(AppDeploymentExtensionFactory.java:112)
     at weblogic.wsee.deploy.AppDeploymentExtensionFactory.access$200(AppDeploymentExtensionFactory.java:15)
     at weblogic.wsee.deploy.AppDeploymentExtensionFactory$1.activate(AppDeploymentExtensionFactory.java:186)
     at weblogic.application.internal.flow.AppDeploymentExtensionFlow.activate(AppDeploymentExtensionFlow.java:37)
     at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
     at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
     at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
     at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
     at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
     at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
     at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
     at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
     at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
     at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
     at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
     at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
     at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
     at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
     at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
     at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
     at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
     at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
     at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: org.xml.sax.SAXParseException: src-resolve.4.2: Error resolving component 'ns2:testElementType'. It was detected that 'ns2:testElementType' is in namespace 'test-namespace', but components from this namespace are not referenceable from schema document 'TestService_schema6.xsd'. If this is the incorrect namespace, perhaps the prefix of 'ns2:testElementType' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/TestService_schema6.xsd'.
     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:2541)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2528)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1387)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:369)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:179)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:121)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractParticleTraverser.traverseSeqChoice(XSDAbstractParticleTraverser.java:216)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractParticleTraverser.traverseSequence(XSDAbstractParticleTraverser.java:146)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(XSDComplexTypeTraverser.java:971)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(XSDComplexTypeTraverser.java:279)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseLocal(XSDComplexTypeTraverser.java:133)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:356)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:179)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:121)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractParticleTraverser.traverseSeqChoice(XSDAbstractParticleTraverser.java:216)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractParticleTraverser.traverseSequence(XSDAbstractParticleTraverser.java:146)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(XSDComplexTypeTraverser.java:971)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexContent(XSDComplexTypeTraverser.java:774)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(XSDComplexTypeTraverser.java:260)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseLocal(XSDComplexTypeTraverser.java:133)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:356)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:179)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseLocalElements(XSDHandler.java:2049)
     at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:582)
     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552)
     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:519)
     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:485)
     at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:211)
     at com.sun.xml.ws.server.ServerSchemaValidationTube.<init>(ServerSchemaValidationTube.java:67)
     ... 53 more

This exception is thrown at deploy time. If we remove @SchemaValidation application works correctly

Thanks in advance for your help!
Leo
  • 1. Re: Problems with JAX-WS and @SchemaValidation
    user696 Explorer
    Currently Being Moderated
    Looking at error
    Caused by: org.xml.sax.SAXParseException: src-resolve.4.2: Error resolving component 'ns2:testElementType'. It was detected that 'ns2:testElementType' is in namespace 'test-namespace', but components from this namespace are not referenceable from schema document 'TestService_schema6.xsd'. If this is the incorrect namespace, perhaps the prefix of 'ns2:testElementType' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/TestService_schema6.xsd'.


    please check TestService_schema6.xsd has the component testElementType
    'ns2:testElementType' is in namespace 'test-namespace', but components from this namespace are not referenceable from schema document 'TestService_schema6.xsd'

    HTH
    Regards,
    Sunil P
  • 2. Re: Problems with JAX-WS and @SchemaValidation
    963521 Newbie
    Currently Being Moderated
    Hi Sunil,

    all the schemas are correct; we validated all of them. The xsd's structure is similar to this:

    * serivice.wsdl : imports schema1.xsd , schema2.xsd, schema3.xsd, schema4.xsd, schema5.xsd and schema6.xsd
    * schema2.xsd : imports schema5.xsd
    * schema4.xsd : imports schema5.xsd
    * schema6.xsd : imports schema5.xsd, imports schema1.xsd

    If we remove the SchemaValidation annotation and follow all the schema imports links we find that schema6.xsd published doesn't have import schema5.xsd sentence. This reference is lost but exists in the original xml schema. The wsdlLocation attribute is setted in the JWS.

    ** The schema6.xsd is the equivalent to the TestService_schema6.xsd but server changes xsd name when WS is published (the name of all the imported xsd are changed).

    Regards and thanks for your reply,
    Leo
  • 3. Re: Problems with JAX-WS and @SchemaValidation
    760953 Newbie
    Currently Being Moderated
    If you have @schemavalidation for your endpoint, it expects the scema to be deployed in the classpath. For example we have it deployed in a folder under WEB-INF. Could the schema deployed here be missing the element?

    cheers
    Lalitha
  • 4. Re: Problems with JAX-WS and @SchemaValidation
    963521 Newbie
    Currently Being Moderated
    Hi Lalitha,

    all the schemas are fine. Today we change the wsdlLocation atribute to try another location for this files and we obtain the same error BUT then we've seen that wsdlLocation was wrong! No errors located in logs about wsdlLocation.

    We were putting all xsds and schemas into META-INF/wsdl dir into the webservices module source dir. We try to set the wsdl into source root directory but it doesn't work. We're working with Oracle Eclipse Pluggin.

    The Statless EJB JWS implements an interface wichs defines the WS. This interface is into a library jar with all the JAXB classes extracted from the wsdl by wsimport. We use this library in other projects with glassfish and we doesn't have any problem. Into this jar exists a META-INF/wsdl dir with all required wsdl and schemas.

    Thanks and regards
    Leo

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points