Announcement Announcement Module
Collapse
No announcement yet.
@Configurable doesn't work with ServerOsgiBundleXmlWebApplicationContext Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Configurable doesn't work with ServerOsgiBundleXmlWebApplicationContext

    Hi,

    I have a problem with using @Configurable annotated beans in my web application (web bundle).
    Everything works fine without contextClass parameter in web.xml

    Code:
    <context-param>
    	<param-name>contextClass</param-name>
    	<param-value>com.springsource.server.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
    </context-param>
    then I am gettin exception:

    Code:
    java.lang.IllegalStateException: ClassLoader [org.springframework.osgi.util.BundleDelegatingClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:spring-agent.jar
    	at org.springframework.context.weaving.DefaultContextLoadTimeWeaver.setBeanClassLoader(DefaultContextLoadTimeWeaver.java:82)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1322)
    But as far as I know using contextClass parameter in web.xml is mandatory while it enables <reference ... />

    Using java-agent together with InstrumentationLoadTimeWeaver doesn't perform load-time-weaving (no exception, but also no injection in @Configurable objects)

    Here is how I enable load-time-weaving:
    Code:
    <beans ....>
    	<context:component-scan base-package="com.simple.app"/>
    	<context:spring-configured />
    	<context:annotation-config />
    	<context:load-time-weaver />
    </beans>
    So, how to make things work together ?

    I'm using Springsource DM server 1.0.2 and springframework 2.5.6.A

  • #2
    @Configurable *should* work. Please could you try this on dm Server 2.0.x?

    Comment


    • #3
      Same error on Springsource DM 2.0

      As soon as I insert ServerOsgiBundleXmlWebApplicationContext in web.xml

      Code:
      <context-param>
      	<param-name>contextClass</param-name>
      	<param-value>com.springsource.server.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
      </context-param>

      I'm getting the same exception

      Code:
      start-signalling-6           org.springframework.web.context.ContextLoader
      Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.weaving.AspectJWeavingEnabler#0': Initialization of bean failed; nested exception is
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [org.springframework.osgi.util.BundleDelegatingClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:spring-agent.jar
      Without ServerOsgiBundleXmlWebApplicationContext it's working fine, but I'm required to use this contextClass if I use war bundle as mentioned in programmer guide.

      Comment


      • #4
        Thanks. I'm asking around in the team to try to understand why we seem to have such a basic limitation and what might be done about it.

        I suppose a workaround would be to somehow separate the web bundle from the code that needs the @Configurable applying to it and put the latter in a non-web bundle that the web bundle could then use. I don't know how much sense that would make for your application.

        Comment


        • #5
          We can't see why you are hitting this as the underlying supported is (intended to be) completely general across all kinds of bundles.

          Please could you raise a defect to help us look into this? Please attach a cut down version of your application which is sufficient to reproduce the problem. The smaller it is and the fewer dependencies it has the better. (Actually, cutting down the app to a minimal example to recreated the problem often enables users to find the problem themselves - at least in the cases where there is a bug in the app.)

          Comment


          • #6
            Defect raised

            Defect raised
            https://issuetracker.springsource.com/browse/DMS-2490

            The cut down version was not a problem as I always follow mentioned principle "cutting down the app to a minimal example to recreated the problem often enables users to find the problem themselves".
            But of course it doesn't mean that bug isn't in my application

            Thanks.

            Comment


            • #7
              We'll see. Thanks very much for taking the time to raise this defect and provide a test.

              Comment

              Working...
              X