> On Oct 21, 2014, at 12:43 PM, David Roldan Puig <[email protected]>
> wrote:
>
> Hello Daniel.
>
> Thanks for the answer.
>
> Executing the sentence;:
> System.out.println(Collections.list(Thread.currentThread().getContextClassLoader().getResources("META-INF/cxf/bus-extensions.txt")));
> the
> result is an empty []
>
> However in the list of jars within /lib folder we could find all the needed
> jars as for exemple cxf-rt-trasnports-http-2.2.3 and .... http-jetty-2.2.3
>
> If I generate the file "bus-extensions.txt" in the folder META-INF/cxf/ the
> result of the sentence is:
> [jar:file:/C:/Users/i2Cat/.m2/repository/org/apache/cxf/cxf-core/3.0.1/cxf-core-3.0.1.jar!/META-INF/cxf/bus-extensions.txt]
Wait…. you have a mix of CXF 3.0.1 and 2.2.3? That would certainly be
problematic.
Dan
>
> I d0n't know exactly who generate this file and what is the content inside
> it.
>
> the code is the following:
> _________________________________________________________________________
>
> *System.out.println(Collections.list(Thread.currentThread().getContextClassLoader().getResources("META-INF/cxf/bus-extensions.txt")));
> *
> *DomainsAPI resource =
> JAXRSClientFactory.create("http://localhost:9998/api/v1/
> <http://localhost:9998/api/v1/>", DomainsAPI.class);*
> *WebClient.client(resource).header("X-USER",
> "super_admin_key").accept(MediaType.APPLICATION_JSON); *
> *List<Domain> response = resource.getDomains(); *
> _________________________________________________________________________
>
>
> I don't understand where is tehe problem. Maybe GWT configuratin is not
> correct.. or something similar.
>
> I need your help.
> Thanks.
>
>
>
>
> *David Roldán*
>
> *UITU: Ubiquitous Internet Technologies Unit *
> http://fi2.cat/uitudesc
>
> *i2CAT FOUNDATION*
> Gran Capità 2-4 (Nexus I building)
> 2nd Floor, office 203; 08034 Barcelona
> +34 93 553 26 33
>
> 2014-10-20 20:33 GMT+02:00 Daniel Kulp <[email protected]>:
>
>>
>> You aren’t doing something silly like creating some sort of uber-jar or
>> combining jars together or similar, are you? That would certainly cause
>> this.
>>
>> In your code someplace, try doing something like:
>>
>> System.out.println(Collections.list(getClass().getClassLoader()
>>
>> .getResources("META-INF/cxf/bus-extensions.txt")));
>>
>>
>> (possibly with the Thread.contextClassloader() instead of the
>> getClass().getClassLoader() call)
>>
>> and make sure it’s printing out a bunch of locations and not one. More
>> importantly, make sure the one in cxf-rt-transports-http is in the list.
>>
>>
>> Dan
>>
>>
>>
>>> On Oct 16, 2014, at 5:59 AM, David Roldan Puig <[email protected]>
>> wrote:
>>>
>>> Hello,
>>>
>>> I would like to create an APIRest Client in a WebProject with Google Web
>>> toolkit (GWT 2.6.1). I am using CXF in order to use my interfaces to get
>>> the client.
>>>
>>> I use this code to obtain the client in the serviceImplementation class
>>> inside a package in the server of GWT project:
>>>
>>>
>>>
>>> DomainsAPI resource = JAXRSClientFactory.create("
>>> http://localhost:9998/api/v1/", DomainsAPI.class, providers);
>>> WebClient.client(resource).header("X-USER",
>>> userKey).accept(MediaType.APPLICATION_JSON);
>>> ObjectMapper mapper = new ObjectMapper();
>>> Response response = resource.getDomains();
>>> String hp = response.readEntity(String.class);
>>> Domain[] dd = mapper.readValue(hp, Domain[].class);
>>> ...
>>>
>>>
>>> POM configuration:
>>>
>>> <dependencies>
>>> <dependency>
>>> <groupId>com.google.gwt</groupId>
>>> <artifactId>gwt-servlet</artifactId>
>>> <version>2.6.1</version>
>>> <scope>runtime</scope>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.google.gwt</groupId>
>>> <artifactId>gwt-user</artifactId>
>>> <version>2.6.1</version>
>>> <scope>provided</scope>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.cxf</groupId>
>>> <artifactId>cxf-rt-transports-http</artifactId>
>>> <version>3.0.1</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.apache.cxf</groupId>
>>> <artifactId>cxf-rt-rs-client</artifactId>
>>> <version>3.0.1</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.codehaus.jackson</groupId>
>>> <artifactId>jackson-jaxrs</artifactId>
>>> <version>1.9.13</version>
>>> </dependency>
>>> </dependencies>
>>>
>>>
>>> This code is processed but when resource.getDomains() is called, I obtain
>>> the typical error with GWT and CXF:
>>>
>>> Advertencia: Interceptor for {
>>> http://clientAPIRest.shared.us2p.uitu.com/}DomainsAPI has thrown
>> exception,
>>> unwinding now
>>> org.apache.cxf.interceptor.Fault: No conduit initiator was found for the
>>> namespace http://cxf.apache.org/transports/http.
>>>
>>> ....
>>> Caused by: org.apache.cxf.BusException: No conduit initiator was found
>> for
>>> the namespace http://cxf.apache.org/transports/http.
>>> at
>>>
>> org.apache.cxf.bus.managers.ConduitInitiatorManagerImpl.getConduitInitiator(ConduitInitiatorManagerImpl.java:110)
>>> at
>>>
>> org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:104)
>>> ....
>>>
>>>
>>> But, if I try this code in a stand alone maven project with its
>>> dependencies works properly. The sample code is the same as above and the
>>> dependencies in POM maven are the following:
>>>
>>> <dependencies>
>>>
>>> <dependency>
>>>
>>> <groupId>org.apache.cxf</groupId>
>>>
>>> <artifactId>cxf-rt-transports-http</artifactId>
>>>
>>> <version>3.0.1</version>
>>>
>>> </dependency>
>>>
>>> <dependency>
>>>
>>> <groupId>org.apache.cxf</groupId>
>>>
>>> <artifactId>cxf-rt-rs-client</artifactId>
>>>
>>> <version>3.0.1</version>
>>>
>>> </dependency>
>>>
>>> </dependencies>
>>>
>>>
>>>
>>> I don't know exactly where is the problem. I saw lots of comments about
>> CXF
>>> dependencies but no one is the solution I amb looking for.
>>> The project works without GWT so the problem is in the integration
>> between
>>> them, I don't know exactly.
>>>
>>> I hope your help.
>>> Thanks a lot.
>>>
>>> Regards
>>>
>>> *David Roldán*
>>>
>>> *UITU: Ubiquitous Internet Technologies Unit *
>>> http://fi2.cat/uitudesc
>>>
>>> *i2CAT FOUNDATION*
>>> Gran Capità 2-4 (Nexus I building)
>>> 2nd Floor, office 203; 08034 Barcelona
>>> +34 93 553 26 33
>>
>> --
>> Daniel Kulp
>> [email protected] - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>>
>>
--
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com