Announcement Announcement Module
Collapse
No announcement yet.
WSDL generation issue with import on WLS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WSDL generation issue with import on WLS

    Hey, and first of all I would first like to express my gratitude to you guys for providing such a good contract-first framework!

    I have an issue with generating wsdl-files with 1.5 release. The imported file is not found when deployed on the WebLogic Server 8.1: (it works fine in Jetty).

    <bean id="sc" class="org.springframework.xml.xsd.commons.Commons XsdSchemaCollection">
    <property name="xsds">
    <list>
    <value>/WEB-INF/xsd/PropertyMessages.xsd</value>
    </list>
    </property>
    <property name="inline" value="true" />
    </bean>

    Where PropertyMessages.xsd has can import of PropertyTypes.xsd:

    <xs:import namespace="xxx" schemaLocation="PropertyTypes.xsd">
    </xs:import>

    But PropertyTypes.xsd is not found. That's what the Norwegian error says in the following stacktrace:


    Caused by: org.apache.ws.commons.schema.XmlSchemaException: C:\bea81\testwls\mydomain\PropertyTypes.xsd (Systemet finner ikke angitt fil)
    at org.apache.ws.commons.schema.XmlSchemaCollection.r ead(XmlSchemaCollection.java:308)
    at org.apache.ws.commons.schema.SchemaBuilder.resolve XmlSchema(SchemaBuilder.java:1884)
    at org.apache.ws.commons.schema.SchemaBuilder.handleI mport(SchemaBuilder.java:1620)
    at org.apache.ws.commons.schema.SchemaBuilder.handleX mlSchemaElement(SchemaBuilder.java:175)
    at org.apache.ws.commons.schema.SchemaBuilder.build(S chemaBuilder.java:82)
    at org.apache.ws.commons.schema.XmlSchemaCollection.r ead(XmlSchemaCollection.java:359)
    at org.apache.ws.commons.schema.XmlSchemaCollection.r ead(XmlSchemaCollection.java:304)
    at org.apache.ws.commons.schema.XmlSchemaCollection.r ead(XmlSchemaCollection.java:315)
    at org.springframework.xml.xsd.commons.CommonsXsdSche maCollection.afterPropertiesSet(CommonsXsdSchemaCo llection.java:109)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1333)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1299)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:463)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:404)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:375)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 63)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:170)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:260 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:184)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:163)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:269)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:104)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1210)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:978)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:462)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:404)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:375)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 63)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:170)


    It looks for the file in the root of the application server.

    Is there a way to solve this? Having it look inside the deployed war-file.

    Best regards,
    Tor

  • #2
    Confirming issue

    I do get the same problem.

    May be irrelevant, but I did notice I have a maven dependency on spring-ws 1.5.0. However I notice in the build that ws-core is is version rc1: spring-ws-core-1.5.0-rc1.jar , while all ther other ws jars are 1.5.0


    This is my xml

    Code:
    	<bean id="schemas" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
    	    <property name="xsds">
    	        <list>
    	            <value>classpath:blah/blah/blah/messages/QuizMessages.xsd</value>
    	            <value>classpath:blah/blah/blah/elements/QuizElements.xsd</value>
    	        </list>
    	    </property>
    	    <property name="inline" value="true"/>
    	</bean>
    Where in the messages xsd I have this:

    Code:
    	 <import namespace="http://blah.blah.blah/blah/elements" 
    	 		schemaLocation="../elements/QuizElements.xsd" />
    and this is the top stack

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemas' defined in class path resource [endpoints.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.ws.commons.schema.XmlSchemaException: C:\Code\trunk\elements\QuizElements.xsd (The system cannot find the path specified)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1302)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:463)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:430)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)

    further down


    Code:
    Caused by: java.lang.RuntimeException: org.apache.ws.commons.schema.XmlSchemaException: C:\Code\trunk\elements\QuizElements.xsd (The system cannot find the path specified)
    	at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1886)
    	at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:1620)
    	at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:175)
    	at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
    	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)

    and further down

    Code:
    java.lang.RuntimeException: org.apache.ws.commons.schema.XmlSchemaException: C:\Code\trunk\elements\QuizElements.xsd (The system cannot find the path specified)
    	at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1886)
    	at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:1620)
    	at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:175)
    	at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:82)
    	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:359)
    	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:304)
    	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:315)
    	at org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection.afterPropertiesSet(CommonsXsdSchemaCollection.java:109)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1333)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1299)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:463)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
    	at java.security.AccessController.doPrivileged(Native Method)

    Comment


    • #3
      removed my rc1 transative dependencies. So the problem exists with 1.5.0 release

      Comment


      • #4
        I encounter this problem in jetty btw.

        Comment


        • #5
          Circumvented the issue since i merged to one xsd and not using the schemacollection bean.

          Now use this instead
          Code:
          <property name="schema">
           		     <bean class="org.springframework.xml.xsd.SimpleXsdSchema">
                 			<property name="xsd" value="classpath:blah/blah/QuizMessages.xsd"/>
               		</bean>
               	</property>
          But will eventually use collection again. Presume perhaps that the collection is an Apache Commons XSD style. could that be the issue?

          Comment


          • #6
            This seems more a Commons XSD SChema bug, which doesn't seem to resolve files they way it should. We can try to fix this by writing our own org.apache.ws.commons.schema.resolver.URIResolver, and make it a bit more clever than the default.

            Flurdy, could you please create a JIRA issue for this?

            Thanks

            Comment


            • #7
              Maybe wait for xmlschema 1.4.2

              Well, maybe it's fixed in apache ws xmlschema 1.4.2.

              The vote is ongoing, see http://marc.info/?l=axis-dev&m=120849698030494&w=2

              Comment


              • #9
                Well, I don't think I said I *know* this is fixed and I certainly didn't mean to say that. Arjen suggested that it looks like a "Commons XSD Schema bug".

                Based on this assumption, I was merely suggesting that it *might* be fixed in the upcoming release of xmlschema (1.4.2). On the other hand, it is entirely possible that it doesn't work at all, or that other features of Spring-WS that rely upon xmlschema don't work anymore with this release due to API changes in 1.4.2.

                You can check for yourself with the (unofficial) zips at http://people.apache.org/~dims/axis2-1.4-commons/ (but you're on your own).

                Comment


                • #10
                  Update: a (mirrored) official release can be found at http://apache.mirrors.webazilla.nl/w...lSchema/1_4_2/
                  (and other apache mirrors of course).

                  Comment


                  • #11
                    Originally posted by Arjen Poutsma View Post
                    This seems more a Commons XSD SChema bug, which doesn't seem to resolve files they way it should. We can try to fix this by writing our own org.apache.ws.commons.schema.resolver.URIResolver, and make it a bit more clever than the default.

                    Flurdy, could you please create a JIRA issue for this?

                    Thanks
                    Someone else created a JIRA issue regarding this:
                    http://jira.springframework.org/browse/SWS-362

                    Comment


                    • #12
                      JIRA issue 362
                      http://jira.springframework.org/browse/SWS-362
                      was opened by Oliver regarding this specific issue.

                      Comment


                      • #13
                        This is still broken in 1.4.2.

                        If Spring WS's CommonsXsdSchemaCollection could inject the XmlSchemaCollection. Then you could call setSchemaResolver() to use a custom URIResolver that was more intelligent.

                        Comment


                        • #14
                          Here is my solution that seems to work. I am able to resolve schemeas loaded from both the file system and the classloader.

                          import org.apache.ws.commons.schema.resolver.URIResolver;
                          import org.slf4j.Logger;
                          import org.slf4j.LoggerFactory;
                          import org.springframework.core.io.Resource;
                          import org.springframework.core.io.UrlResource;
                          import org.xml.sax.InputSource;

                          public class DefaultUriResolver implements URIResolver {

                          private final Logger logger = LoggerFactory.getLogger(DefaultUriResolver.class);

                          /**
                          * As for the resolver the publid ID is the target namespace of the
                          * schema and the schemaLocation is the value of the schema location
                          * @param namespace
                          * @param schemaLocation
                          * @param baseUri
                          */
                          public InputSource resolveEntity(String namespace,
                          String schemaLocation,
                          String baseUri){

                          if (baseUri!=null)
                          {
                          try
                          {
                          logger.trace("namespace={}, schemaLocation={}, baseUri={}", new Object[] {namespace, schemaLocation, baseUri});

                          UrlResource uri = new UrlResource(baseUri);
                          Resource ref = uri.createRelative(schemaLocation);

                          logger.trace("ref={}", ref);

                          return new InputSource(ref.getURI().toString());
                          }
                          catch (Exception ex)
                          {
                          logger.warn("Invalid URI", ex);
                          throw new RuntimeException(ex);
                          }

                          }
                          return new InputSource(schemaLocation);
                          }
                          }

                          Comment

                          Working...
                          X