8 Replies Latest reply: Sep 6, 2012 12:38 PM by 294331 RSS

    Error for class in use running wsdlc with packageName

    294331
      Running wsdlc on a wsdl... Using type=JAXWS. Works fine without a package name... The default will be used from namespace.

      However when i specify packageName getting a long stream of errors regarding class collisions for xsd generated classes!
      I know that there are multiple imports for same xsd schema in various files, but could not find a solution for this, and seems basic enough to be previously encountered by others.

      [wsdlc] [ERROR] A class/interface with the same name "MyClass" is already in use. Use a class customization to resolve this conflict.

      thanks,
      Stefan
        • 1. Re: Error for class in use running wsdlc with packageName
          294331
          to also mention one line in the log before parsing wsdl reports all the errors...
          Not to sure how to use this and if would solve the issue.

          Consider using <depends>/<produces> so that wsimport won't do unnecessary compilation

          ... and there was one more recommandation that xsd imports should be local!?
          • 2. Re: Error for class in use running wsdlc with packageName
            User696-Oracle
            Can you try using ---> packageName="Package_name" .

            Example::
            ======

            <taskdef name="wsdlc"
            classname="weblogic.wsee.tools.anttasks.WsdlcTask"/>

            <target name="generate-from-wsdl">

            <wsdlc
            srcWsdl="WSDL_file"
            destJwsDir="JWS_interface_directory"
            destImplDir="JWS_implementation_directory"
            packageName="Package_name"
                 type="WebService_type"/>
            </target>


            Regards,
            Sunil P
            • 3. Re: Error for class in use running wsdlc with packageName
              294331
              that's the option i was using!
              I realize what is happening, but still dont have a good answer... The error is valid!
              When importing the xsd schema files there are duplicates due to versions, in name spaces like: v1/Service and v2/Service...
              Without packageName option the xsd corresponding Java classes are created in different packages: v1.Service and v2.Service... When i specify package name they all try to come under "myPackageName" and of course there would be a conflict... What i want, i guess, is to generate the schema classes with name space package and only the SEI and SIB Java classes under a specific package name!?
              • 4. Re: Error for class in use running wsdlc with packageName
                User696-Oracle
                you should be looking int jax-ws data binddings
                http://docs.oracle.com/cd/E24329_01/web.1211/e24981/anttasks.htm#i1091002
                http://docs.oracle.com/cd/E24329_01/web.1211/e24964/data_types.htm#i211163

                Regards,
                Sunil P
                • 6. Re: Error for class in use running wsdlc with packageName
                  294331
                  one extra comment here... the legitimate collision issue due to multiple schema version for same "class" is only apparent in JAXWS! Same wsdlc taks with JAXRPC works fine generating package from xsd name space.
                  It is clear that the direction to control package names is using binding file, but not sure if wsdlc supports that...
                  • 7. Re: Error for class in use running wsdlc with packageName
                    User696-Oracle
                    WSDLC Supports binding file.

                    Child Elements

                    The wsdlc Ant task has the following WebLogic-specific child elements:
                    binding
                    xmlcatalog

                    http://docs.oracle.com/cd/E24329_01/web.1211/e24981/anttasks.htm#i1075708

                    Regards,
                    Sunil P
                    • 8. Re: Error for class in use running wsdlc with packageName
                      294331
                      actually looking at the link you sent found the explanation for my initial error!
                      thanks again!

                      The way wsdlc/packageName is used between JAX-RPC vs JAX-WS is completely different!!
                      With second option all classes will end-up with same package name, which is why did not see the collision with first one.
                      For me the difference looks fairly drastic, surprised there is not an option just to generate the same way...
                      Here's the actual documentation:
                      <<
                      Depending on the type of partial implementation you generate (JAX-WS or JAX-RPC), the Java package name of the generated complex data types differs, as described in the following guidelines:
                      •     For JAX-WS, if you specify the packageName attribute, then all artifacts (Java complex data types, JWS interface, and the JWS interface implementation) are generated into this package. If you want to change the package name of the generated Java complex data types in this case, use the <binding> child element of the wsdlc Ant task to specify a custom binding declarations file. For information about creating a custom binding declarations file, see "Using JAXB Data Binding" in Getting Started With JAX-WS Web Services for Oracle WebLogic Server.
                      •     For JAX-RPC, if you specify the packageName attribute of the wsdlc Ant task, only the generated JWS interface and implementation are in this package. The package name of the generated Java complex data types, however, always corresponds to the XSD Schema type namespace, whether you specify the packageName attribute or not.
                      >>