You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cj91 <Jo...@argushealth.com> on 2009/08/13 00:46:20 UTC

Exception using local transport: "Non-default namespace can not map to empty URI"

Hi everyone, just working unit testing a service and interceptor. I would
like to launch the service using the local transport, create a proxy, send
some requests/back worth while monitoring the interceptor.

I'm getting this stack trace on execution and i'm completely stuck. I
disabled my custom interceptor until I figure out what's going on:
org.apache.cxf.interceptor.Fault: Could not write to XMLStreamWriter.
	at
org.apache.cxf.interceptor.WrappedOutInterceptor.handleMessage(WrappedOutInterceptor.java:74)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:74)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
	at
org.apache.cxf.transport.local.LocalConduit$1$1.run(LocalConduit.java:132)
	at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.stream.XMLStreamException: Non-default namespace can
not map to empty URI (as per Namespace 1.0 # 2) in XML 1.0 documents
	at
com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1467)
	at
com.ctc.wstx.sw.BaseNsStreamWriter.setPrefix(BaseNsStreamWriter.java:209)
	at
org.apache.cxf.interceptor.WrappedOutInterceptor.handleMessage(WrappedOutInterceptor.java:70)
	... 6 more

Here is the code I'm using to generate server/proxy:
	@BeforeClass
	public static void setupForTesting(){
		ServerFactoryBean svrFactory = new ServerFactoryBean();
		svrFactory.setServiceClass(AService.class);
		svrFactory.setAddress("cxf:vm://local/AService/1.0"); 
		svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
		svrFactory.setServiceBean(new AServiceImpl());
		svrFactory.setInInterceptors(getInInterceptors());
		svrFactory.setInInterceptors(getOutInterceptors());
		svrFactory.setServiceName(new QName("AService/1.0"));
		svrFactory.create();
		
		ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
		factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
		factory.setServiceClass(AService.class); 
		factory.setAddress("cxf:vm://local/AService/1.0"); 
		aServiceProxy  = (AService) factory.create();
	}

	@SuppressWarnings("unchecked")
	private static List<Interceptor> getOutInterceptors() {
		List<Interceptor> list = new ArrayList<Interceptor>();
		//list.add((Interceptor)
context.getBean("ut.simple.cxf.SimpleUsageTrackingCXFInterceptor"));
		return list;
	}

	@SuppressWarnings("unchecked")
	private static List<Interceptor> getInInterceptors() {
		List<Interceptor> list = new ArrayList<Interceptor>();
		list.add(new org.apache.cxf.binding.soap.saaj.SAAJInInterceptor());
		list.add(new
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor(getSecurityProperties()));
		//list.add((Interceptor)
context.getBean("ut.simple.cxf.SimpleUsageTrackingCXFInterceptor"));
		return list;
	}


Thanks guys, i'm going to keep poking away here.



-- 
View this message in context: http://www.nabble.com/Exception-using-local-transport%3A-%22Non-default-namespace-can-not-map-to-empty-URI%22-tp24943449p24943449.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Exception using local transport: "Non-default namespace can not map to empty URI"

Posted by "Fisher, Jonathan" <Jo...@argushealth.com>.
Thank you Daniel. Your patience and attention to detail on this list
makes this project makes CXF one of the best projects in Apache.

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Thursday, August 13, 2009 3:27 PM
To: users@cxf.apache.org
Cc: Fisher, Jonathan
Subject: Re: Exception using local transport: "Non-default namespace can
not map to empty URI"


If you just comment out the line:

svrFactory.setServiceName(new QName("AService/1.0"));

You should be all set.   The test fails due to the object not really
have a 
.equals method on it, but the IO works fine.


Dan


On Thu August 13 2009 11:48:28 am Fisher, Jonathan wrote:
> Daniel I'll be honest, I've written very few patches and I'm not sure
> what an easy to understand test case looks like. See attached maven
(and
> eclipse) project, just run "mvn clean test" to reproduce the error.
>
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Thursday, August 13, 2009 9:35 AM
> To: users@cxf.apache.org
> Cc: Fisher, Jonathan
> Subject: Re: Exception using local transport: "Non-default namespace
can
> not map to empty URI"
>
>
> Can you create a sample testcase?
>
> My gut feeling is it stems from:
> svrFactory.setServiceName(new QName("AService/1.0"));
>
> I'm think if you set a namespace on that instead of using the
> default/empty
> namespace, it may work better.   (likewise client side)
>
> Basically, it's trying to write out the wrapper element name, but for
> some
> reason, the namespace is empty which isn't allowed at that point.
With
> the
> simple frontend, that would normally be the namespace of the service,
so
> you
> may need to set that on the factory to make sure it gets a namespace.
>
> Dan
>
> On Thu August 13 2009 9:52:24 am cj91 wrote:
> > After solving the security exception, I'm back to the above error.
>
> Rather
>
> > than double-posting, I'm reviving this thread.
> >
> > Here is the current way I'm generating my service/proxy:
> > 	@BeforeClass
> > 	public static void setupForTesting(){
> > 		ServerFactoryBean svrFactory = new ServerFactoryBean();
> > 		svrFactory.setServiceClass(AService.class);
> > 		svrFactory.setAddress("cxf:vm://local/AService/1.0");
>
> svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
>
> > 		svrFactory.setServiceBean(new AServiceImpl());
> > 		//svrFactory.setInInterceptors(getInInterceptors());
> > 		//svrFactory.setOutInterceptors(getOutInterceptors());
> > 		svrFactory.setServiceName(new QName("AService/1.0"));
> > 		svrFactory.create();
> >
> > 		ClientProxyFactoryBean factory = new
>
> ClientProxyFactoryBean();
>
> factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
>
> > 		factory.setServiceClass(AService.class);
> > 		factory.setAddress("cxf:vm://local/AService/1.0");
> > 		aServiceProxy  = (AService) factory.create();
> > 	}
> >
> > Googling is no help, and this forum only yields one hit, but the
>
> problem
>
> > was never solved. Anyone have a working example of the vm/local
>
> transport?

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

PRIVILEGED AND CONFIDENTIAL
This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above.  If the reader of the email is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any use, dissemination or copying of this email transmission is strictly prohibited by the sender.  If you have received this transmission in error, please delete the email and immediately notify the sender via the email return address or mailto:postmaster@argushealth.com.  Thank you.





Re: Exception using local transport: "Non-default namespace can not map to empty URI"

Posted by Daniel Kulp <dk...@apache.org>.
If you just comment out the line:

svrFactory.setServiceName(new QName("AService/1.0"));

You should be all set.   The test fails due to the object not really have a 
.equals method on it, but the IO works fine.


Dan


On Thu August 13 2009 11:48:28 am Fisher, Jonathan wrote:
> Daniel I'll be honest, I've written very few patches and I'm not sure
> what an easy to understand test case looks like. See attached maven (and
> eclipse) project, just run "mvn clean test" to reproduce the error.
>
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Thursday, August 13, 2009 9:35 AM
> To: users@cxf.apache.org
> Cc: Fisher, Jonathan
> Subject: Re: Exception using local transport: "Non-default namespace can
> not map to empty URI"
>
>
> Can you create a sample testcase?
>
> My gut feeling is it stems from:
> svrFactory.setServiceName(new QName("AService/1.0"));
>
> I'm think if you set a namespace on that instead of using the
> default/empty
> namespace, it may work better.   (likewise client side)
>
> Basically, it's trying to write out the wrapper element name, but for
> some
> reason, the namespace is empty which isn't allowed at that point.   With
> the
> simple frontend, that would normally be the namespace of the service, so
> you
> may need to set that on the factory to make sure it gets a namespace.
>
> Dan
>
> On Thu August 13 2009 9:52:24 am cj91 wrote:
> > After solving the security exception, I'm back to the above error.
>
> Rather
>
> > than double-posting, I'm reviving this thread.
> >
> > Here is the current way I'm generating my service/proxy:
> > 	@BeforeClass
> > 	public static void setupForTesting(){
> > 		ServerFactoryBean svrFactory = new ServerFactoryBean();
> > 		svrFactory.setServiceClass(AService.class);
> > 		svrFactory.setAddress("cxf:vm://local/AService/1.0");
>
> svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
>
> > 		svrFactory.setServiceBean(new AServiceImpl());
> > 		//svrFactory.setInInterceptors(getInInterceptors());
> > 		//svrFactory.setOutInterceptors(getOutInterceptors());
> > 		svrFactory.setServiceName(new QName("AService/1.0"));
> > 		svrFactory.create();
> >
> > 		ClientProxyFactoryBean factory = new
>
> ClientProxyFactoryBean();
>
> factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
>
> > 		factory.setServiceClass(AService.class);
> > 		factory.setAddress("cxf:vm://local/AService/1.0");
> > 		aServiceProxy  = (AService) factory.create();
> > 	}
> >
> > Googling is no help, and this forum only yields one hit, but the
>
> problem
>
> > was never solved. Anyone have a working example of the vm/local
>
> transport?

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

RE: Exception using local transport: "Non-default namespace can not map to empty URI"

Posted by "Fisher, Jonathan" <Jo...@argushealth.com>.
Daniel I'll be honest, I've written very few patches and I'm not sure
what an easy to understand test case looks like. See attached maven (and
eclipse) project, just run "mvn clean test" to reproduce the error. 


-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Thursday, August 13, 2009 9:35 AM
To: users@cxf.apache.org
Cc: Fisher, Jonathan
Subject: Re: Exception using local transport: "Non-default namespace can
not map to empty URI"


Can you create a sample testcase?

My gut feeling is it stems from:
svrFactory.setServiceName(new QName("AService/1.0"));

I'm think if you set a namespace on that instead of using the
default/empty 
namespace, it may work better.   (likewise client side)

Basically, it's trying to write out the wrapper element name, but for
some 
reason, the namespace is empty which isn't allowed at that point.   With
the 
simple frontend, that would normally be the namespace of the service, so
you 
may need to set that on the factory to make sure it gets a namespace.

Dan




On Thu August 13 2009 9:52:24 am cj91 wrote:
> After solving the security exception, I'm back to the above error.
Rather
> than double-posting, I'm reviving this thread.
>
> Here is the current way I'm generating my service/proxy:
> 	@BeforeClass
> 	public static void setupForTesting(){
> 		ServerFactoryBean svrFactory = new ServerFactoryBean();
> 		svrFactory.setServiceClass(AService.class);
> 		svrFactory.setAddress("cxf:vm://local/AService/1.0");
>
svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
> 		svrFactory.setServiceBean(new AServiceImpl());
> 		//svrFactory.setInInterceptors(getInInterceptors());
> 		//svrFactory.setOutInterceptors(getOutInterceptors());
> 		svrFactory.setServiceName(new QName("AService/1.0"));
> 		svrFactory.create();
>
> 		ClientProxyFactoryBean factory = new
ClientProxyFactoryBean();
>
factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
> 		factory.setServiceClass(AService.class);
> 		factory.setAddress("cxf:vm://local/AService/1.0");
> 		aServiceProxy  = (AService) factory.create();
> 	}
>
> Googling is no help, and this forum only yields one hit, but the
problem
> was never solved. Anyone have a working example of the vm/local
transport?

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

PRIVILEGED AND CONFIDENTIAL
This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above.  If the reader of the email is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any use, dissemination or copying of this email transmission is strictly prohibited by the sender.  If you have received this transmission in error, please delete the email and immediately notify the sender via the email return address or mailto:postmaster@argushealth.com.  Thank you.




Re: Exception using local transport: "Non-default namespace can not map to empty URI"

Posted by Daniel Kulp <dk...@apache.org>.
Can you create a sample testcase?

My gut feeling is it stems from:
svrFactory.setServiceName(new QName("AService/1.0"));

I'm think if you set a namespace on that instead of using the default/empty 
namespace, it may work better.   (likewise client side)

Basically, it's trying to write out the wrapper element name, but for some 
reason, the namespace is empty which isn't allowed at that point.   With the 
simple frontend, that would normally be the namespace of the service, so you 
may need to set that on the factory to make sure it gets a namespace.

Dan




On Thu August 13 2009 9:52:24 am cj91 wrote:
> After solving the security exception, I'm back to the above error. Rather
> than double-posting, I'm reviving this thread.
>
> Here is the current way I'm generating my service/proxy:
> 	@BeforeClass
> 	public static void setupForTesting(){
> 		ServerFactoryBean svrFactory = new ServerFactoryBean();
> 		svrFactory.setServiceClass(AService.class);
> 		svrFactory.setAddress("cxf:vm://local/AService/1.0");
> 		svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
> 		svrFactory.setServiceBean(new AServiceImpl());
> 		//svrFactory.setInInterceptors(getInInterceptors());
> 		//svrFactory.setOutInterceptors(getOutInterceptors());
> 		svrFactory.setServiceName(new QName("AService/1.0"));
> 		svrFactory.create();
>
> 		ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
> 		factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
> 		factory.setServiceClass(AService.class);
> 		factory.setAddress("cxf:vm://local/AService/1.0");
> 		aServiceProxy  = (AService) factory.create();
> 	}
>
> Googling is no help, and this forum only yields one hit, but the problem
> was never solved. Anyone have a working example of the vm/local transport?

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Exception using local transport: "Non-default namespace can not map to empty URI"

Posted by cj91 <Jo...@argushealth.com>.
After solving the security exception, I'm back to the above error. Rather
than double-posting, I'm reviving this thread.

Here is the current way I'm generating my service/proxy:
	@BeforeClass
	public static void setupForTesting(){
		ServerFactoryBean svrFactory = new ServerFactoryBean();
		svrFactory.setServiceClass(AService.class);
		svrFactory.setAddress("cxf:vm://local/AService/1.0"); 
		svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
		svrFactory.setServiceBean(new AServiceImpl());
		//svrFactory.setInInterceptors(getInInterceptors());
		//svrFactory.setOutInterceptors(getOutInterceptors());
		svrFactory.setServiceName(new QName("AService/1.0"));
		svrFactory.create();
		
		ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
		factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
		factory.setServiceClass(AService.class); 
		factory.setAddress("cxf:vm://local/AService/1.0"); 
		aServiceProxy  = (AService) factory.create();
	}

Googling is no help, and this forum only yields one hit, but the problem was
never solved. Anyone have a working example of the vm/local transport?
-- 
View this message in context: http://www.nabble.com/Exception-using-local-transport%3A-%22Non-default-namespace-can-not-map-to-empty-URI%22-tp24943449p24954586.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Exception using local transport: "Non-default namespace can not map to empty URI"

Posted by cj91 <Jo...@argushealth.com>.
Forget it. I just figured out i was calling "setInInterceptors" twice. Sigh.
Sorry to bother everyone. Now I have a new exception
-- 
View this message in context: http://www.nabble.com/Exception-using-local-transport%3A-%22Non-default-namespace-can-not-map-to-empty-URI%22-tp24943449p24943464.html
Sent from the cxf-user mailing list archive at Nabble.com.