You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by MartyH <ma...@singularity.co.uk> on 2007/08/13 14:58:03 UTC

Dynamic Client issue ObjectFactory

Hi folks,
Having a problem with the Dynamic client on some wsdl.  Basically I'm
getting this on attempting to generate the client:

java.lang.RuntimeException: Error compiling schema from WSDL at {
http://localhost:8080/donkey/services/service?wsdl}: Two declarations cause
a collision in the ObjectFactory class.
    at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory$InnerErrorListener.error(DynamicClientFactory.java:409)
    at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.error(SchemaCompilerImpl.java:245)
    at
com.sun.tools.xjc.util.ErrorReceiverFilter.error(ErrorReceiverFilter.java:61)
    at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:66)
    at
com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:150)
    at
com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate(PublicObjectFactoryGenerator.java:19)
    at
com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:210)
    at
com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:151)
    at com.sun.tools.xjc.model.Model.generateCode(Model.java:226)
    at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:211)
    at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:66)
    at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:166)
    at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:137)
    at
com.donkey.donkey.scaffold.service.DynamicService.constructClient(Dynamicervice.java:92)
    at
com.donkey.donkey.scaffold.service.DynamicService.<init>(DynamicService.java:36)
    at
com.donkey.donkey.scaffold.service.DynamicServiceTest.testInvoke(DynamicServiceTest.java:20)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: com.sun.istack.SAXParseException2: Two declarations cause a
collision in the ObjectFactory class.
    ... 31 more

on looking at the unoffical jaxb guide:
https://jaxb.dev.java.net/guide/Dealing_with_errors.html

its telling me to use a factoryMethod on the conflicting methods/whatever...
however I'm not sure how to do this within cxf.
Anyone else come across anything like this?

Marty


-- 
View this message in context: http://www.nabble.com/Dynamic-Client-issue-ObjectFactory-tf4261045.html#a12125687
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Dynamic Client issue ObjectFactory

Posted by MartyH <ma...@singularity.co.uk>.
Dan, 
done.  https://issues.apache.org/jira/browse/CXF-932

Still need to have a think about the best way to handle this though... 
-- 
View this message in context: http://www.nabble.com/Dynamic-Client-issue-ObjectFactory-tf4261045.html#a12270739
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Dynamic Client issue ObjectFactory

Posted by Dan Diephouse <da...@envoisolutions.com>.
Hmm... Catch the exception and throw it to the user? Maybe we should allow
people to specify their own ErrorListeners? I'm really not sure. How would
you *like* to handle it? :-)

Any chance you could open a JIRA issue for this? We can try and work out a
solution for a future release. The "allow a user to point a program at a
wsdl at runtime" is an important one.

- Dan

On 8/17/07, MartyH <ma...@singularity.co.uk> wrote:
>
>
> Hi Dan,
>
> Not at all :-)
>
> I see what you're saying, and thinking of it like that makes sense.  If I
> have to specify customisations, then its not really dynamic at all then is
> it?  And the whole point of what i'm doing is to be dynamic with it.
>
> Ok then, as I need to point cxf at a variety of random wsdl's (specified
> by
> a user).... how can i deal with this error should it occur?
>
> Marty
> --
> View this message in context:
> http://www.nabble.com/Dynamic-Client-issue-ObjectFactory-tf4261045.html#a12196297
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Re: Dynamic Client issue ObjectFactory

Posted by MartyH <ma...@singularity.co.uk>.
Hi Dan,

Not at all :-)

I see what you're saying, and thinking of it like that makes sense.  If I
have to specify customisations, then its not really dynamic at all then is
it?  And the whole point of what i'm doing is to be dynamic with it.

Ok then, as I need to point cxf at a variety of random wsdl's (specified by
a user).... how can i deal with this error should it occur?

Marty
-- 
View this message in context: http://www.nabble.com/Dynamic-Client-issue-ObjectFactory-tf4261045.html#a12196297
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Dynamic Client issue ObjectFactory

Posted by Dan Diephouse <da...@envoisolutions.com>.
Hi Marty,

Unfortunately with the DynamicClientFactory there is no way to specify a
schemaBindings file currently. You could add a feature request for it, but
it seems of dubious value to me at first glance. The whole point of the DCF
is that you don't have to do any build time work to use the client. If
you're going to write a schemaBindings file ahead of time for your service,
you might as well just generate a client using wsdl2java at build time. This
also means that you don't have to go through the compilation phase at
runtime to use the service, which can be quite slow. So I would recommend
checking out the wsdl2java tool and specifying a binding file at compile
time.

Or am I missing something here?

- Dan

On 8/13/07, MartyH <ma...@singularity.co.uk> wrote:
>
>
> Hi folks,
> Having a problem with the Dynamic client on some wsdl.  Basically I'm
> getting this on attempting to generate the client:
>
> java.lang.RuntimeException: Error compiling schema from WSDL at {
> http://localhost:8080/donkey/services/service?wsdl}: Two declarations
> cause
> a collision in the ObjectFactory class.
>     at
>
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory$InnerErrorListener.error
> (DynamicClientFactory.java:409)
>     at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.error(
> SchemaCompilerImpl.java:245)
>     at
> com.sun.tools.xjc.util.ErrorReceiverFilter.error(ErrorReceiverFilter.java
> :61)
>     at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:66)
>     at
> com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(
> ObjectFactoryGeneratorImpl.java:150)
>     at
> com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate(
> PublicObjectFactoryGenerator.java:19)
>     at
> com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java
> :210)
>     at
> com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java
> :151)
>     at com.sun.tools.xjc.model.Model.generateCode(Model.java:226)
>     at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(
> SchemaCompilerImpl.java:211)
>     at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(
> SchemaCompilerImpl.java:66)
>     at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(
> DynamicClientFactory.java:166)
>     at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(
> DynamicClientFactory.java:137)
>     at
> com.donkey.donkey.scaffold.service.DynamicService.constructClient(
> Dynamicervice.java:92)
>     at
> com.donkey.donkey.scaffold.service.DynamicService.<init>(
> DynamicService.java:36)
>     at
> com.donkey.donkey.scaffold.service.DynamicServiceTest.testInvoke(
> DynamicServiceTest.java:20)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
> :39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:585)
>     at junit.framework.TestCase.runTest(TestCase.java:154)
>     at junit.framework.TestCase.runBare(TestCase.java:127)
>     at junit.framework.TestResult$1.protect(TestResult.java:106)
>     at junit.framework.TestResult.runProtected(TestResult.java:124)
>     at junit.framework.TestResult.run(TestResult.java:109)
>     at junit.framework.TestCase.run(TestCase.java:118)
>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
>     at junit.framework.TestSuite.run(TestSuite.java:203)
>     at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(
> JUnit3TestReference.java:128)
>     at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java
> :38)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:460)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:673)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
> RemoteTestRunner.java:386)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
> RemoteTestRunner.java:196)
> Caused by: com.sun.istack.SAXParseException2: Two declarations cause a
> collision in the ObjectFactory class.
>     ... 31 more
>
> on looking at the unoffical jaxb guide:
> https://jaxb.dev.java.net/guide/Dealing_with_errors.html
>
> its telling me to use a factoryMethod on the conflicting
> methods/whatever...
> however I'm not sure how to do this within cxf.
> Anyone else come across anything like this?
>
> Marty
>
>
> --
> View this message in context:
> http://www.nabble.com/Dynamic-Client-issue-ObjectFactory-tf4261045.html#a12125687
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog