You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Al Forbes <fo...@gmail.com> on 2013/04/11 22:06:03 UTC

The famous Cant find the request Observer

Hi,

I have spent 2 days on this so any ideas on how to debug this further would
be appreciated.

I'm using JDK 1.7, Spring 3.2, and CXF 2.7.3. With Spring I'm using the
Java config (not xml).

I keep getting the error
WARNING: Can't find the the request for
http://localhost:8080/rest/api/people's Observer

I think the error is related to some interaction between Tomcat and the
CXFServlet. I had this working for a couple of weeks, so I suspect it has
something to do with the order of the classpath and not the configuration.

I found this project which I can use to reproduce the problem. It works
correctly with the embedded Jetty server, but NOT with Tomcat.

git clone -b tomcat-embedded https://github.com/reta/spring-one-jar.git
mvn package
java -jar target/spring-one-jar-0.0.1-SNAPSHOT.one-jar.jar

This fails with:
curl http://localhost:8080/rest/api/people?page=2

But the same procedure with Jetty works.
git clone -b jetty-embedded https://github.com/reta/spring-one-jar.git


With Tomcat the application path (@ApplicationPath) is correctly printed,
so I think it must be related to the CXFServlet and the url-pattern.
"INFO: Setting the server's publish address to be /api"

       @Bean
        public Server jaxRsServer() {
                JAXRSServerFactoryBean factory =
RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(),
JAXRSServerFactoryBean.class );
                factory.setServiceBeans( Arrays.< Object >asList(
peopleRestService() ) );
                factory.setAddress( "/" + factory.getAddress() );
                factory.setProviders( Arrays.< Object >asList(
jsonProvider() ) );
                return factory.create();
        }

Thanks,
Al

Re: The famous Cant find the request Observer

Posted by Al Forbes <fo...@gmail.com>.
Hi Daniel,

Yes, that gets me closer. The failure is completely random
(and reproducible as random). The problem seems to be the order of the bus.
If "cxf" is last in the list it fails.

INFO: Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@d88c8f:
defining beans
[org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,appConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,jaxRsServer,jaxRsApiApplication,peopleRestService,peopleService,jsonProvider,cxf];
root of factory hierarchy

But it works when the order is different:

INFO: Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@1a309d1:
defining beans
[org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,appConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,cxf,jaxRsServer,jaxRsApiApplication,peopleRestService,peopleService,jsonProvider];
root of factory hierarchy

I will try your fix tomorrow...but thanks for getting me pointed in the
right direction. I assume this fails in part due to the voodoo from the
Spring classloader. I don't know enough to know how I can influence the
order of this.

Cheers,
Al







On 11 April 2013 23:45, Daniel Kulp <dk...@apache.org> wrote:

>
> Try this:
>
> diff --git a/src/main/java/com/example/config/AppConfig.java
> b/src/main/java/com/example/config/AppConfig.java
> index 0f05263..0a5036e 100644
> --- a/src/main/java/com/example/config/AppConfig.java
> +++ b/src/main/java/com/example/config/AppConfig.java
> @@ -24,7 +24,9 @@ public class AppConfig {
>
>         @Bean
>         public Server jaxRsServer() {
> +        cxf();
>                 JAXRSServerFactoryBean factory =
> RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(),
> JAXRSServerFactoryBean.class );
> +        factory.setBus(cxf());
>                 factory.setServiceBeans( Arrays.< Object >asList(
> peopleRestService() ) );
>                 factory.setAddress( "/" + factory.getAddress() );
>
>
> I think you are getting a different bus in the factory depending on
> whether the cxf() method is called first or the jaxRsServer() method is
> called first.
>
>
> Dan
>
>
>
>
> On Apr 11, 2013, at 5:07 PM, Al Forbes <fo...@gmail.com> wrote:
>
> > This is strange..
> >
> > Compiled with 1.6.0_29, works.
> > Compiled with 1.6.0_29, run with 1.7.0_17, works.
> > Compiled and run with 1.7.0_17, fails.
> >
> > Logs are on:
> > http://pastebin.com/qj1asZpq
> >
> > Same results with CXF 2.7.4, 2.7.3, 2.6.7
> >
> > I suspect some classpath/class loading issue. I'm not sure how to debug
> > that.
> >
> > Al.
> >
> >
> > On 11 April 2013 22:18, Daniel Kulp <dk...@apache.org> wrote:
> >
> >>
> >> On Apr 11, 2013, at 4:13 PM, Daniel Kulp <dk...@apache.org> wrote:
> >>
> >>>
> >>> What's interesting is that it works fine for me with Tomcat when using
> >> Java6, but not with Java7.   Not sure what that means yet.
> >>
> >> And I cannot reproduce it at all if I update to CXF 2.7.4.     Please
> >> update and try again.
> >>
> >> Dan
> >>
> >>
> >>
> >>>
> >>> Dan
> >>>
> >>>
> >>>
> >>> On Apr 11, 2013, at 4:06 PM, Al Forbes <fo...@gmail.com> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> I have spent 2 days on this so any ideas on how to debug this further
> >> would
> >>>> be appreciated.
> >>>>
> >>>> I'm using JDK 1.7, Spring 3.2, and CXF 2.7.3. With Spring I'm using
> the
> >>>> Java config (not xml).
> >>>>
> >>>> I keep getting the error
> >>>> WARNING: Can't find the the request for
> >>>> http://localhost:8080/rest/api/people's Observer
> >>>>
> >>>> I think the error is related to some interaction between Tomcat and
> the
> >>>> CXFServlet. I had this working for a couple of weeks, so I suspect it
> >> has
> >>>> something to do with the order of the classpath and not the
> >> configuration.
> >>>>
> >>>> I found this project which I can use to reproduce the problem. It
> works
> >>>> correctly with the embedded Jetty server, but NOT with Tomcat.
> >>>>
> >>>> git clone -b tomcat-embedded
> https://github.com/reta/spring-one-jar.git
> >>>> mvn package
> >>>> java -jar target/spring-one-jar-0.0.1-SNAPSHOT.one-jar.jar
> >>>>
> >>>> This fails with:
> >>>> curl http://localhost:8080/rest/api/people?page=2
> >>>>
> >>>> But the same procedure with Jetty works.
> >>>> git clone -b jetty-embedded
> https://github.com/reta/spring-one-jar.git
> >>>>
> >>>>
> >>>> With Tomcat the application path (@ApplicationPath) is correctly
> >> printed,
> >>>> so I think it must be related to the CXFServlet and the url-pattern.
> >>>> "INFO: Setting the server's publish address to be /api"
> >>>>
> >>>>     @Bean
> >>>>      public Server jaxRsServer() {
> >>>>              JAXRSServerFactoryBean factory =
> >>>> RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(),
> >>>> JAXRSServerFactoryBean.class );
> >>>>              factory.setServiceBeans( Arrays.< Object >asList(
> >>>> peopleRestService() ) );
> >>>>              factory.setAddress( "/" + factory.getAddress() );
> >>>>              factory.setProviders( Arrays.< Object >asList(
> >>>> jsonProvider() ) );
> >>>>              return factory.create();
> >>>>      }
> >>>>
> >>>> Thanks,
> >>>> Al
> >>>
> >>> --
> >>> Daniel Kulp
> >>> dkulp@apache.org - http://dankulp.com/blog
> >>> Talend Community Coder - http://coders.talend.com
> >>>
> >>
> >> --
> >> Daniel Kulp
> >> dkulp@apache.org - http://dankulp.com/blog
> >> Talend Community Coder - http://coders.talend.com
> >>
> >>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Re: The famous Cant find the request Observer

Posted by Daniel Kulp <dk...@apache.org>.
Try this:

diff --git a/src/main/java/com/example/config/AppConfig.java b/src/main/java/com/example/config/AppConfig.java
index 0f05263..0a5036e 100644
--- a/src/main/java/com/example/config/AppConfig.java
+++ b/src/main/java/com/example/config/AppConfig.java
@@ -24,7 +24,9 @@ public class AppConfig {
        
        @Bean
        public Server jaxRsServer() {
+        cxf();
                JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(), JAXRSServerFactoryBean.class );
+        factory.setBus(cxf());
                factory.setServiceBeans( Arrays.< Object >asList( peopleRestService() ) );
                factory.setAddress( "/" + factory.getAddress() );


I think you are getting a different bus in the factory depending on whether the cxf() method is called first or the jaxRsServer() method is called first.


Dan




On Apr 11, 2013, at 5:07 PM, Al Forbes <fo...@gmail.com> wrote:

> This is strange..
> 
> Compiled with 1.6.0_29, works.
> Compiled with 1.6.0_29, run with 1.7.0_17, works.
> Compiled and run with 1.7.0_17, fails.
> 
> Logs are on:
> http://pastebin.com/qj1asZpq
> 
> Same results with CXF 2.7.4, 2.7.3, 2.6.7
> 
> I suspect some classpath/class loading issue. I'm not sure how to debug
> that.
> 
> Al.
> 
> 
> On 11 April 2013 22:18, Daniel Kulp <dk...@apache.org> wrote:
> 
>> 
>> On Apr 11, 2013, at 4:13 PM, Daniel Kulp <dk...@apache.org> wrote:
>> 
>>> 
>>> What's interesting is that it works fine for me with Tomcat when using
>> Java6, but not with Java7.   Not sure what that means yet.
>> 
>> And I cannot reproduce it at all if I update to CXF 2.7.4.     Please
>> update and try again.
>> 
>> Dan
>> 
>> 
>> 
>>> 
>>> Dan
>>> 
>>> 
>>> 
>>> On Apr 11, 2013, at 4:06 PM, Al Forbes <fo...@gmail.com> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> I have spent 2 days on this so any ideas on how to debug this further
>> would
>>>> be appreciated.
>>>> 
>>>> I'm using JDK 1.7, Spring 3.2, and CXF 2.7.3. With Spring I'm using the
>>>> Java config (not xml).
>>>> 
>>>> I keep getting the error
>>>> WARNING: Can't find the the request for
>>>> http://localhost:8080/rest/api/people's Observer
>>>> 
>>>> I think the error is related to some interaction between Tomcat and the
>>>> CXFServlet. I had this working for a couple of weeks, so I suspect it
>> has
>>>> something to do with the order of the classpath and not the
>> configuration.
>>>> 
>>>> I found this project which I can use to reproduce the problem. It works
>>>> correctly with the embedded Jetty server, but NOT with Tomcat.
>>>> 
>>>> git clone -b tomcat-embedded https://github.com/reta/spring-one-jar.git
>>>> mvn package
>>>> java -jar target/spring-one-jar-0.0.1-SNAPSHOT.one-jar.jar
>>>> 
>>>> This fails with:
>>>> curl http://localhost:8080/rest/api/people?page=2
>>>> 
>>>> But the same procedure with Jetty works.
>>>> git clone -b jetty-embedded https://github.com/reta/spring-one-jar.git
>>>> 
>>>> 
>>>> With Tomcat the application path (@ApplicationPath) is correctly
>> printed,
>>>> so I think it must be related to the CXFServlet and the url-pattern.
>>>> "INFO: Setting the server's publish address to be /api"
>>>> 
>>>>     @Bean
>>>>      public Server jaxRsServer() {
>>>>              JAXRSServerFactoryBean factory =
>>>> RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(),
>>>> JAXRSServerFactoryBean.class );
>>>>              factory.setServiceBeans( Arrays.< Object >asList(
>>>> peopleRestService() ) );
>>>>              factory.setAddress( "/" + factory.getAddress() );
>>>>              factory.setProviders( Arrays.< Object >asList(
>>>> jsonProvider() ) );
>>>>              return factory.create();
>>>>      }
>>>> 
>>>> Thanks,
>>>> Al
>>> 
>>> --
>>> Daniel Kulp
>>> dkulp@apache.org - http://dankulp.com/blog
>>> Talend Community Coder - http://coders.talend.com
>>> 
>> 
>> --
>> Daniel Kulp
>> dkulp@apache.org - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>> 
>> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: The famous Cant find the request Observer

Posted by Al Forbes <fo...@gmail.com>.
This is strange..

Compiled with 1.6.0_29, works.
Compiled with 1.6.0_29, run with 1.7.0_17, works.
Compiled and run with 1.7.0_17, fails.

Logs are on:
http://pastebin.com/qj1asZpq

Same results with CXF 2.7.4, 2.7.3, 2.6.7

I suspect some classpath/class loading issue. I'm not sure how to debug
that.

Al.


On 11 April 2013 22:18, Daniel Kulp <dk...@apache.org> wrote:

>
> On Apr 11, 2013, at 4:13 PM, Daniel Kulp <dk...@apache.org> wrote:
>
> >
> > What's interesting is that it works fine for me with Tomcat when using
> Java6, but not with Java7.   Not sure what that means yet.
>
> And I cannot reproduce it at all if I update to CXF 2.7.4.     Please
> update and try again.
>
> Dan
>
>
>
> >
> > Dan
> >
> >
> >
> > On Apr 11, 2013, at 4:06 PM, Al Forbes <fo...@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> I have spent 2 days on this so any ideas on how to debug this further
> would
> >> be appreciated.
> >>
> >> I'm using JDK 1.7, Spring 3.2, and CXF 2.7.3. With Spring I'm using the
> >> Java config (not xml).
> >>
> >> I keep getting the error
> >> WARNING: Can't find the the request for
> >> http://localhost:8080/rest/api/people's Observer
> >>
> >> I think the error is related to some interaction between Tomcat and the
> >> CXFServlet. I had this working for a couple of weeks, so I suspect it
> has
> >> something to do with the order of the classpath and not the
> configuration.
> >>
> >> I found this project which I can use to reproduce the problem. It works
> >> correctly with the embedded Jetty server, but NOT with Tomcat.
> >>
> >> git clone -b tomcat-embedded https://github.com/reta/spring-one-jar.git
> >> mvn package
> >> java -jar target/spring-one-jar-0.0.1-SNAPSHOT.one-jar.jar
> >>
> >> This fails with:
> >> curl http://localhost:8080/rest/api/people?page=2
> >>
> >> But the same procedure with Jetty works.
> >> git clone -b jetty-embedded https://github.com/reta/spring-one-jar.git
> >>
> >>
> >> With Tomcat the application path (@ApplicationPath) is correctly
> printed,
> >> so I think it must be related to the CXFServlet and the url-pattern.
> >> "INFO: Setting the server's publish address to be /api"
> >>
> >>      @Bean
> >>       public Server jaxRsServer() {
> >>               JAXRSServerFactoryBean factory =
> >> RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(),
> >> JAXRSServerFactoryBean.class );
> >>               factory.setServiceBeans( Arrays.< Object >asList(
> >> peopleRestService() ) );
> >>               factory.setAddress( "/" + factory.getAddress() );
> >>               factory.setProviders( Arrays.< Object >asList(
> >> jsonProvider() ) );
> >>               return factory.create();
> >>       }
> >>
> >> Thanks,
> >> Al
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org - http://dankulp.com/blog
> > Talend Community Coder - http://coders.talend.com
> >
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Re: The famous Cant find the request Observer

Posted by Daniel Kulp <dk...@apache.org>.
On Apr 11, 2013, at 4:13 PM, Daniel Kulp <dk...@apache.org> wrote:

> 
> What's interesting is that it works fine for me with Tomcat when using Java6, but not with Java7.   Not sure what that means yet.

And I cannot reproduce it at all if I update to CXF 2.7.4.     Please update and try again.

Dan



> 
> Dan
> 
> 
> 
> On Apr 11, 2013, at 4:06 PM, Al Forbes <fo...@gmail.com> wrote:
> 
>> Hi,
>> 
>> I have spent 2 days on this so any ideas on how to debug this further would
>> be appreciated.
>> 
>> I'm using JDK 1.7, Spring 3.2, and CXF 2.7.3. With Spring I'm using the
>> Java config (not xml).
>> 
>> I keep getting the error
>> WARNING: Can't find the the request for
>> http://localhost:8080/rest/api/people's Observer
>> 
>> I think the error is related to some interaction between Tomcat and the
>> CXFServlet. I had this working for a couple of weeks, so I suspect it has
>> something to do with the order of the classpath and not the configuration.
>> 
>> I found this project which I can use to reproduce the problem. It works
>> correctly with the embedded Jetty server, but NOT with Tomcat.
>> 
>> git clone -b tomcat-embedded https://github.com/reta/spring-one-jar.git
>> mvn package
>> java -jar target/spring-one-jar-0.0.1-SNAPSHOT.one-jar.jar
>> 
>> This fails with:
>> curl http://localhost:8080/rest/api/people?page=2
>> 
>> But the same procedure with Jetty works.
>> git clone -b jetty-embedded https://github.com/reta/spring-one-jar.git
>> 
>> 
>> With Tomcat the application path (@ApplicationPath) is correctly printed,
>> so I think it must be related to the CXFServlet and the url-pattern.
>> "INFO: Setting the server's publish address to be /api"
>> 
>>      @Bean
>>       public Server jaxRsServer() {
>>               JAXRSServerFactoryBean factory =
>> RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(),
>> JAXRSServerFactoryBean.class );
>>               factory.setServiceBeans( Arrays.< Object >asList(
>> peopleRestService() ) );
>>               factory.setAddress( "/" + factory.getAddress() );
>>               factory.setProviders( Arrays.< Object >asList(
>> jsonProvider() ) );
>>               return factory.create();
>>       }
>> 
>> Thanks,
>> Al
> 
> -- 
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: The famous Cant find the request Observer

Posted by Daniel Kulp <dk...@apache.org>.
What's interesting is that it works fine for me with Tomcat when using Java6, but not with Java7.   Not sure what that means yet.

Dan



On Apr 11, 2013, at 4:06 PM, Al Forbes <fo...@gmail.com> wrote:

> Hi,
> 
> I have spent 2 days on this so any ideas on how to debug this further would
> be appreciated.
> 
> I'm using JDK 1.7, Spring 3.2, and CXF 2.7.3. With Spring I'm using the
> Java config (not xml).
> 
> I keep getting the error
> WARNING: Can't find the the request for
> http://localhost:8080/rest/api/people's Observer
> 
> I think the error is related to some interaction between Tomcat and the
> CXFServlet. I had this working for a couple of weeks, so I suspect it has
> something to do with the order of the classpath and not the configuration.
> 
> I found this project which I can use to reproduce the problem. It works
> correctly with the embedded Jetty server, but NOT with Tomcat.
> 
> git clone -b tomcat-embedded https://github.com/reta/spring-one-jar.git
> mvn package
> java -jar target/spring-one-jar-0.0.1-SNAPSHOT.one-jar.jar
> 
> This fails with:
> curl http://localhost:8080/rest/api/people?page=2
> 
> But the same procedure with Jetty works.
> git clone -b jetty-embedded https://github.com/reta/spring-one-jar.git
> 
> 
> With Tomcat the application path (@ApplicationPath) is correctly printed,
> so I think it must be related to the CXFServlet and the url-pattern.
> "INFO: Setting the server's publish address to be /api"
> 
>       @Bean
>        public Server jaxRsServer() {
>                JAXRSServerFactoryBean factory =
> RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(),
> JAXRSServerFactoryBean.class );
>                factory.setServiceBeans( Arrays.< Object >asList(
> peopleRestService() ) );
>                factory.setAddress( "/" + factory.getAddress() );
>                factory.setProviders( Arrays.< Object >asList(
> jsonProvider() ) );
>                return factory.create();
>        }
> 
> Thanks,
> Al

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com