Announcement Announcement Module
Collapse
No announcement yet.
IllegalStateException with @Configurable on Spring 2.5.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • IllegalStateException with @Configurable on Spring 2.5.5

    Having some trouble with @Configurable setup with Spring 2.5.5

    aop.xml

    Code:
    <!DOCTYPE aspectj PUBLIC    
      "-//AspectJ//DTD//EN"    "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">    
    
    <aspectj>    
      <weaver>	 	 
    	 
         <include within="net.sf.navigator.menu.MenuSecurityService"/>
    
    	...	 
      </weaver>
    </aspectj>
    appCtx

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       	   xmlns:aop="http://www.springframework.org/schema/aop"
       	   xmlns:p="http://www.springframework.org/schema/p"
       	   xmlns:context="http://www.springframework.org/schema/context"
    	   xsi:schemaLocation=
    	    "http://www.springframework.org/schema/beans 
    	     http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    		 http://www.springframework.org/schema/context 
    		 http://www.springframework.org/schema/context/spring-context-2.5.xsd
    	     http://www.springframework.org/schema/aop
    	     http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
    
    	<context:spring-configured/>
    	<context:load-time-weaver/>
    
            <bean
    		class="net.sf.navigator.menu.MenuSecurityService"
    		lazy-init="true"
    		p:someProperty-ref="someBean"/>
    </beans>
    getting

    Code:
    java.lang.IllegalStateException: Post-processor tried to replace bean instance of type [net.sf.navigator.menu.MenuSecurityService] with (proxy) object of type [$Proxy61] - not supported for aspect-configured classes!
    	at org.springframework.beans.factory.wiring.BeanConfigurerSupport.checkExposedObject(BeanConfigurerSupport.java:174)
    	at org.springframework.beans.factory.wiring.BeanConfigurerSupport.configureBean(BeanConfigurerSupport.java:147)
    	at org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect.configureBean(AnnotationBeanConfigurerAspect.aj:59)
    	at org.springframework.beans.factory.aspectj.AbstractDependencyInjectionAspect.ajc$afterReturning$org_springframework_beans_factory_aspectj_AbstractDependencyInjectionAspect$2$1ea6722c(AbstractDependencyInjectionAspect.aj:89)
    	at net.sf.navigator.menu.MenuSecurityService.<init>(MenuSecurityService.java:45)
    	at net.sf.navigator.menu.MenuPlugIn.init(MenuPlugIn.java:66)
    	at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
    	at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
    	at javax.servlet.GenericServlet.init(GenericServlet.java:212)
    	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172)
    	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)
    	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
    	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
    	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Oct 8, 2008 3:26:31 PM org.apache.catalina.core.ApplicationContext log
    INFO: Marking servlet action as unavailable
    Oct 8, 2008 3:26:31 PM org.apache.catalina.core.StandardContext loadOnStartup
    SEVERE: Servlet /fullcourtweb threw load() exception
    javax.servlet.UnavailableException
    	at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:880)
    	at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
    	at javax.servlet.GenericServlet.init(GenericServlet.java:212)
    	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172)
    	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)
    	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
    	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
    	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Oct 8, 2008 3:26:31 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8082
    Oct 8, 2008 3:26:31 PM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    Oct 8, 2008 3:26:31 PM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/47  config=null
    Oct 8, 2008 3:26:31 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 24905 ms

  • #2
    anyone?

    Comment


    • #3
      I'll bump this up one more time...

      Comment


      • #4
        Your issue looks like this one. Is it the same?

        If it's not, post complete small test-case that reproduces the problem and that is possible to check at the local standalone environment.

        Comment


        • #5
          Thanks for the reply denis. I saw this blog and few others but I don't have @Transactional on the same POJOs that I am using @Configurable with. It was obvious from the stacktrace that for some reason a proxy is being created but it just did not make sense why. Let me work on a small example and I'll post it. thanks again!

          Comment


          • #6
            Could this issue be caused by Tomcat load-time weaving not properly configured? Just a thought when I saw your stack trace.

            Cheers

            Goran

            Comment


            • #7
              Hey. I tried both TomcatInstrumentableClassLoader

              Code:
              <Context path="/myWebApp" docBase="/my/webApp/location">
                  <Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"
                          useSystemClassLoaderAsParent="false"/>
              </Context>
              as well as just with the agent in the VM both giving me the same prob, exact same exc

              Comment


              • #8
                Hi there,

                I think the problem is the lazy-loading attribute which very likely enables proxy creation.
                try removing lazy-init from this code:

                Code:
                   <bean
                		class="net.sf.navigator.menu.MenuSecurityService"
                		lazy-init="true"
                		p:someProperty-ref="someBean"/>
                If this does not help, i recommend debugging the bean post-processors, which is a little tedious, but has always helped me with such problems.

                Good luck!
                Olaf

                Comment


                • #9
                  Thanks Olaf.

                  The problem was very interesting actually. I had domain objects (like MenuSecurityService) in domain package, and some services (same names, e.g. MenuSecurityService) in services package and this was causing a problem. once I renamed the domain objects this issue went away which leads me to believe that Spring was confusing menuSecurityService bean with MenuSecurityService domain object...

                  Comment

                  Working...
                  X