You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Glen Mazza <gl...@verizon.net> on 2007/11/20 18:53:26 UTC

Re: Problems calling 2 different web services from the same Eclipse Runtime...

Am Dienstag, den 20.11.2007, 07:54 -0800 schrieb Tophebboy:
> Hi everybody!
> First of all, please excuse my English which is very far from perfect (I’m
> French).
> I'm a newbie about web services.
> I have to create a RCP app (this, I know) which will use some web services I
> also have to create.
> Anyway, now I have 2 web services (let’s call them WS1 and WS2) I can call
> from 2 different plugins (P1 and P1) in my RCP app.
> If I launch my app with the 2 plugins at the runtime, calling one of the 2
> web services is OK, but if I call after that the other one, I have this
> error (for example, P1 which uses WS1 is OK, but if I call after that P2
> which uses WS2, I have a problem):
> 
> 0 nov. 2007 16:30:37 org.apache.cxf.BusFactory newInstance
> GRAVE: Failed to instantiate bus factory.


Hmmm...could it be that you are (incorrectly?) instantiating the
BusFactory twice, and it is failing on the second attempt?

Glen


> java.lang.ClassCastException: class
> org.apache.cxf.bus.spring.SpringBusFactory
> 	at java.lang.Class.asSubclass(Unknown Source)
> 	at org.apache.cxf.BusFactory.newInstance(BusFactory.java:149)
> 	at org.apache.cxf.BusFactory.newInstance(BusFactory.java:132)
> 	at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69)
> 	at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:58)
> 	at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:98)
> 	at
> org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:54)
> 	at javax.xml.ws.Service.<init>(Service.java:56)
> …
> 
> If I ever relaunch my application, and if I try to use the 2nd plugin and
> the 2nd web service, it runs OK and I have the same error when I try to use
> the first one after that(P2 which uses WS2, then P1 which uses WS1)…So the
> problem does not come from one of my plugin particularly…Either it comes
> from both, or from something else…
> I really don’t understand what is going on…
> Could somebody please help me?!!?
> Thanks in advance!!!
> 


Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Tophebboy <cb...@free.fr>.
I also tried using this:
<code>	
Service service = Service.create(SERVICE_NAME);
String endpointAddress =
EDocDocumentumPluginParam.EDocDocumentumPluginParam_EndpointAddress;

service.addPort(PORT_NAME, SOAPBinding.SOAP12HTTP_BINDING,
				endpointAddress);
_myPort = service.getPort(MyRequest.class);
</code>

instead of:

<code>
MyService ss = new MyService(wsdlURL,SERVICE_NAME);
_myPort = ss.getMyServicePort();
</code>

To get a reference on the port and I still have the same problem...Calling
several times one service is ok, but callin a service then another one leads
to the same ClassCastException...:-/


Tophebboy wrote:
> 
> Hi!
> This morning, I've tried putting the initialization stuff in an
> initialization methode which is called only one. And I still have the same
> problem...
> I will try to do what you're tellin later...
> Thanks.
> 
> 
> Glen Mazza-2 wrote:
>> 
>> BTW, may I ask, why do you need a different wsdl "each time"?  As far as
>> I can see you just need two WSDLs, one for each service.  If it is
>> because the endpoint changes, you can change the endpoint URL
>> programmatically--see Step #7 here[1].
>> 
>> Also, you said you are calling a different web service from two
>> different places.  What happens if you call the *same* web service from
>> those two different places--does it work then or break?  If the latter,
>> the fact that you are calling two different services may be just an
>> irrelevant distraction to finding the real problem.
>> 
>> What we will probably need from you next is a very simple one-class Java
>> application that iteratively asks a user if they want to call web
>> service #1 or #2, and then have two methods, one that calls each web
>> service.  Use the CXF samples in the /samples directory for web services
>> to call (call "ant server" on two of our web services).  If you can get
>> this program to work, that would mean the problem is somewhere else.  If
>> you cannot get the simple program to work, then send the program to us
>> in a JIRA report--it would be easier to then duplicate and then hunt
>> down the problem.
>> 
>> HTH,
>> Glen
>> 
>> [1] http://www.jroller.com/gmazza/date/20070817
>> 
>> Am Mittwoch, den 21.11.2007, 08:34 -0800 schrieb Tophebboy:
>>> I can call the same service 10 times, so I don't think it could come
>>> from
>>> that...The problem only comes when I call one service, the another
>>> one...
>>> On top of that, I'm currently doing tests to use CXF, and I need to be
>>> able
>>> to call the service with a different wsdl each time (I have to test the
>>> same
>>> service on several servers...). So I have to do it this way...
>>> Thanks very much anyway!
>>> Any other idea?
>>> 
>>> 
>>> Glen Mazza-2 wrote:
>>> > 
>>> > Comments below...
>>> > 
>>> > Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
>>> >> I don't know but I don't handle myself the BusFatory instanciation.
>>> >> I just have a client in each of my plugins which looks like the
>>> clients
>>> >> CXF
>>> >> generates automatically:
>>> >> 
>>> >> <code>
>>> >> String wsdlUrl = "my wsdl path";
>>> >> 		File wsdlFile = new File(wsdlUrl);
>>> >> 
>>> >> 		try {
>>> >> 			if (wsdlFile.exists()) {
>>> >> 				wsdlURL = wsdlFile.toURL();
>>> >> 			} else {
>>> >> 				wsdlURL = new URL(wsdlUrl);
>>> >> 			}
>>> >> 		} catch (MalformedURLException e) {
>>> >> 			e.printStackTrace();
>>> >> 		}
>>> >> 		try {
>>> >> 			System.out.println("Using WSDL: " + wsdlURL);
>>> >> 			MyRequestService ss = new MyRequestService(wsdlURL,
>>> >> 					SERVICE_NAME);
>>> >> 			
>>> >> 			MyRequest port = ss.getMyRequestPort();
>>> >> 
>>> > 
>>> > I would try to put your port and service initialization in a
>>> constructor
>>> > or initialize() method or similar--so it is only done once.  Presently
>>> > you are initializing these variables with every web service call,
>>> which
>>> > would be slow anyway.  Let us know if that worked.
>>> > 
>>> > HTH,
>>> > Glen
>>> > 
>>> > 
>>> > 
>>> >> 			
>>> >> 			// Uses the Web Service:
>>> >> 			//
>>> >> 			//Then, calls the method of port
>>> >> 
>>> >> </code>
>>> >> 
>>> >> 
>>> > 
>>> > 
>>> > 
>>> > 
>>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-calling-2-different-web-services-from-the-same-Eclipse-Runtime...-tf4844258.html#a13894181
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Tophebboy <cb...@free.fr>.
Hi!
This morning, I've tried putting the initialization stuff in an
initialization methode which is called only one. And I still have the same
problem...
I will try to do what you're tellin later...
Thanks.


Glen Mazza-2 wrote:
> 
> BTW, may I ask, why do you need a different wsdl "each time"?  As far as
> I can see you just need two WSDLs, one for each service.  If it is
> because the endpoint changes, you can change the endpoint URL
> programmatically--see Step #7 here[1].
> 
> Also, you said you are calling a different web service from two
> different places.  What happens if you call the *same* web service from
> those two different places--does it work then or break?  If the latter,
> the fact that you are calling two different services may be just an
> irrelevant distraction to finding the real problem.
> 
> What we will probably need from you next is a very simple one-class Java
> application that iteratively asks a user if they want to call web
> service #1 or #2, and then have two methods, one that calls each web
> service.  Use the CXF samples in the /samples directory for web services
> to call (call "ant server" on two of our web services).  If you can get
> this program to work, that would mean the problem is somewhere else.  If
> you cannot get the simple program to work, then send the program to us
> in a JIRA report--it would be easier to then duplicate and then hunt
> down the problem.
> 
> HTH,
> Glen
> 
> [1] http://www.jroller.com/gmazza/date/20070817
> 
> Am Mittwoch, den 21.11.2007, 08:34 -0800 schrieb Tophebboy:
>> I can call the same service 10 times, so I don't think it could come from
>> that...The problem only comes when I call one service, the another one...
>> On top of that, I'm currently doing tests to use CXF, and I need to be
>> able
>> to call the service with a different wsdl each time (I have to test the
>> same
>> service on several servers...). So I have to do it this way...
>> Thanks very much anyway!
>> Any other idea?
>> 
>> 
>> Glen Mazza-2 wrote:
>> > 
>> > Comments below...
>> > 
>> > Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
>> >> I don't know but I don't handle myself the BusFatory instanciation.
>> >> I just have a client in each of my plugins which looks like the
>> clients
>> >> CXF
>> >> generates automatically:
>> >> 
>> >> <code>
>> >> String wsdlUrl = "my wsdl path";
>> >> 		File wsdlFile = new File(wsdlUrl);
>> >> 
>> >> 		try {
>> >> 			if (wsdlFile.exists()) {
>> >> 				wsdlURL = wsdlFile.toURL();
>> >> 			} else {
>> >> 				wsdlURL = new URL(wsdlUrl);
>> >> 			}
>> >> 		} catch (MalformedURLException e) {
>> >> 			e.printStackTrace();
>> >> 		}
>> >> 		try {
>> >> 			System.out.println("Using WSDL: " + wsdlURL);
>> >> 			MyRequestService ss = new MyRequestService(wsdlURL,
>> >> 					SERVICE_NAME);
>> >> 			
>> >> 			MyRequest port = ss.getMyRequestPort();
>> >> 
>> > 
>> > I would try to put your port and service initialization in a
>> constructor
>> > or initialize() method or similar--so it is only done once.  Presently
>> > you are initializing these variables with every web service call, which
>> > would be slow anyway.  Let us know if that worked.
>> > 
>> > HTH,
>> > Glen
>> > 
>> > 
>> > 
>> >> 			
>> >> 			// Uses the Web Service:
>> >> 			//
>> >> 			//Then, calls the method of port
>> >> 
>> >> </code>
>> >> 
>> >> 
>> > 
>> > 
>> > 
>> > 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-calling-2-different-web-services-from-the-same-Eclipse-Runtime...-tf4844258.html#a13893315
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Glen Mazza <gl...@verizon.net>.
BTW, may I ask, why do you need a different wsdl "each time"?  As far as
I can see you just need two WSDLs, one for each service.  If it is
because the endpoint changes, you can change the endpoint URL
programmatically--see Step #7 here[1].

Also, you said you are calling a different web service from two
different places.  What happens if you call the *same* web service from
those two different places--does it work then or break?  If the latter,
the fact that you are calling two different services may be just an
irrelevant distraction to finding the real problem.

What we will probably need from you next is a very simple one-class Java
application that iteratively asks a user if they want to call web
service #1 or #2, and then have two methods, one that calls each web
service.  Use the CXF samples in the /samples directory for web services
to call (call "ant server" on two of our web services).  If you can get
this program to work, that would mean the problem is somewhere else.  If
you cannot get the simple program to work, then send the program to us
in a JIRA report--it would be easier to then duplicate and then hunt
down the problem.

HTH,
Glen

[1] http://www.jroller.com/gmazza/date/20070817

Am Mittwoch, den 21.11.2007, 08:34 -0800 schrieb Tophebboy:
> I can call the same service 10 times, so I don't think it could come from
> that...The problem only comes when I call one service, the another one...
> On top of that, I'm currently doing tests to use CXF, and I need to be able
> to call the service with a different wsdl each time (I have to test the same
> service on several servers...). So I have to do it this way...
> Thanks very much anyway!
> Any other idea?
> 
> 
> Glen Mazza-2 wrote:
> > 
> > Comments below...
> > 
> > Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
> >> I don't know but I don't handle myself the BusFatory instanciation.
> >> I just have a client in each of my plugins which looks like the clients
> >> CXF
> >> generates automatically:
> >> 
> >> <code>
> >> String wsdlUrl = "my wsdl path";
> >> 		File wsdlFile = new File(wsdlUrl);
> >> 
> >> 		try {
> >> 			if (wsdlFile.exists()) {
> >> 				wsdlURL = wsdlFile.toURL();
> >> 			} else {
> >> 				wsdlURL = new URL(wsdlUrl);
> >> 			}
> >> 		} catch (MalformedURLException e) {
> >> 			e.printStackTrace();
> >> 		}
> >> 		try {
> >> 			System.out.println("Using WSDL: " + wsdlURL);
> >> 			MyRequestService ss = new MyRequestService(wsdlURL,
> >> 					SERVICE_NAME);
> >> 			
> >> 			MyRequest port = ss.getMyRequestPort();
> >> 
> > 
> > I would try to put your port and service initialization in a constructor
> > or initialize() method or similar--so it is only done once.  Presently
> > you are initializing these variables with every web service call, which
> > would be slow anyway.  Let us know if that worked.
> > 
> > HTH,
> > Glen
> > 
> > 
> > 
> >> 			
> >> 			// Uses the Web Service:
> >> 			//
> >> 			//Then, calls the method of port
> >> 
> >> </code>
> >> 
> >> 
> > 
> > 
> > 
> > 
> 


Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Tophebboy <cb...@free.fr>.
I can call the same service 10 times, so I don't think it could come from
that...The problem only comes when I call one service, the another one...
On top of that, I'm currently doing tests to use CXF, and I need to be able
to call the service with a different wsdl each time (I have to test the same
service on several servers...). So I have to do it this way...
Thanks very much anyway!
Any other idea?


Glen Mazza-2 wrote:
> 
> Comments below...
> 
> Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
>> I don't know but I don't handle myself the BusFatory instanciation.
>> I just have a client in each of my plugins which looks like the clients
>> CXF
>> generates automatically:
>> 
>> <code>
>> String wsdlUrl = "my wsdl path";
>> 		File wsdlFile = new File(wsdlUrl);
>> 
>> 		try {
>> 			if (wsdlFile.exists()) {
>> 				wsdlURL = wsdlFile.toURL();
>> 			} else {
>> 				wsdlURL = new URL(wsdlUrl);
>> 			}
>> 		} catch (MalformedURLException e) {
>> 			e.printStackTrace();
>> 		}
>> 		try {
>> 			System.out.println("Using WSDL: " + wsdlURL);
>> 			MyRequestService ss = new MyRequestService(wsdlURL,
>> 					SERVICE_NAME);
>> 			
>> 			MyRequest port = ss.getMyRequestPort();
>> 
> 
> I would try to put your port and service initialization in a constructor
> or initialize() method or similar--so it is only done once.  Presently
> you are initializing these variables with every web service call, which
> would be slow anyway.  Let us know if that worked.
> 
> HTH,
> Glen
> 
> 
> 
>> 			
>> 			// Uses the Web Service:
>> 			//
>> 			//Then, calls the method of port
>> 
>> </code>
>> 
>> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-calling-2-different-web-services-from-the-same-Eclipse-Runtime...-tf4844258.html#a13880902
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Glen Mazza <gl...@verizon.net>.
Comments below...

Am Dienstag, den 20.11.2007, 23:57 -0800 schrieb Tophebboy:
> I don't know but I don't handle myself the BusFatory instanciation.
> I just have a client in each of my plugins which looks like the clients CXF
> generates automatically:
> 
> <code>
> String wsdlUrl = "my wsdl path";
> 		File wsdlFile = new File(wsdlUrl);
> 
> 		try {
> 			if (wsdlFile.exists()) {
> 				wsdlURL = wsdlFile.toURL();
> 			} else {
> 				wsdlURL = new URL(wsdlUrl);
> 			}
> 		} catch (MalformedURLException e) {
> 			e.printStackTrace();
> 		}
> 		try {
> 			System.out.println("Using WSDL: " + wsdlURL);
> 			MyRequestService ss = new MyRequestService(wsdlURL,
> 					SERVICE_NAME);
> 			
> 			MyRequest port = ss.getMyRequestPort();
> 

I would try to put your port and service initialization in a constructor
or initialize() method or similar--so it is only done once.  Presently
you are initializing these variables with every web service call, which
would be slow anyway.  Let us know if that worked.

HTH,
Glen



> 			
> 			// Uses the Web Service:
> 			//
> 			//Then, calls the method of port
> 
> </code>
> 
> 



Re: Problems calling 2 different web services from the same Eclipse Runtime...

Posted by Tophebboy <cb...@free.fr>.
I don't know but I don't handle myself the BusFatory instanciation.
I just have a client in each of my plugins which looks like the clients CXF
generates automatically:

<code>
String wsdlUrl = "my wsdl path";
		File wsdlFile = new File(wsdlUrl);

		try {
			if (wsdlFile.exists()) {
				wsdlURL = wsdlFile.toURL();
			} else {
				wsdlURL = new URL(wsdlUrl);
			}
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
		try {
			System.out.println("Using WSDL: " + wsdlURL);
			MyRequestService ss = new MyRequestService(wsdlURL,
					SERVICE_NAME);
			
			MyRequest port = ss.getMyRequestPort();

			
			// Uses the Web Service:
			//
			//Then, calls the method of port

</code>




Glen Mazza-2 wrote:
> 
> Am Dienstag, den 20.11.2007, 07:54 -0800 schrieb Tophebboy:
>> Hi everybody!
>> First of all, please excuse my English which is very far from perfect
>> (I’m
>> French).
>> I'm a newbie about web services.
>> I have to create a RCP app (this, I know) which will use some web
>> services I
>> also have to create.
>> Anyway, now I have 2 web services (let’s call them WS1 and WS2) I can
>> call
>> from 2 different plugins (P1 and P1) in my RCP app.
>> If I launch my app with the 2 plugins at the runtime, calling one of the
>> 2
>> web services is OK, but if I call after that the other one, I have this
>> error (for example, P1 which uses WS1 is OK, but if I call after that P2
>> which uses WS2, I have a problem):
>> 
>> 0 nov. 2007 16:30:37 org.apache.cxf.BusFactory newInstance
>> GRAVE: Failed to instantiate bus factory.
> 
> 
> Hmmm...could it be that you are (incorrectly?) instantiating the
> BusFactory twice, and it is failing on the second attempt?
> 
> Glen
> 
> 
>> java.lang.ClassCastException: class
>> org.apache.cxf.bus.spring.SpringBusFactory
>> 	at java.lang.Class.asSubclass(Unknown Source)
>> 	at org.apache.cxf.BusFactory.newInstance(BusFactory.java:149)
>> 	at org.apache.cxf.BusFactory.newInstance(BusFactory.java:132)
>> 	at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69)
>> 	at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:58)
>> 	at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:98)
>> 	at
>> org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:54)
>> 	at javax.xml.ws.Service.<init>(Service.java:56)
>> …
>> 
>> If I ever relaunch my application, and if I try to use the 2nd plugin and
>> the 2nd web service, it runs OK and I have the same error when I try to
>> use
>> the first one after that(P2 which uses WS2, then P1 which uses WS1)…So
>> the
>> problem does not come from one of my plugin particularly…Either it comes
>> from both, or from something else…
>> I really don’t understand what is going on…
>> Could somebody please help me?!!?
>> Thanks in advance!!!
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-calling-2-different-web-services-from-the-same-Eclipse-Runtime...-tf4844258.html#a13872490
Sent from the cxf-user mailing list archive at Nabble.com.