You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andrew Clegg <an...@nervechannel.com> on 2009/03/02 20:42:40 UTC

MalformedURLException when trying to initialize local transport, and some questions

Hi,

I've started hacking around with the local transport mechanism as
described here:

http://cwiki.apache.org/CXF20DOC/local-transport.html

However, when I try to bring it up endpoints listening on a local://
URL I get a MalformedURLException.

The code looks like this:

__endpoints[ 0 ] = Endpoint.publish( "local://CodaCathService",
        new CodaCathProvider() );
__endpoints[ 1 ] = Endpoint.publish( "local://CodaPfamService",
        new CodaPfamProvider() );
__endpoints[ 2 ] = Endpoint.publish( "local://GecoService",
        new GecoProvider() );
__endpoints[ 3 ] = Endpoint.publish( "local://HippiService",
        new HippiProvider() );

where __endpoints is an array of javax.xml.ws.Endpoint .And the
stacktrace looks like this:

javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:268)
	at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:202)
	at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:84)
	at javax.xml.ws.Endpoint.publish(Endpoint.java:170)
	at info.cathdb.funcnet.impl.EmbeddedServiceIntegrationTest.setUpClass(EmbeddedServiceIntegrationTest.java:65)
	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:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
	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: org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:139)
	at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:168)
	at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:339)
	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:252)
	... 20 more
Caused by: java.net.MalformedURLException: unknown protocol: local
	at java.net.URL.<init>(URL.java:574)
	at java.net.URL.<init>(URL.java:464)
	at java.net.URL.<init>(URL.java:413)
	at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.<init>(JettyHTTPDestination.java:91)
	at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:116)
	at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
	at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:74)
	at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
	at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
	at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:118)
	... 23 more

So it looks like this is still using the JettyHTTPTransportFactory
rather than the LocalTransportFactory. Is the example on that wiki
page complete? It seems to me that if you follow the 'in code'
example, rather than 'in XML', you don't get a chance to specify what
transport factory to use.

I should add that this is in a JUnit test where I'm trying to start
the services and call them in the same thread. For my real
configuration, once it's working in test, I've followed the 'in XML'
example and defined local:// mirrors of my http endpoints in
cxf-servlet.xml like this:

<bean class="org.apache.cxf.transport.local.LocalTransportFactory"
lazy-init="false">
	<property name="transportIds">
		<list>
			<value>http://cxf.apache.org/transports/local</value>
			<value>http://schemas.xmlsoap.org/soap/http</value>
			<value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
		</list>
	</property>
</bean>

<jaxws:endpoint id="GecoService"
 implementor="info.cathdb.funcnet.impl.GecoProvider"
 endpointName="funcnet:GecoPort"
 serviceName="funcnet:GecoService"
 address="/GecoService"
 wsdlLocation="WEB-INF/wsdl/Services.wsdl">
</jaxws:endpoint>

<jaxws:endpoint id="GecoServiceLocal"
 implementor="info.cathdb.funcnet.impl.GecoProvider"
 endpointName="funcnet:GecoPort"
 serviceName="funcnet:GecoService"
 address="local://GecoService"
 wsdlLocation="WEB-INF/wsdl/Services.wsdl">
</jaxws:endpoint>

<!-- etc. -->

I have three questions though, maybe a good idea to ask them now in
case these will be show-stoppers... Does anyone know if the local
transport has issues with:

(a) passing messages between different WARs in the same server JVM (in
this case Tomcat 6)?

(b) Provider services and Dispatch clients?

(c) The same implementation classes being published on both http and
local endpoints, as above?

Once again, many thanks!

Andrew.

-- 
:: http://biotext.org.uk/ ::

Re: MalformedURLException when trying to initialize local transport, and some questions

Posted by Andrew Clegg <an...@nervechannel.com>.
No suggestions anyone? Has anybody got this to work, and if so, could
they post a code example with a local:// URL?

Or should I just file a bug report?

Thanks,

Andrew.

2009/3/4 Andrew Clegg <an...@nervechannel.com>:
> Update...
>
> Tried adding
>
> bindingUri="http://cxf.apache.org/transports/local"
>
> as suggested in this thread:
>
> http://www.nabble.com/Can-local:---and-http:---addresses-coexist-on-the-same-server-td17916451.html
>
> to each of the local:// endpoints. Still get a MalformedURLException.
>
> Am I missing something really obvious here?
>
> The in_jvm_transport uses the coloc feature at the client end to set
> up local transport instead of server-side config. But in the thread I
> linked to above, Dan spotted that this feature has a serious bug. Was
> that ever addressed? I couldn't find anything in JIRA that looked
> relevant.
>
> Thanks,
>
> Andrew.
>
> 2009/3/2 Andrew Clegg <an...@nervechannel.com>:
>> Hi,
>>
>> I've started hacking around with the local transport mechanism as
>> described here:
>>
>> http://cwiki.apache.org/CXF20DOC/local-transport.html
>>
>> However, when I try to bring it up endpoints listening on a local://
>> URL I get a MalformedURLException.
>>
>> The code looks like this:
>>
>> __endpoints[ 0 ] = Endpoint.publish( "local://CodaCathService",
>>        new CodaCathProvider() );
>> __endpoints[ 1 ] = Endpoint.publish( "local://CodaPfamService",
>>        new CodaPfamProvider() );
>> __endpoints[ 2 ] = Endpoint.publish( "local://GecoService",
>>        new GecoProvider() );
>> __endpoints[ 3 ] = Endpoint.publish( "local://HippiService",
>>        new HippiProvider() );
>>
>> where __endpoints is an array of javax.xml.ws.Endpoint .And the
>> stacktrace looks like this:
>>
>> javax.xml.ws.WebServiceException:
>> org.apache.cxf.service.factory.ServiceConstructionException
>>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:268)
>>        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:202)
>>        at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:84)
>>        at javax.xml.ws.Endpoint.publish(Endpoint.java:170)
>>        at info.cathdb.funcnet.impl.EmbeddedServiceIntegrationTest.setUpClass(EmbeddedServiceIntegrationTest.java:65)
>>        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:597)
>>        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>>        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>>        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>>        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>>        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>>        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
>>        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: org.apache.cxf.service.factory.ServiceConstructionException
>>        at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:139)
>>        at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:168)
>>        at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:339)
>>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:252)
>>        ... 20 more
>> Caused by: java.net.MalformedURLException: unknown protocol: local
>>        at java.net.URL.<init>(URL.java:574)
>>        at java.net.URL.<init>(URL.java:464)
>>        at java.net.URL.<init>(URL.java:413)
>>        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.<init>(JettyHTTPDestination.java:91)
>>        at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:116)
>>        at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
>>        at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:74)
>>        at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
>>        at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>>        at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:118)
>>        ... 23 more
>>
>> So it looks like this is still using the JettyHTTPTransportFactory
>> rather than the LocalTransportFactory. Is the example on that wiki
>> page complete? It seems to me that if you follow the 'in code'
>> example, rather than 'in XML', you don't get a chance to specify what
>> transport factory to use.
>>
>> I should add that this is in a JUnit test where I'm trying to start
>> the services and call them in the same thread. For my real
>> configuration, once it's working in test, I've followed the 'in XML'
>> example and defined local:// mirrors of my http endpoints in
>> cxf-servlet.xml like this:
>>
>> <bean class="org.apache.cxf.transport.local.LocalTransportFactory"
>> lazy-init="false">
>>        <property name="transportIds">
>>                <list>
>>                        <value>http://cxf.apache.org/transports/local</value>
>>                        <value>http://schemas.xmlsoap.org/soap/http</value>
>>                        <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
>>                </list>
>>        </property>
>> </bean>
>>
>> <jaxws:endpoint id="GecoService"
>>  implementor="info.cathdb.funcnet.impl.GecoProvider"
>>  endpointName="funcnet:GecoPort"
>>  serviceName="funcnet:GecoService"
>>  address="/GecoService"
>>  wsdlLocation="WEB-INF/wsdl/Services.wsdl">
>> </jaxws:endpoint>
>>
>> <jaxws:endpoint id="GecoServiceLocal"
>>  implementor="info.cathdb.funcnet.impl.GecoProvider"
>>  endpointName="funcnet:GecoPort"
>>  serviceName="funcnet:GecoService"
>>  address="local://GecoService"
>>  wsdlLocation="WEB-INF/wsdl/Services.wsdl">
>> </jaxws:endpoint>
>>
>> <!-- etc. -->
>>
>> I have three questions though, maybe a good idea to ask them now in
>> case these will be show-stoppers... Does anyone know if the local
>> transport has issues with:
>>
>> (a) passing messages between different WARs in the same server JVM (in
>> this case Tomcat 6)?
>>
>> (b) Provider services and Dispatch clients?
>>
>> (c) The same implementation classes being published on both http and
>> local endpoints, as above?
>>
>> Once again, many thanks!
>>
>> Andrew.
>>
>> --
>> :: http://biotext.org.uk/ ::
>>
>
>
>
> --
> :: http://biotext.org.uk/ ::
>



-- 
:: http://biotext.org.uk/ ::

Re: MalformedURLException when trying to initialize local transport, and some questions

Posted by Andrew Clegg <an...@nervechannel.com>.
Update...

Tried adding

bindingUri="http://cxf.apache.org/transports/local"

as suggested in this thread:

http://www.nabble.com/Can-local:---and-http:---addresses-coexist-on-the-same-server-td17916451.html

to each of the local:// endpoints. Still get a MalformedURLException.

Am I missing something really obvious here?

The in_jvm_transport uses the coloc feature at the client end to set
up local transport instead of server-side config. But in the thread I
linked to above, Dan spotted that this feature has a serious bug. Was
that ever addressed? I couldn't find anything in JIRA that looked
relevant.

Thanks,

Andrew.

2009/3/2 Andrew Clegg <an...@nervechannel.com>:
> Hi,
>
> I've started hacking around with the local transport mechanism as
> described here:
>
> http://cwiki.apache.org/CXF20DOC/local-transport.html
>
> However, when I try to bring it up endpoints listening on a local://
> URL I get a MalformedURLException.
>
> The code looks like this:
>
> __endpoints[ 0 ] = Endpoint.publish( "local://CodaCathService",
>        new CodaCathProvider() );
> __endpoints[ 1 ] = Endpoint.publish( "local://CodaPfamService",
>        new CodaPfamProvider() );
> __endpoints[ 2 ] = Endpoint.publish( "local://GecoService",
>        new GecoProvider() );
> __endpoints[ 3 ] = Endpoint.publish( "local://HippiService",
>        new HippiProvider() );
>
> where __endpoints is an array of javax.xml.ws.Endpoint .And the
> stacktrace looks like this:
>
> javax.xml.ws.WebServiceException:
> org.apache.cxf.service.factory.ServiceConstructionException
>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:268)
>        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:202)
>        at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:84)
>        at javax.xml.ws.Endpoint.publish(Endpoint.java:170)
>        at info.cathdb.funcnet.impl.EmbeddedServiceIntegrationTest.setUpClass(EmbeddedServiceIntegrationTest.java:65)
>        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:597)
>        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
>        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: org.apache.cxf.service.factory.ServiceConstructionException
>        at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:139)
>        at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:168)
>        at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:339)
>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:252)
>        ... 20 more
> Caused by: java.net.MalformedURLException: unknown protocol: local
>        at java.net.URL.<init>(URL.java:574)
>        at java.net.URL.<init>(URL.java:464)
>        at java.net.URL.<init>(URL.java:413)
>        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.<init>(JettyHTTPDestination.java:91)
>        at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:116)
>        at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
>        at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:74)
>        at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
>        at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>        at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:118)
>        ... 23 more
>
> So it looks like this is still using the JettyHTTPTransportFactory
> rather than the LocalTransportFactory. Is the example on that wiki
> page complete? It seems to me that if you follow the 'in code'
> example, rather than 'in XML', you don't get a chance to specify what
> transport factory to use.
>
> I should add that this is in a JUnit test where I'm trying to start
> the services and call them in the same thread. For my real
> configuration, once it's working in test, I've followed the 'in XML'
> example and defined local:// mirrors of my http endpoints in
> cxf-servlet.xml like this:
>
> <bean class="org.apache.cxf.transport.local.LocalTransportFactory"
> lazy-init="false">
>        <property name="transportIds">
>                <list>
>                        <value>http://cxf.apache.org/transports/local</value>
>                        <value>http://schemas.xmlsoap.org/soap/http</value>
>                        <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
>                </list>
>        </property>
> </bean>
>
> <jaxws:endpoint id="GecoService"
>  implementor="info.cathdb.funcnet.impl.GecoProvider"
>  endpointName="funcnet:GecoPort"
>  serviceName="funcnet:GecoService"
>  address="/GecoService"
>  wsdlLocation="WEB-INF/wsdl/Services.wsdl">
> </jaxws:endpoint>
>
> <jaxws:endpoint id="GecoServiceLocal"
>  implementor="info.cathdb.funcnet.impl.GecoProvider"
>  endpointName="funcnet:GecoPort"
>  serviceName="funcnet:GecoService"
>  address="local://GecoService"
>  wsdlLocation="WEB-INF/wsdl/Services.wsdl">
> </jaxws:endpoint>
>
> <!-- etc. -->
>
> I have three questions though, maybe a good idea to ask them now in
> case these will be show-stoppers... Does anyone know if the local
> transport has issues with:
>
> (a) passing messages between different WARs in the same server JVM (in
> this case Tomcat 6)?
>
> (b) Provider services and Dispatch clients?
>
> (c) The same implementation classes being published on both http and
> local endpoints, as above?
>
> Once again, many thanks!
>
> Andrew.
>
> --
> :: http://biotext.org.uk/ ::
>



-- 
:: http://biotext.org.uk/ ::