Announcement Announcement Module
Collapse
No announcement yet.
JMX and HttpInvokerProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMX and HttpInvokerProxyFactoryBean

    Slightly strange scenario: I have a web app that uses the HttpInvokerProxyFactoryBean to get services from other remote services. I have a simple servlet that starts this service. Starting this service pretty much just entails using :

    XmlBeanFactory factory = new XmlBeanFactory(cpr);

    to get the HttpProxy. This all works great!

    Unfortunately(?!), I need to start this service via JMX, which does not work. Instead of getting a proxy of my service from HttpInvokerProxyFactoryBean, I am getting an instance of HttpInvokerProxyFactoryBean. In looking at the spring debug i see two different bean loading scenarios(one for the servlet start, and one for the jmx start.) The main difference that I see is that the servlet start is correctly using XmlBeanFactory, while the JMX start is using CachedIntrospectionResults. I am not to experienced at this level...but any iideas about this?


    Sorry about the length, but I have included the debug below.
    Here is the servlet start:



    [#|2006-08-03T09:47:48.729-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|

    2006-08-03 09:47:48,729 DEBUG [org.springframework.beans.factory.xml.XmlBeanFacto ry] - <Creating shared instance of singleton bean 'proxyCoreContentServiceSPRING_HTTP'>

    |#]



    [#|2006-08-03T09:47:48.729-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,729 DEBUG [org.springframework.beans.factory.xml.XmlBeanFacto ry] - <Creating instance of bean 'proxyCoreContentServiceSPRING_HTTP' with merged definition [Root bean: class [org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [CoreServiceBeans.xml]]>

    |#]



    [#|2006-08-03T09:47:48.729-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,729 DEBUG [org.springframework.beans.factory.xml.XmlBeanFacto ry] - <Invoking BeanPostProcessors before instantiation of bean 'proxyCoreContentServiceSPRING_HTTP'>

    |#]



    [#|2006-08-03T09:47:48.744-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,744 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] - <Using cached introspection results for class [org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean]>

    |#]


    [#|2006-08-03T09:47:48.744-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,744 DEBUG [org.springframework.beans.factory.xml.XmlBeanFacto ry] - <Eagerly caching bean with name 'proxyCoreContentServiceSPRING_HTTP' to allow for resolving potential circular references>


    [#|2006-08-03T09:47:48.744-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,744 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void org.springframework.remoting.support.UrlBasedRemot eAccessor.setServiceUrl(java.lang.String)] on object of class [org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean]>


    [#|2006-08-03T09:47:48.744-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,744 DEBUG [org.springframework.beans.BeanWrapperImpl] - <Invoked write method [public void org.springframework.remoting.support.UrlBasedRemot eAccessor.setServiceUrl(java.lang.String)] with value of type [java.lang.String]>


    [#|2006-08-03T09:47:48.744-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,744 DEBUG [org.springframework.beans.PropertyTypeConverter] - <Converting String to [class java.lang.Class] using property editor [org.springframework.beans.propertyeditors.ClassEdi tor@1ea8fc0]>

    [#|2006-08-03T09:47:48.744-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,744 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void org.springframework.remoting.support.RemoteAccesso r.setServiceInterface(java.lang.Class)] on object of class [org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean]>

    [#|2006-08-03T09:47:48.744-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,744 DEBUG [org.springframework.core.CollectionFactory] - <Creating [java.util.IdentityHashMap]>


    [#|2006-08-03T09:47:48.744-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,744 DEBUG [org.springframework.aop.framework.ProxyFactory] - <Added new aspect interface: net.pno.maya.service.core.content.CoreContentServi ce>

    |#]



    [#|2006-08-03T09:47:48.744-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:48,744 DEBUG [org.springframework.aop.framework.JdkDynamicAopPro xy] - <Creating JDK dynamic proxy>

    |#]


    [#|2006-08-03T09:47:48.776-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|????? The class of HTTP invoker proxy for service URL [http://localhost:8080/maya/http/CoreContentService.svc] is $Proxy71|


    And this is the JMX bean load debug:


    [#|2006-08-03T09:47:26.525-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|

    2006-08-03 09:47:26,525 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] - <Getting BeanInfo for class [org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean]>

    |#]



    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] - <Caching PropertyDescriptors for class [org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean]>

    |#]



    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] - <Found property 'class' of type [java.lang.Class]>

    |#]


    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] - <Found property 'serviceInterface' of type [java.lang.Class]>

    |#]



    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] - <Found property 'serviceUrl' of type [java.lang.String]>

    |#]



    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] - <Found property 'singleton' of type [boolean]>

    |#]



    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.beans.CachedIntrospectionResul ts] - <Class [org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean] is not cache-safe>

    |#]



    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.core.CollectionFactory] - <Creating [java.util.LinkedHashMap]>

    |#]



    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void org.springframework.remoting.support.UrlBasedRemot eAccessor.setServiceUrl(java.lang.String)] on object of class [org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean]>

    |#]



    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.beans.BeanWrapperImpl] - <Invoked write method [public void org.springframework.remoting.support.UrlBasedRemot eAccessor.setServiceUrl(java.lang.String)] with value of type [java.lang.String]>

    |#]



    [#|2006-08-03T09:47:26.588-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,588 DEBUG [org.springframework.beans.PropertyTypeConverter] - <Converting String to [class java.lang.Class] using property editor [org.springframework.beans.propertyeditors.ClassEdi tor@fca1ca]>

    |#]



    [#|2006-08-03T09:47:26.603-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,603 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void org.springframework.remoting.support.RemoteAccesso r.setServiceInterface(java.lang.Class)] on object of class [org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean]>

    |#]



    [#|2006-08-03T09:47:26.603-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|2006-08-03 09:47:26,603 DEBUG [org.springframework.beans.BeanWrapperImpl] - <Invoked write method [public void org.springframework.remoting.support.RemoteAccesso r.setServiceInterface(java.lang.Class)] with value of type [java.lang.Class]>

    |#]



    [#|2006-08-03T09:47:26.603-0700|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID =12;|????? The class of org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean@1794e36 is org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean|#]

  • #2
    I am assuming 'cpr' in the first code means ClassPathResource or something? Also, is there a reason you are using XmlBeanFactory instead of ApplicationContext?

    When you say 'starting the service', do you mean retrieving the client proxy? Can you please post the relevant parts of your configuration?

    Jess

    Comment


    • #3
      Thanks for the help. Yes, the set up is a bit confusing, I will try and fill in the details...

      Right. cpr is classpath resource. This looks correct, to me, but I spent quite a bit of time making sure that there were not duplicate spring config files, strange classpath issues, ect.

      I should also mention that we are using Sun's Application Server 'SJSAS' 8.2. Not my choice, but what can you do.

      When i say 'starting the service' i mean getting the bean, or in this case, proxy from Spring. In the servlet case, it returns the proxy, in the JMX case it returns an instance of HttpInvokerProxyFactoryBean. The only runtime difference was the way in which the spring beans were loaded, as I documented in the original post.

      Is there an advantage to using the ApplicationContext in this case? I used the XmlBeanFactory mostly from perusing Spring docs. We also wanted to control post-bean processing. This would be interesting to try.

      I would be happy to post any or all of the configuration, but is there any specific pieces that would be the most helpful? I was afraid to inundate the post with files and cutandpastes.
      Last edited by josephshoop; Aug 4th, 2006, 11:55 AM.

      Comment

      Working...
      X